Logout under niri, not just Hyprland
Browse files at this commitfe65316b8b6002eedd5431d156e9b94123855e42Parent: 0c8c81e- fix
- logout under niri, not just Hyprland
1 changed file +17 -1
.config/scripts/system/power_menu.shmodified+17 -1
| @@ -17,7 +17,23 @@ case "$menu" in | |||
| 17 | systemctl suspend | 17 | systemctl suspend |
| 18 | ;; | 18 | ;; |
| 19 | "🚪 Logout") | 19 | "🚪 Logout") |
| 20 | - hyprctl dispatch exit | 20 | + # 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 | ;; |