Files
random-scripts/system-menu/system-sleep-menu.sh
T

32 lines
716 B
Bash
Raw Normal View History

2023-11-27 19:26:54 -08:00
#!/usr/bin/env zsh
2025-11-29 16:57:38 -08:00
let is_active=0
systemctl --user --quiet is-active swayidle.service && is_active=1
2024-05-16 04:18:17 -07:00
2025-11-29 16:57:38 -08:00
local swayidle_state
(( is_active )) && swayidle_state='Enabled' || swayidle_state='Disabled'
2023-11-27 19:26:54 -08:00
choice="$(fuzzel --index -d -p "Cur: ${swayidle_state} > " <<'EOF'
Enable
Disable
EOF
)"
(( ${?} != 0 )) && exit
case "${choice}" in
0)
2025-11-29 16:57:38 -08:00
systemctl --user start swayidle.service
2023-11-27 19:26:54 -08:00
;;
1)
2025-11-29 16:57:38 -08:00
systemctl --user stop swayidle.service
2023-11-27 19:26:54 -08:00
;;
esac
2025-02-04 21:02:12 -08:00
if [[ "${XDG_CURRENT_DESKTOP}" == 'river' ]]; then
eww -c "${HOME}/.config/river/config/" update swayidle="$(( ! ${choice} ))"
2025-10-09 22:40:38 -07:00
pkill -RTMIN+3 waybar
2025-02-04 21:02:12 -08:00
elif [[ "${XDG_CURRENT_DESKTOP}" == 'Hyprland' ]]; then
pkill -SIGRTMIN+1 waybar
fi