commit 845f80da873ffc0696792ca0c413117bf4650b79
parent 9a6d277740d7b77302459e4f78b6c15fc1e64634
Author: ryukamish <[email protected]>
Date: Mon, 13 Apr 2026 21:19:31 +0530
add: better way to use power options in niri
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git 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