Created
September 13, 2020 09:55
-
-
Save lesp/0552bd6e6e5c86e4e6d5bd8eecf679de to your computer and use it in GitHub Desktop.
When your battery level gets to a set point, press a key to trigger Terence's RGB keyboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
from pynput.keyboard import Key, Controller | |
from time import sleep | |
keyboard = Controller() | |
while True: | |
charge_state = int(open("/sys/class/power_supply/BAT0/capacity","r").readline().strip()) | |
if charge_state < 80: | |
keyboard.press("@") | |
keyboard.release("@") | |
sleep(5) | |
else: | |
pass | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment