summaryrefslogtreecommitdiff
path: root/scripts/rofi-powermenu
diff options
context:
space:
mode:
authorryukamish <[email protected]>2026-04-13 21:19:31 +0530
committerryukamish <[email protected]>2026-04-13 21:19:31 +0530
commit845f80da873ffc0696792ca0c413117bf4650b79 (patch)
tree581f38dae17b0a15bd833f07e02adc98b41b7238 /scripts/rofi-powermenu
parent9a6d277740d7b77302459e4f78b6c15fc1e64634 (diff)
add: better way to use power options in niri
Diffstat (limited to 'scripts/rofi-powermenu')
-rwxr-xr-xscripts/rofi-powermenu8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/rofi-powermenu b/scripts/rofi-powermenu
index 6209944..57d3fe8 100755
--- a/scripts/rofi-powermenu
+++ b/scripts/rofi-powermenu
@@ -1,18 +1,18 @@
#!/usr/bin/env bash
power_args=$(printf '%b' ' Lock\nLogout\n Restart\n󰒲 Suspend\n󰋊 Hibernate\n󰚦 Shutdown' |
- rofi -dmenu -p "󰐥 " -i -theme-str 'window {width: 12em; padding: 2px; height: 16em;}')
+ rofi -dmenu -p "󰐥" -i -theme-str 'window {width: 12em; padding: 2px; height: 16em;}')
case "$power_args" in
*Lock)
- if [[ "$XDG_CURRENT_DESKTOP" == "niri" ]]; then
+ if [[ -n "$NIRI_SOCKET" ]]; then
command -v swaylock &>/dev/null && swaylock
elif [[ "$XDG_CURRENT_DESKTOP" == "Hyprland" ]]; then
hyprlock
fi
;;
*Logout)
- if [[ "$XDG_CURRENT_DESKTOP" == "niri" ]]; then
+ if [[ -n "$NIRI_SOCKET" ]]; then
niri msg action quit
elif [[ "$XDG_CURRENT_DESKTOP" == "Hyprland" ]]; then
hyprctl dispatch exit
@@ -28,7 +28,7 @@ case "$power_args" in
systemctl hibernate
;;
*Shutdown)
- if [[ "$XDG_CURRENT_DESKTOP" == "niri" ]]; then
+ if [[ -n "$NIRI_SOCKET" ]]; then
systemctl poweroff
elif [[ "$XDG_CURRENT_DESKTOP" == "Hyprland" ]]; then
hyprctl dispatch killactive && sleep 0.1 && hyprctl dispatch killactive && sleep 0.1 && systemctl poweroff