diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-15 16:53:34 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-15 16:53:34 +0200 |
| commit | 9adfac969af75a09054f1eb6f1894ab6bdf8b2a5 (patch) | |
| tree | da6bb4b96f8a5a279cf42865eee8dfeb7f36eb0e /bin | |
| parent | 66a8d05e2461761b60e1b4126437d04dc4f3dbbe (diff) | |
| download | waybar-theme-udt-9adfac969af75a09054f1eb6f1894ab6bdf8b2a5.tar.gz waybar-theme-udt-9adfac969af75a09054f1eb6f1894ab6bdf8b2a5.zip | |
feat: split the bar in two on DP-3
DP-3 is rotated, so a bar there is 1080px wide rather than 1920, and one bar
holding every module was too crowded. Status sits on top now, the desktop
itself along the bottom: workspaces on the left, open windows on the right.
Both bars are one waybar process reading one stylesheet, because waybar takes
a top-level array of bars, so the two cannot drift apart.
Presentation mode is the statusctl-backed module the DP-1 bar already runs,
rather than the wb-idle module written for this bar. It talks to files under
XDG_RUNTIME_DIR instead of to quickshell, so it keeps working while the shell
is down, and it already emits a state class, so the glyphs are simply dropped
and the icon chosen in CSS. wb-idle and its module are gone.
The module needs a format of one space. It defaults to "{text}", statusctl
emits an empty text, and waybar draws no widget at all for a custom module
whose formatted output is empty: not an empty pill, no pill. That is the same
trap the launcher hit, and it cost a wrong diagnosis on the way: a min-height
was added first on the theory that the pill was collapsing, which was treating
a symptom of a widget that did not exist. A forced red background proved it
was never drawn at all.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/wb-icon | 23 | ||||
| -rwxr-xr-x | bin/wb-idle | 45 |
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 |
