jluttine / rofi-power-menu

Configurable power menu mode for Rofi and dmenu
MIT License
422 stars 53 forks source link

Use of `loginctl terminate-session` to logout is apparently nonstandard #22

Open LRitzdorf opened 1 year ago

LRitzdorf commented 1 year ago

When attempting to log out of i3 via loginctl terminate-sesison (as rofi-power-menu currently does), i3 exits with code 1. This is reported as an error by sddm, and also leaves behind an X session with a background image and responsive cursor but no interactable elements, which must be killed via Ctrl+Alt+Bksp.

I originally opened this as an issue on i3, but after further testing, found that Openbox and Awesome behave in the same way when killed by loginctl. Thus, it would appear that terminating a session in this way is not a standard method of logging out, and should probably not be the default configuration for rofi-power-menu. Unfortunately, I'm not sure what an appropriate replacement would be, though I'm also not very experienced in the area of desktop interface standards to begin with.

LBlend commented 1 year ago

I've stumbled upon a similar issue on Hyprland. It would be nice if we could specify what action would be executed for each item.

LRitzdorf commented 1 year ago

If it helps, I've been able to work around this by having rofi-power-menu call a shell script of my own:

#!/bin/sh

if [ -z "$DISPLAY" ]; then
    exit 1
fi
case "$XDG_CURRENT_DESKTOP" in
    "i3")
        i3-msg exit ;;
    "Hyprland")
        hyprctl dispatch exit ;;
    *)
        loginctl terminate-session "${XDG_SESSION_ID:-}" ;;
esac

Adding more desktop environments here should be pretty self-explanatory :)

LBlend commented 1 year ago

If it helps, I've been able to work around this by having rofi-power-menu call a shell script of my own:

#!/bin/sh

if [ -z "$DISPLAY" ]; then
    exit 1
fi
case "$XDG_CURRENT_DESKTOP" in
    "i3")
        i3-msg exit ;;
    "Hyprland")
        hyprctl dispatch exit ;;
    *)
        loginctl terminate-session "${XDG_SESSION_ID:-}" ;;
esac

Adding more desktop environments here should be pretty self-explanatory :)

Ah great! This is exactly what I'm looking for!

This might be a dumb question but how did you get rofi-power-menu run your script? Did you just modify the source code on your own?

LRitzdorf commented 1 year ago

I did, yes. The actual executable (i.e. which rofi-power-menu) is a shell script, so editing is pretty straightforward.

Also, since I'm on Arch, pacman will at least warn me if it's about to overwrite my changes, and save a backup of them. Your mileage with apt or whatever else may vary.

LBlend commented 1 year ago

I see! I'm on Arch as well so I'll just have to keep an eye out for that I guess! Thank you!

LRitzdorf commented 1 year ago

At the risk of going too far off topic, that's just pacman's pacnew/pacsave system. The pacdiff tool (part of the pacman-contrib package) is really nice for automatically finding and resolving them, as well!