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

32 lines
716 B
Bash
Executable File

#!/usr/bin/env zsh
let is_active=0
systemctl --user --quiet is-active swayidle.service && is_active=1
local swayidle_state
(( is_active )) && swayidle_state='Enabled' || swayidle_state='Disabled'
choice="$(fuzzel --index -d -p "Cur: ${swayidle_state} > " <<'EOF'
Enable
Disable
EOF
)"
(( ${?} != 0 )) && exit
case "${choice}" in
0)
systemctl --user start swayidle.service
;;
1)
systemctl --user stop swayidle.service
;;
esac
if [[ "${XDG_CURRENT_DESKTOP}" == 'river' ]]; then
eww -c "${HOME}/.config/river/config/" update swayidle="$(( ! ${choice} ))"
pkill -RTMIN+3 waybar
elif [[ "${XDG_CURRENT_DESKTOP}" == 'Hyprland' ]]; then
pkill -SIGRTMIN+1 waybar
fi