diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-21 17:48:47 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-21 17:48:47 -0400 |
| commit | 09f4d205fe463faf676f95e798d08e8bf498be96 (patch) | |
| tree | ac60b2aa4d8350d5ab3c0e6f76361daf70d1d702 /dotfiles/hyprland/.config | |
| parent | eee30be993c6ff79a5e7fa5f37d6ba368dc0c3d9 (diff) | |
| download | archsetup-09f4d205fe463faf676f95e798d08e8bf498be96.tar.gz archsetup-09f4d205fe463faf676f95e798d08e8bf498be96.zip | |
feat(hyprland): add airplane-mode waybar toggle
I added a laptop-only waybar button that drops the machine into a low-power state and restores it on a second click. Engaging turns wifi off, sets the CPU energy-performance preference to power, dims the backlight to 35%, and stops network-only services (tailscale, proton-vpn, avahi, cups, wsdd, geoclue, sshd, fail2ban, syncthing). Bluetooth is left alone so earbuds keep working.
Disengaging replays the state recorded when airplane mode was engaged rather than writing hardcoded defaults. A lever already in its low-power position is left untouched: wifi that was already off stays off, and a service that was already stopped isn't restarted.
The indicator hides itself on machines with no battery, so desktops never show the button. State lives in $XDG_RUNTIME_DIR/airplane-state, and the bar refreshes the moment the toggle fires via a realtime signal.
Diffstat (limited to 'dotfiles/hyprland/.config')
| -rw-r--r-- | dotfiles/hyprland/.config/waybar/config | 8 | ||||
| -rw-r--r-- | dotfiles/hyprland/.config/waybar/style.css | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/dotfiles/hyprland/.config/waybar/config b/dotfiles/hyprland/.config/waybar/config index 2ae43fe..97fb3b7 100644 --- a/dotfiles/hyprland/.config/waybar/config +++ b/dotfiles/hyprland/.config/waybar/config @@ -18,6 +18,7 @@ "custom/netspeed", "pulseaudio", "custom/touchpad", + "custom/airplane", "idle_inhibitor", "custom/pocketbook", "tray", @@ -149,6 +150,13 @@ "on-click": "toggle-touchpad" }, + "custom/airplane": { + "exec": "waybar-airplane", + "return-type": "json", + "signal": 10, + "on-click": "airplane-mode" + }, + "idle_inhibitor": { "format": "<span size='large'>{icon}</span>", "format-icons": { diff --git a/dotfiles/hyprland/.config/waybar/style.css b/dotfiles/hyprland/.config/waybar/style.css index 3a849c5..cd158d0 100644 --- a/dotfiles/hyprland/.config/waybar/style.css +++ b/dotfiles/hyprland/.config/waybar/style.css @@ -77,6 +77,7 @@ window#waybar { #custom-worldclock, #custom-layout, #custom-touchpad, +#custom-airplane, #window { padding: 0.45rem; margin: 0.3rem; @@ -98,6 +99,7 @@ window#waybar { #pulseaudio:hover, #sysmonitor:hover, #custom-touchpad:hover, +#custom-airplane:hover, #custom-layout:hover { background-color: #474544; border-radius: 1rem; @@ -112,6 +114,10 @@ window#waybar { color: #d47c59; } +#custom-airplane.active { + color: #d7af5f; +} + #temperature.warning { color: #d7af5f; } |
