Run script when unlocking?

Hey, I would like to get a shell script to run every time I unlock my computer on KDE 4. I found out that I can run it by overwriting / usr / lib / kde 4 / libexec / krunner_lock using the shell script by completing my task and then the source binary krunner_lock, and I would basically like to do the opposite: run a script that "cancels" what the script lock does. I am on Kubuntu 9.04 64-bit, but I appreciate the answers for any operating system if I ever want to do the same on this system.

+5
source share
3 answers

Found this out on the KDE forums here . Porges solution is pretty close to the answer, but it is not quite yet. You must pass the arguments that the script receives in real krunner_lock, for example:krunner_lock_bin $@

+2
source

Reading from this page seems krunner_lockto work as long as the screen is locked, so you should be able to place commands after the line that launches it, and they will run after the screen unlocks.

eg.

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

2015 , Kubuntu 14.10, Desktop Widgets:

#!/bin/bash

lockpidname="/usr/bin/plasma-overlay --nofork"

$lockpidname

check_slock () {
if [[ $(pgrep -fla $lockpidname) ]]; then 
SLOCKED=1
else
SLOCKED=0
fi
}

while true; do
  sleep 5
  check_slock
  case $SLOCKED  in 
  0) 
  echo "System unlocked run something here"
  break
  ;; 
  esac

done

, CTRL + ATL + L "" " ".

0

All Articles