scripts/sway/power-menu.sh

56 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
# Passwordless sudo required for systemctl [reboot|poweroff|hibernate]
# Determine if Sway or i3
if [ -z ${SWAYSOCK+x} ]; then
WM="i3"
else
WM="sway"
fi
if [[ $WM == 'i3' ]]; then
res=$(printf "⚿ Lock|↩ Logout|↻ Reload i3|↹ Restart i3|↯ Hibernate|🡙 Reboot|⏻ Shutdown" | rofi -sep "|" -dmenu -i -p 'Power: ' "" -columns 1 -rows 7 -width 32 -l 1 -theme /home/jpm/.config/rofi/sidebar.rasi -hide-scrollbar -eh 1 -location 0 -padding 12 -opacity 100 -auto-select -no-fullscreen)
else
res=$(printf "⚿ Lock\n🖵 Toggle Displays\n⚿ Yubico Authenticator\n↻ Reload Sway\n↻ Reload Waybar\n↩ Logout\n↯ Hibernate\n🡙 Reboot\n⏻ Shutdown" | wofi -I -s $HOME/.dotfiles/wofi/style.css -c $HOME/.dotfiles/wofi/sidebar --show dmenu
)
fi
if [ "$res" == "⚿ Lock" ]; then
${WM}lock -c 000000
elif [ "$res" == "↩ Logout" ]; then
# Prevent auto-login
rm /home/jpm/.config/last_login_gui
${WM} exit
elif [ "$res" == "🖵 Toggle Displays" ]; then
/home/jpm/scripts/sway/toggle_outputs.sh
elif [ "$res" == "⚿ Yubico Authenticator" ]; then
/home/jpm/scripts/rofi/rofi-yubioath.sh
elif [ "$res" == "↻ Reload i3" ]; then
i3 reload
elif [ "$res" == "↹ Restart i3" ]; then
i3 restart
elif [ "$res" == "↻ Reload Sway" ]; then
sway reload
<<<<<<< Updated upstream
/home/jpm/scripts/sway/displays.pl
elif [ "$res" == "↻ Reload Waybar" ]; then
# Need to integrate with sway/displays.pl for alternative outputs
/home/jpm/scripts/sway/displays.pl -w
=======
/home/jpm/scripts/distrobox/debian12/displays.sh
elif [ "$res" == "↻ Reload Waybar" ]; then
# Need to integrate with sway/displays.pl for alternative outputs
/home/jpm/scripts/distrobox/debian12/displays.sh -w
>>>>>>> Stashed changes
elif [ "$res" == "🡙 Reboot" ]; then
rm $SSH_AUTH_SOCK
sudo systemctl reboot -i
elif [ "$res" == "⏻ Shutdown" ]; then
rm $SSH_AUTH_SOCK
sudo systemctl poweroff -i
elif [ "$res" == "↯ Hibernate" ]; then
sudo systemctl hibernate -i
fi
exit 0