aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config/waybar/executable_wifi-toggle.sh
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-13 13:43:28 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-13 13:43:28 +0100
commitae9d11f899ec73862fa583989ad7060f2990c4be (patch)
treec92ba208a7c61ec83cc9ae6b7610b468eba615eb /dot_config/waybar/executable_wifi-toggle.sh
parent03a506ec81fb4b45ba905fa980e861af7e127d69 (diff)
downloaddotfiles-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/executable_wifi-toggle.sh')
-rw-r--r--dot_config/waybar/executable_wifi-toggle.sh26
1 files changed, 26 insertions, 0 deletions
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