tvrzna / emptty

Dead simple CLI Display Manager on TTY
MIT License
696 stars 26 forks source link

Kill dbus session after logging out. #72

Closed amano-kenji closed 2 years ago

amano-kenji commented 2 years ago

dbus clients are killed if dbus is killed. After my window manager exits, dbus session started by dbus-launch from emptty is not killed. Thus, all dbus clients tied to the session dbus are not killed off after exiting my window manager.

If DBUS_LAUNCH=true, kill the session dbus after logging out. Not killing session dbus leads to process leaks after logging out and logging in multiple times.

The workaround for now is to set DBUS_LAUNCH to false and start dbus-launch in a custom emptty session.

Here's my custom emptty session for sway.

#!/bin/sh

. ~/.env

if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
  eval `dbus-launch --sh-syntax`
fi

sway

kill $DBUS_SESSION_BUS_PID
tvrzna commented 2 years ago

I hoped that --exit-with-session would help, but it works only with Xorg. dbus-run-session starts another unnecessary process and running that as script wrapper is out of the question since it's the thing emptty is trying to avoid. Seems like starting dbus-launch before starting the session (as it is at your script) is best way how to handle it.

amano-kenji commented 2 years ago

dbus-run-session actually seems like a good solution to me. Would dbus-run-session not simplify your code?

tvrzna commented 2 years ago

I don't like the idea of running an another process during the user session. Especially when it could be done quite simply inside emptty.

edit: but if it fits more to you, you are free to use it in your ~/.config/emptty of course.

amano-kenji commented 2 years ago

Whatever you say. I'm okay with the current implementation. I will come back with test result.

amano-kenji commented 2 years ago

I just tested the latest commit, and it seems to fix the issue. But, I don't know whether the new code introduced hidden bugs.

If I find new bugs, I will open new issues.

tvrzna commented 2 years ago

Thank for the retest. The rule is, that one fixed bug brings atleast two new bugs.