EdenQwQ/home/programs/desktop/scripts/tofi/powermenu
2025-03-09 11:14:04 +08:00

22 lines
778 B
Bash
Executable file

#!/bin/sh
. ~/scripts/tofi/config
entry=$(printf "⏻ poweroff\n reboot\n mode\n exit\n suspend" | tofi_full "power")
entry=$(echo $entry | cut -d' ' -f2 )
if [ "$entry" = "poweroff" ] || [ "$entry" = "reboot" ]; then
if [ "$(~/scripts/tofi/confirm "confirm")" = "yes" ]; then
doas $entry
fi
elif [ "$entry" = "suspend" ]; then
systemctl suspend
elif [ "$entry" = "mode" ]; then
~/scripts/tofi/mode
elif [ "$entry" = "exit" ]; then
if [ "$(~/scripts/tofi/confirm "exit?")" = "yes" ]; then
doas killall swhkd swhks
systemctl --user stop waybar.service blueman-applet.service 'app-nm\\x2dapplet@autostart.service' app-org.fcitx.Fcitx5@autostart.service niri-blur-wallpaper.service
wayland-logout
fi
fi