1
0
mirror of https://github.com/eoli3n/dotfiles synced 2024-11-26 06:08:35 +01:00
eoli3n-dotfiles/roles/wofi/templates/powermenu.sh.j2

33 lines
605 B
Plaintext
Raw Normal View History

2022-10-30 01:24:25 +02:00
#!/usr/bin/env bash
2022-10-30 11:58:14 +01:00
action=$(echo -e "suspend\nlock\nlogout\nshutdown\nreboot" | wofi -d -p "power:" -L 7)
2022-10-30 01:24:25 +02:00
if [[ "$action" == "lock" ]]
then
2022-12-10 17:41:43 +01:00
swaylock-fancy --font "JetBrains-Mono-Light"
2022-10-30 01:24:25 +02:00
fi
if [[ "$action" == "suspend" ]]
then
{% if ansible_distribution_release == "void" %}
2022-12-10 17:41:43 +01:00
swaylock-fancy --font "JetBrains-Mono-Light" && sudo zzz
2022-10-30 01:24:25 +02:00
{% else %}
2022-12-10 17:41:43 +01:00
swaylock-fancy --font "JetBrains-Mono-Light" && systemctl suspend
2022-10-30 01:24:25 +02:00
{% endif %}
fi
if [[ "$action" == "logout" ]]
then
swaymsg exit
fi
if [[ "$action" == "shutdown" ]]
then
shutdown now
fi
if [[ "$action" == "reboot" ]]
then
reboot
fi