From 76014299e8bb689d708c1d868b613a485c54bc59 Mon Sep 17 00:00:00 2001 From: Smirnov Oleksandr Date: Wed, 8 Nov 2023 15:16:56 +0200 Subject: [PATCH] add power menu for hyprland using wofi --- bin/wofi-power-menu | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 bin/wofi-power-menu diff --git a/bin/wofi-power-menu b/bin/wofi-power-menu new file mode 100755 index 0000000..35acf22 --- /dev/null +++ b/bin/wofi-power-menu @@ -0,0 +1,25 @@ +#!/bin/env bash + +entries="⇠ logout\n⏾ suspend\n⭮ reboot\n⏻ poweroff" +selected=$(echo -e "$entries" | + wofi --dmenu --cache-file /dev/null | + awk '{print tolower($2)}') + +shall_continue() { + entries="Yes\nNo" + selected=$(echo -e "$entries" | + wofi --dmenu --cache-file /dev/null | + awk '{print tolower($1)}') + + case $selected in + yes) exec "$@" ;; + no) exit 0 ;; + esac +} + +case $selected in +logout) shall_continue hyprctl dispatch exit ;; +suspend) shall_continue systemctl suspend ;; +rebbot) shall_continue systemctl reboot ;; +poweroff) shall_continue systemctl poweroff ;; +esac