views:

317

answers:

2

Hey, I'd like to get a shell script to run everytime I unlock my computer, on KDE 4. I learned that I could run one by overwriting /usr/lib/kde4/libexec/krunner_lock with a shell script doing its thing, then the original krunner_lock binary, and I'd basically want to do the opposite: launch a script that "undoes" what the locking script does. I'm on Kubuntu 9.04 64-bit but I appreciate answers for any operating system, in case I ever want to do the same on that system.

+1  A: 

Reading from this page, it seems like krunner_lock will stay running as long as the screen is locked, so you should be able to place the commands after the line that runs it and they will run once the screen unlocks.

e.g.

#!/bin/bash
...
# do stuff
...
real_krunner_lock # exits once screen unlocks...
...
# undo stuff
Porges
+1  A: 

Figured it out on the KDE forums here. Porges's solution is pretty close to the answer but it's not quite there yet. You have to pass the arguments that the script receives to the real krunner_lock, like so: krunner_lock_bin $@

Etienne Perot