forge
Explore
Log in

Don't you dare go Hollow

Logout under niri, not just Hyprland

Browse files at this commit

fe65316b8b6002eedd5431d156e9b94123855e42Ahmet Kaan GümüşParent: 0c8c81e
  • fix
    • logout under niri, not just Hyprland
Show full message
fix(power-menu): logout under niri, not just Hyprland

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.shmodified+17 -1
@@ -17,7 +17,23 @@ case "$menu" in
17 systemctl suspend17 systemctl suspend
18 ;;18 ;;
19 "🚪 Logout")19 "🚪 Logout")
20- hyprctl dispatch exit20+ # Shared by both compositors, so the exit command is picked at runtime.
21+ # hyprctl is a no-op under niri, which is what silently broke logout.
22+ #
23+ # Hyprland is checked FIRST on purpose: niri pushes NIRI_SOCKET into the
24+ # systemd --user manager environment and never unsets it on exit, so a
25+ # niri -> Hyprland switch that kept the same user manager alive would
26+ # leave a stale NIRI_SOCKET behind, and `niri msg` does not fall back to
27+ # socket discovery — it just errors out. That would mirror this very bug
28+ # onto Hyprland. The leak only goes that direction, so ordering fixes it.
29+ #
30+ # -s skips niri's "Press Enter to confirm" prompt, which has nowhere to
31+ # be answered when the quit comes from a rofi menu.
32+ if [ -n "${HYPRLAND_INSTANCE_SIGNATURE:-}" ]; then
33+ hyprctl dispatch exit
34+ elif [ -n "${NIRI_SOCKET:-}" ]; then
35+ niri msg action quit -s
36+ fi
21 ;;37 ;;
22 "❌ Cancel")38 "❌ Cancel")
23 ;;39 ;;