Am 23.07.2013 16:44, schrieb Michael Biebl:
> We could also ship an autostart file in systemd itself, which runs
> everywhere besides GNOME and KDE

I played a bit with this idea. The problem is, systemd-inhibit needs to
be tied to a running process, so I've tried this autostart file:

[Desktop Entry]
Name=systemd-inhibit
Comment=Inhibit systemd power events
Exec=systemd-inhibit
--what=handle-lid-switch:handle-power-key:handle-suspend-key:handle-hibernate-key
sleep 9999d
Terminal=false
Type=Application
NoDisplay=true
NotShowIn=KDE;

This has the unpleasant side-effect, that systemd-inhibit still keeps
running after the logout, since sleep is not killed during the logout.

An alternative idea was, to tie it to the dbus user session:

diff --git a/X11/Xsession.d/75dbus_dbus-launch
b/X11/Xsession.d/75dbus_dbus-launch
index af7ba49..afc19a9 100644
--- a/X11/Xsession.d/75dbus_dbus-launch
+++ b/X11/Xsession.d/75dbus_dbus-launch
@@ -5,6 +5,7 @@

 STARTDBUS=
 DBUSLAUNCH=/usr/bin/dbus-launch
+INHIBIT="systemd-inhibit
--what=handle-lid-switch:handle-power-key:handle-suspend-key:handle-hibernate-key"

 if has_option use-session-dbus; then
   if [ -x "$DBUSLAUNCH" ]; then
@@ -13,5 +14,5 @@ if has_option use-session-dbus; then
 fi

 if [ -n "$STARTDBUS" ]; then
-  STARTUP="$DBUSLAUNCH --exit-with-session $STARTUP"
+  STARTUP="$INHIBIT $DBUSLAUNCH --exit-with-session $STARTUP"
 fi


This way, systemd-inhibit is properly killed on logout. This does have
the downside of having to encode in a single file, in which desktop
environment it should be run or not.

Michael



-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to