Run script after user login to kde

1

1

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?

AlexL

Posted 2012-12-03T20:46:31.610

Reputation: 191

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 script_name.sh &? – nerdwaller – 2012-12-03T20:56:08.327

Answers

0

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

nerdwaller

Posted 2012-12-03T20:46:31.610

Reputation: 13 366

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 – 2012-12-03T21:01:37.030

@AlexLinte I am downloading KDE to try to find a solution for you, assuming no one does in the mean time. – nerdwaller – 2012-12-03T21:43:37.857

Looks like this is the best solution so far. Thanks nerdwaller – AlexL – 2012-12-04T10:51:21.047

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 – 2012-12-04T13:38:36.867

2

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

~/.config/autostart

Apparently KDE respects the convention and it might work.

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

See also https://raspberrypi.stackexchange.com/a/74407/74631 for alternative options (it applies to most modern generic linuces).

ccpizza

Posted 2012-12-03T20:46:31.610

Reputation: 5 372

This only works if i login to desktop. What i want is the script to execute post auto-login, pre auto-lock session. – AlexL – 2012-12-04T00:07:57.287

@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 – 2012-12-04T21:02:53.917