diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-22 16:32:01 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-22 16:32:01 +0100 |
commit | caa1f49279f2cf1b034a592d67c46b9df5428f65 (patch) | |
tree | b6010c691df3ec93deb4f3bb1b987cb725af1d92 /pylock.py | |
parent | 58cf425fb02cd3adc5d5fa96af865e9732914e29 (diff) | |
download | pylock-caa1f49279f2cf1b034a592d67c46b9df5428f65.tar pylock-caa1f49279f2cf1b034a592d67c46b9df5428f65.zip |
Throw out DBus, add X11 based lock activation
Diffstat (limited to 'pylock.py')
-rw-r--r-- | pylock.py | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -34,9 +34,9 @@ import argparse from gi.repository import Gtk, Gdk, Gio -from DBus import DBus from Locker import Locker from LockWindow import LockWindow +import Message import pam @@ -74,8 +74,20 @@ locale.textdomain('pylock') Gtk.Settings.get_default().set_property('gtk-theme-name', theme) +if Message.getSelection() != 0: + if args.timeout == 0: + Message.sendLockMessage() + exit(0) + else: + print('There seems to be a Pylock instance already running.', file=sys.stderr) + exit(1) + + window = LockWindow() +if not Message.acquireSelection(window): + print('Unable to register for lock messages', file=sys.stderr) + def lock(timeLeft): window.updateLockMessage(args.username, timeLeft) @@ -98,8 +110,10 @@ else: locker = Locker(args.timeout, lock, window.unlock, args.logout, logout, updateTimeout) -if args.timeout != 0: - dbus = DBus(locker) +def _triggerLock(w, e): + locker.lock() + +window.connect('map-event', _triggerLock) pamAuth = pam.pam() |