Skip to content

Instantly share code, notes, and snippets.

@incognitojam
Created November 5, 2019 21:41
Show Gist options
  • Save incognitojam/4c631e1869644f1bda358f072358a571 to your computer and use it in GitHub Desktop.
Save incognitojam/4c631e1869644f1bda358f072358a571 to your computer and use it in GitHub Desktop.
#!/bin/python3
import time
from subprocess import check_output
from xbrightness import animate, duration
def get_running_program():
return check_output(['xrunning']).decode('utf-8')[:-1]
brightness = {
'code': 1.0,
'java': 1.0,
'chrome': 0.3,
'hyper': 1.0,
'default': 0.5
}
if __name__ == '__main__':
while True:
program = get_running_program()
target = brightness['default' if program not in brightness else program]
animate(target)
print("animating to %f for %s" % (target, program))
time.sleep(duration)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment