dotfiles/wofi/system.sh

22 lines
414 B
Bash
Raw Normal View History

2020-12-15 20:43:31 +01:00
#!/usr/bin/env bash
2020-02-23 17:53:28 +01:00
chosen="$(wofi --dmenu --insensitive <<-END
[Cancel]
Logout
2020-11-24 01:23:42 +01:00
Poweroff
Reboot
Suspend
Hibernate
Suspend-then-hibernate
END
)"
2020-02-23 17:53:28 +01:00
if [[ "${chosen}" = "Logout" ]]; then
2020-02-23 17:53:28 +01:00
swaymsg exit
loginctl terminate-session "$(loginctl session-status | awk 'NR==1{print $1}')"
elif [ -z "${chosen}" ] || [[ "${chosen}" = "[Cancel]" ]]; then
exit 0;
2020-02-23 17:53:28 +01:00
fi
systemctl "$(tr '[:upper:]' '[:lower:]' <<< "${chosen}")"