#!/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 + '}' + '')