Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using debian with kde4 I have a script that i need to be executed after a user loggins to kde. The system is setup to auto-login a user and lock the session. I tried to add the script to kde's autostart but it seams that it's not executed if the auto-login user is set to lock session right away. It only starts after the session is unlocked. How can i make the script run after the aut-login but before the auto-lock?

share|improve this question
I added an answer below, but had another thought: There is a change the script is catching a term signal with the lock. Have you tried adding an "&" and the end of the call for the script? So in the hook you have it would be &? – nerdwaller Dec 3 '12 at 20:56
up vote 0 down vote accepted

One option is to disable the auto-lock by the system and call it after the script is done. Assuming that you are able or willing to do that:

I don't use KDE, but I think this is the script for KDE 4.x+:

qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock

share|improve this answer
I just tried your initial solution. Looks like it's working. The downside is that for a couple of seconds (while the desktop loads and stats the screen) the desktop is visible and user can interact with it. I'm waiting for a better solution that works straight with auto-login and auto-lock. – AlexL Dec 3 '12 at 21:01
@AlexLinte I am downloading KDE to try to find a solution for you, assuming no one does in the mean time. – nerdwaller Dec 3 '12 at 21:43
Thanks Nerdwalle. – AlexL Dec 3 '12 at 22:18
Looks like this is the best solution so far. Thanks nerdwaller – AlexL Dec 4 '12 at 10:51
Sure thing, I apologize for not getting to test KDE much yet. Had some school stuff I had to get done. If I come up with anything, I'll be back in touch. – nerdwaller Dec 4 '12 at 13:38

The desktop-agnostic way to autostart apps in xorg is by placing *.desktop launcher files in the following folder:


Apparently KDE respects the convention and it might work.

The launchers can be copied/symlinked/drag-and-dropped from /user/share/applications.

share|improve this answer
This only works if i login to desktop. What i want is the script to execute post auto-login, pre auto-lock session. – AlexL Dec 4 '12 at 0:07
@AlexLinte: In that case you probably need to look at the options offered by your login manager: gmd, kdm, lxdm... If you use gdm then look at /etc/gdm/PostLogin/Default. Also look at /etc/X11/Xsession.d and/or /etc/X11/xinit/xinitrc.d. – ccpizza Dec 4 '12 at 21:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .