From 89e1c203581beea8e43b72b9472034626799dd87 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 16 Jun 2025 14:21:06 +0200 Subject: [PATCH] waybar: Fix keepawake module Was displaying the wrong way round (no coffee on staying awake and coffe on automatically going to sleep), and removed some useless variable setting. --- desktop/.config/waybar/config | 4 ++-- desktop/.config/waybar/modules/keepawake | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/desktop/.config/waybar/config b/desktop/.config/waybar/config index 2ceff8a..e7f5bdb 100644 --- a/desktop/.config/waybar/config +++ b/desktop/.config/waybar/config @@ -8,8 +8,8 @@ "format-alt": "{} {icon}", "format-alt-click": "click-right", "format-icons": { - "idle-disabled": "󰾫 ", - "idle-enabled": "󰅶 " + "idle-disabled": "󰅶 ", + "idle-enabled": "󰾫 " }, "exec": "~/.config/waybar/modules/keepawake", "on-click": "~/.config/waybar/modules/keepawake toggle", diff --git a/desktop/.config/waybar/modules/keepawake b/desktop/.config/waybar/modules/keepawake index bbb78d1..b73ebb8 100755 --- a/desktop/.config/waybar/modules/keepawake +++ b/desktop/.config/waybar/modules/keepawake @@ -13,14 +13,18 @@ if [ "$cmd" != "" ]; then if [ "$cmd" = "start" ] || [ "$cmd" = "toggle" ] && [ "$status" = "idle-disabled" ]; then SVDIR="$USER_SV_DIR" sv start swayidle + status="idle-enabled" elif [ "$cmd" = "stop" ] || [ "$cmd" = "toggle" ] && [ "$status" = "idle-enabled" ]; then SVDIR="$USER_SV_DIR" sv stop swayidle + status="idle-disabled" fi + printf "{\"text\": \"\", \"alt\": \"%s\", \"tooltip\": \"\", \"class\": \"\"}" \ + "$status" + exit fi -pid=$(pgrep -x swayidle) status="idle-disabled" -if [ "$pid" != "" ]; then +if pgrep -x swayidle >/dev/null; then status="idle-enabled" fi