From 845f80da873ffc0696792ca0c413117bf4650b79 Mon Sep 17 00:00:00 2001 From: ryukamish Date: Mon, 13 Apr 2026 21:19:31 +0530 Subject: add: better way to use power options in niri --- scripts/rofi-powermenu | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') 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 -- cgit v1.3