dotfiles/home/dot_config/wofi/executable_wofi-power.sh.tmpl
2023-09-11 08:20:07 +08:00

19 lines
430 B
Bash

#!/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)}')
cmd="{{- if .settings.systemd }}systemctl{{ else }}loginctl{{ end }}"
case $selected in
logout)
swaymsg exit;;
suspend)
exec ${cmd} suspend;;
reboot)
exec ${cmd} reboot;;
shutdown)
exec ${cmd} poweroff -i;;
esac