From fe65316b8b6002eedd5431d156e9b94123855e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 31 Jul 2026 01:09:39 +0300 Subject: [PATCH] fix(power-menu): logout under niri, not just Hyprland MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Logout branch called `hyprctl dispatch exit`, a silent no-op under niri — so Mod+Escape opened the menu and logout did nothing since the niri port. This script is shared by both compositors, so the exit command is now picked at runtime. Hyprland is checked first on purpose: niri pushes NIRI_SOCKET into the systemd user manager environment and never unsets it, and `niri msg` errors out on a stale socket instead of rediscovering — so testing NIRI_SOCKET first would eventually mirror this same bug onto Hyprland. --- .config/scripts/system/power_menu.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.config/scripts/system/power_menu.sh b/.config/scripts/system/power_menu.sh index e03df6f..ea66acd 100755 --- a/.config/scripts/system/power_menu.sh +++ b/.config/scripts/system/power_menu.sh @@ -17,7 +17,23 @@ case "$menu" in systemctl suspend ;; "🚪 Logout") - hyprctl dispatch exit + # Shared by both compositors, so the exit command is picked at runtime. + # hyprctl is a no-op under niri, which is what silently broke logout. + # + # Hyprland is checked FIRST on purpose: niri pushes NIRI_SOCKET into the + # systemd --user manager environment and never unsets it on exit, so a + # niri -> Hyprland switch that kept the same user manager alive would + # leave a stale NIRI_SOCKET behind, and `niri msg` does not fall back to + # socket discovery — it just errors out. That would mirror this very bug + # onto Hyprland. The leak only goes that direction, so ordering fixes it. + # + # -s skips niri's "Press Enter to confirm" prompt, which has nowhere to + # be answered when the quit comes from a rofi menu. + if [ -n "${HYPRLAND_INSTANCE_SIGNATURE:-}" ]; then + hyprctl dispatch exit + elif [ -n "${NIRI_SOCKET:-}" ]; then + niri msg action quit -s + fi ;; "❌ Cancel") ;;