Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LRitzdorf opened this issue Jun 27, 2023 · 8 comments
Open

Comments

@LRitzdorf
Copy link

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
Copy link

LBlend commented Aug 19, 2023

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
Copy link
Author

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
Copy link

LBlend commented Aug 22, 2023

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
Copy link
Author

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
Copy link

LBlend commented Aug 23, 2023

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
Copy link
Author

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!

@kennykingdev
Copy link

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.

This is my thought as well, running sway in my case. The option to set everything with a config file would be great!

macedigital added a commit to macedigital/rofi-power-menu that referenced this issue Jan 1, 2025
Commit changes logout command to gracefully terminate session using a signal only. This should prevent issues with greeters associated with a given user session becoming broken after logout.

New method successfully tested with SwayWM. More feedback for other window managers is welcome.

See jluttine#22.
@macedigital
Copy link

I stumbled on this issue as well (broken SDDM greeter after logging out) and I believe there is a better way by changing the command to loginctl kill-session "${XDG_SESSION_ID-}"1.

The solution should be agnostic about greeter or window-manager, neither requiring adding more cases e.g. to the wrapper script from #22 (comment), (e.g. sway sessions would be stopped with swaymsg exit), nor passing in configuration options.

I've prepared a pull-request #36 and would welcome feedback if the change fixes the issue for others as well.

Footnotes

  1. https://github.com/jluttine/rofi-power-menu/blob/395c1e07360b2dbd13c0a658665ab0a581024ec3/rofi-power-menu#L43C27-L43C36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants