dotfiles/dot_config/polybar/scripts/executable_caffeine-toggle.py

12 lines
242 B
Python
Raw Normal View History

#!/usr/bin/python
import os
import subprocess
res = subprocess.check_output('xset -q', shell=True).decode('UTF-8')
caffeined = "DPMS is Disabled" in res
if caffeined:
os.system('xset dpms 600 600 600')
else:
os.system('xset -dpms')