dotfiles/home/dot_config/wofi/executable_wofi-power.sh.tmpl

19 lines
430 B
Cheetah
Raw Normal View History

2023-02-25 16:18:35 +00:00
#!/bin/bash
entries="⇠ Logout\n⏾ Suspend\n⭮ Reboot\n⏻ Shutdown"
selected=$(echo -e $entries|wofi --width 350 --height 250 --dmenu --cache-file /dev/null | awk '{print tolower($2)}')
2023-09-11 00:20:07 +00:00
cmd="{{- if .settings.systemd }}systemctl{{ else }}loginctl{{ end }}"
2023-02-25 16:18:35 +00:00
case $selected in
logout)
swaymsg exit;;
suspend)
2023-09-11 00:20:07 +00:00
exec ${cmd} suspend;;
2023-02-25 16:18:35 +00:00
reboot)
2023-09-11 00:20:07 +00:00
exec ${cmd} reboot;;
2023-02-25 16:18:35 +00:00
shutdown)
2023-09-11 00:20:07 +00:00
exec ${cmd} poweroff -i;;
2023-02-25 16:18:35 +00:00
esac