<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I recently installed kde5 on debian stretch. I have a yubikey which
I use to log in with. I'd like to lock the screen when I remove the
yubikey. I have it working with cinnamon and lxde but I can't quite
get it with kde. I can lock the screen if I run the shell script
from a terminal as root but when I remove the yubikey the shell
script returns error code 1.<br>
<br>
Here's my shell scripts:<br>
<br>
ykgone.sh<br>
<br>
<title>Konsole output</title>
<div>
<span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">#! /bin/sh
</span><br>
if [ -z "$(lsusb | grep Yubikey)" ] ; then
<br>
if [ ! -z "$(ps aux | grep cinnamon-session | grep -v
grep)" ] ; then
<br>
/bin/su rjonasz -c "DISPLAY=:0
cinnamon-screensaver-command -l"
<br>
elif [ ! -z "$(ps aux | grep startkde | grep -v grep)" ]
; then
<br>
/usr/bin/sudo -u rjonasz -H -i
/usr/local/bin/lockkde.sh
<br>
else
<br>
/bin/su rjonasz -c "DISPLAY=:0
xscreensaver-command --lock"
<br>
fi
<br>
fi<br>
<br>
</span></div>
<br>
lockkde.sh<br>
<br>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Konsole output</title>
<div>
<span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">#! /bin/sh
</span><br>
<br>
kde_pid=`pidof kdeinit5`
<br>
export `cat /proc/$kde_pid/environ|grep -ao
'DBUS_SESSION_BUS_ADDRESS=[[:graph:]]*'`
<br>
/usr/bin/qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock<br>
<br>
</span></div>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<br>
I can't seem to figure this one out.<br>
<br>
Thanks for any help!<br>
<br>
Randy<br>
<br>
<pre class="moz-signature" cols="72">--
Even philosophers will praise war as ennobling mankind, forgetting
the Greek who said: 'War is bad in that it begets more evil than
it kills.'
Immanuel Kant</pre>
</body>
</html>