aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/wb-icon23
-rwxr-xr-xbin/wb-idle45
2 files changed, 10 insertions, 58 deletions
diff --git a/bin/wb-icon b/bin/wb-icon
index 9c29c60..b8f91cc 100755
--- a/bin/wb-icon
+++ b/bin/wb-icon
@@ -10,7 +10,6 @@
#
# wb-icon volume # reads wpctl, prints the matching icon
# wb-icon mic
-# wb-icon idle <activated|deactivated>
# wb-icon --selftest # every name this bar asks for must resolve
#
# Icons keep their own colours: this desktop's icon theme draws them with
@@ -44,10 +43,6 @@ ICONS = {
"muted": "microphone-sensitivity-muted",
"on": "audio-input-microphone",
},
- "idle": {
- "activated": "x-office-presentation",
- "deactivated": "preferences-desktop-screensaver",
- },
}
@@ -116,9 +111,18 @@ def selftest():
]
clock_icons = ["x-office-calendar", "clock"]
+ # Presentation mode is a custom module: statusctl emits the state as a
+ # class and modules.css picks the icon, so these names appear nowhere in
+ # this file. They are still the bar's icons, so they are checked here.
+ presentation_icons = [
+ "preferences-desktop-screensaver", # off
+ "x-office-presentation", # on
+ "dialog-warning", # no state file
+ ]
+
names = sorted(
{n for group in ICONS.values() for n in group.values()}
- | set(workspace_icons) | set(clock_icons)
+ | set(workspace_icons) | set(clock_icons) | set(presentation_icons)
)
missing = [n for n in names if not lookup(n)]
for n in names:
@@ -156,13 +160,6 @@ def main(argv):
label = "muted" if state == "muted" else f"{pct}%"
return emit(ICONS["mic"][state], f"Microphone: {label}")
- if what == "idle":
- state = argv[2] if len(argv) > 2 else "deactivated"
- state = state if state in ICONS["idle"] else "deactivated"
- on = state == "activated"
- return emit(ICONS["idle"][state],
- f"Presentation mode: {'on' if on else 'off'}")
-
print(f"wb-icon: unknown subject {what!r}", file=sys.stderr)
return 2
diff --git a/bin/wb-idle b/bin/wb-idle
deleted file mode 100755
index 05c4a8c..0000000
--- a/bin/wb-idle
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env bash
-# Presentation mode: keep the screen awake, and say so with a themed icon.
-# Copyright (C) 2026 Danilo M. <danix@danix.xyz>
-# Licensed under the GNU General Public License v2 only.
-#
-# waybar's own idle_inhibitor module draws its state with format-icons, which
-# is text. This drives the same idea through hypridle and reports the state as
-# an icon path for an `image` module instead.
-#
-# wb-idle status # print "$path\n$tooltip" for the image module
-# wb-idle toggle # flip the inhibitor, then refresh the module
-#
-# The inhibitor is hypridle's own pause, so nothing else has to be running.
-set -euo pipefail
-
-state_file="${XDG_RUNTIME_DIR:-/tmp}/wb-idle.state"
-
-active() { [[ -f "$state_file" ]]; }
-
-case "${1:-status}" in
-toggle)
- if active; then
- rm -f "$state_file"
- # Resume idling. Guarded: hypridle may not be running, and that is
- # not an error worth failing a click over.
- pkill -USR2 -x hypridle 2>/dev/null || true
- else
- touch "$state_file"
- pkill -USR1 -x hypridle 2>/dev/null || true
- fi
- # Refresh the module now rather than waiting for its interval.
- pkill -RTMIN+9 -x waybar 2>/dev/null || true
- ;;
-status)
- if active; then
- wb-icon idle activated
- else
- wb-icon idle deactivated
- fi
- ;;
-*)
- echo "usage: wb-idle <status|toggle>" >&2
- exit 2
- ;;
-esac