diff options
| author | 2026-05-13 13:43:28 +0100 | |
|---|---|---|
| committer | 2026-05-13 13:43:28 +0100 | |
| commit | ae9d11f899ec73862fa583989ad7060f2990c4be (patch) | |
| tree | c92ba208a7c61ec83cc9ae6b7610b468eba615eb /dot_config/waybar | |
| parent | 03a506ec81fb4b45ba905fa980e861af7e127d69 (diff) | |
| download | dotfiles-ae9d11f899ec73862fa583989ad7060f2990c4be.tar.gz dotfiles-ae9d11f899ec73862fa583989ad7060f2990c4be.tar.bz2 dotfiles-ae9d11f899ec73862fa583989ad7060f2990c4be.zip | |
feat(waybar): more clickable modules + load avg in CPU readout
- cpu: append 'LOAD {load:0.2f}' (1-min load average) to every state
- custom/wifi: left click toggles iwd Powered via D-Bus (new wifi-toggle.sh)
- custom/notifications: left click opens fuzzel history picker
(mako-history.sh, previously bound to middle-click); the awkward
per-click 'makoctl dismiss' is dropped — dismiss-all stays on right,
restore stays on middle
- clock: left click runs tb-toggle.sh (closest practical proxy for
'open Calendar tab' — Thunderbird hasn't shipped a -calendar CLI flag
since Lightning was integrated, so the user lands on whatever tab TB
was last on)
Diffstat (limited to 'dot_config/waybar')
| -rw-r--r-- | dot_config/waybar/config.jsonc | 14 | ||||
| -rw-r--r-- | dot_config/waybar/executable_wifi-toggle.sh | 26 |
2 files changed, 34 insertions, 6 deletions
diff --git a/dot_config/waybar/config.jsonc b/dot_config/waybar/config.jsonc index 51c9d08..a44309e 100644 --- a/dot_config/waybar/config.jsonc +++ b/dot_config/waybar/config.jsonc @@ -31,11 +31,11 @@ }, "cpu": { - "format": "CPU {usage}%", - "format-low": "CPU <span color='#b8bb26'>{usage}%</span>", - "format-medium": "CPU <span color='#fabd2f'>{usage}%</span>", - "format-high": "CPU <span color='#fe8019'>{usage}%</span>", - "format-critical": "CPU <span color='#fb4934'>{usage}%</span>", + "format": "CPU {usage}% LOAD {load:0.2f}", + "format-low": "CPU <span color='#b8bb26'>{usage}%</span> LOAD {load:0.2f}", + "format-medium": "CPU <span color='#fabd2f'>{usage}%</span> LOAD {load:0.2f}", + "format-high": "CPU <span color='#fe8019'>{usage}%</span> LOAD {load:0.2f}", + "format-critical": "CPU <span color='#fb4934'>{usage}%</span> LOAD {load:0.2f}", "states": { "low": 0, "medium": 30, @@ -90,6 +90,7 @@ "exec": "~/.config/waybar/wifi-status.sh", "return-type": "json", "interval": 10, + "on-click": "~/.config/waybar/wifi-toggle.sh", }, "network#bond": { @@ -130,6 +131,7 @@ "clock": { "format": "{:%a %d %b %H:%M}", "tooltip-format": "{:%Y-%m-%d %H:%M:%S}", + "on-click": "~/.config/sway/tb-toggle.sh", }, "tray": { @@ -159,7 +161,7 @@ "exec": "~/.config/waybar/mako-status.sh", "return-type": "json", "interval": 2, - "on-click": "makoctl dismiss", + "on-click": "~/.config/waybar/mako-history.sh", "on-click-right": "makoctl dismiss --all", "on-click-middle": "makoctl restore", "tooltip": true, diff --git a/dot_config/waybar/executable_wifi-toggle.sh b/dot_config/waybar/executable_wifi-toggle.sh new file mode 100644 index 0000000..68e77ab --- /dev/null +++ b/dot_config/waybar/executable_wifi-toggle.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# Toggle wifi (wlan0) Powered state via iwd's D-Bus API. Driven by waybar +# on-click on the custom/wifi module. +set -eu + +iface=wlan0 +svc=net.connman.iwd + +device=$(busctl --system --json=short call "$svc" / \ + org.freedesktop.DBus.ObjectManager GetManagedObjects | + jq -r --arg iface "$iface" ' + (.data[0] // .data) as $objs + | $objs | to_entries[] + | select(.value["net.connman.iwd.Device"].Name.data == $iface) + | .key') + +[ -n "$device" ] || { notify-send -u critical "wifi" "iwd device $iface not found"; exit 1; } + +powered=$(busctl --system --json=short get-property "$svc" "$device" \ + net.connman.iwd.Device Powered | jq -r '.data') + +if [ "$powered" = "true" ]; then + busctl --system set-property "$svc" "$device" net.connman.iwd.Device Powered b false +else + busctl --system set-property "$svc" "$device" net.connman.iwd.Device Powered b true +fi |
