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.
This commit is contained in:
Marty Oehme 2025-06-16 14:21:06 +02:00
parent 75fcc025f9
commit 89e1c20358
Signed by: Marty
GPG key ID: 4E535BC19C61886E
2 changed files with 8 additions and 4 deletions

View file

@ -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",

View file

@ -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