dotfiles/dot_config/polybar/scripts/executable_caffeine-check-status.py

12 lines
323 B
Python

#!/usr/bin/python
import subprocess
# res = subprocess.check_output('xset -q', shell=True).decode('UTF-8')
res = subprocess.check_output(
'cat /tmp/caffeine_status', shell=True).decode('UTF-8')
caffeined = "xidlehook is KILLED" in res
color = '#ffffff' if caffeined else '#777777'
print('%{F' + color + '}' + '')