screen-lock


How to lock screen 30 minutes after unlock


I would like my children to only use the computer for 30 minutes, at which time I would like the screen to be locked. At that point, if I choose to unlock the screen again, I would like the screen to lock again in another 30 minutes.
How can I write a script to do this?
To lock the screen from the command line (on ubuntu), I can use the command
gnome-screensaver-command -l
but how do I activate this command 30 minutes after unlock?
Thank you for the comment, which helps. Here is the solution I came up with, in python 2.x:
import gobject, dbus, time, subprocess
from dbus.mainloop.glib import DBusGMainLoop
time.sleep(30*60)
subprocess.Popen(["gnome-screensaver-command", "-l"])
def lock_status(bus, message):
if message.get_member() != "EventEmitted":
return
args = message.get_args_list()
if args[0] == "desktop-unlock":
time.sleep(30*60)
subprocess.Popen(["gnome-screensaver-command", "-l"])
DBusGMainLoop(set_as_default=True)
bus = dbus.SessionBus()
bus.add_match_string("type='signal',interface='com.ubuntu.Upstart0_6'")
bus.add_message_filter(lock_status)
gobject.MainLoop().run()

Related Links

How to lock screen 30 minutes after unlock

Categories

HOME
reactjs
classification
marie
salesforce
pyspark
qemu
cxf
android-ndk
gap-system
squeak
opc-ua
sms
localhost
decoding
taxonomy
virtuemart
react-jsx
smali
fastboot
inline-assembly
gsuite
android-wear-2.0
datastax-enterprise
utc
federated
jbossfuse
wordpress-rest-api
jql
oracle-nosql
intersection
abide
linkurious
wicket-tester
vertical-alignment
head
taleo
xmldom
opos
e4
richtext
wicketstuff
group
stringbuilder
easy-thumbnails
turbolinks
consolidation
foreground
jigsaw
cherry-pick
hfp
mod
syncano
winforms-interop
xml-simple
transparentproxy
glog
targetprocess
stderr
mergecursor
perfect-scrollbar
random-access
parsefloat
azure-worker-roles
parallel-port
scjp
telerik-appbuilder
episerver-7
satisfiability
dayofweek
.net-reflector
mdp
autofilter
google-mirror-api
ia-32
playing-cards
qgraphicsscene
jython-2.5
qmainwindow
configurationsection
report-viewer2010
motordriver
derived-class
shapado
php-gettext
parsec
cgaffinetransform
wdm
discussion-board
gmagick
p4.net
retrospectiva
memory-consumption

Resources

Encrypt Message