Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- from datetime import datetime
- import os
- import pwd
- import subprocess
- import time
- LOG_FILE = os.path.expanduser('~/hours_log.csv')
- cmd = subprocess.Popen(["dbus-monitor \"type='signal',interface="
- "'org.freedesktop.ScreenSaver'\""], shell=True,
- stdout=subprocess.PIPE)
- running = 0
- while 1:
- time.sleep(0.1)
- if running:
- output = cmd.stdout.readline()
- status = 'unlocked' if 'true' in output else 'locked'
- if status == 'unlocked'
- Os.system("./LCDsaver.sh 1")
- else
- Os.system("./LCDsaver.sh 0")
- running = 0
- line = cmd.stdout.readline()
- if "ActiveChange" in line and 'org.freedesktop.ScreenSaver' in line:
- running = 1
- ~
- ~
- ~
- ~
- ~
- ~
- ~
- 30,25 Wszystko
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement