From 6c53fd0df8d8a292ab649c1c709e44ffad70103f Mon Sep 17 00:00:00 2001 From: eoli3n Date: Sun, 30 Oct 2022 01:24:25 +0200 Subject: [PATCH] powermenu void --- roles/wofi/templates/powermenu.sh.j2 | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 roles/wofi/templates/powermenu.sh.j2 diff --git a/roles/wofi/templates/powermenu.sh.j2 b/roles/wofi/templates/powermenu.sh.j2 new file mode 100755 index 0000000..eefab16 --- /dev/null +++ b/roles/wofi/templates/powermenu.sh.j2 @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +action=$(echo -e "suspend\nlock\nlogout\nshutdown\nreboot" | wofi -d -p "power:" -L 5) + +if [[ "$action" == "lock" ]] +then + swaylock-fancy +fi + +if [[ "$action" == "suspend" ]] +then +{% if ansible_distribution_release == "void" %} + sudo zzz +{% else %} + swaylock-fancy && systemctl suspend && echo '*/reconnect' >~/.weechat/weechat_fifo +{% endif %} +fi + +if [[ "$action" == "logout" ]] +then + swaymsg exit +fi + +if [[ "$action" == "shutdown" ]] +then + shutdown now +fi + +if [[ "$action" == "reboot" ]] +then + reboot +fi