New user-based concise daemon
This commit is contained in:
17
hotcutdaemon.py
Normal file
17
hotcutdaemon.py
Normal file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/python3
|
||||
from evdev import InputDevice, categorize, ecodes
|
||||
import configparser, os
|
||||
config = configparser.ConfigParser()
|
||||
config.read('config.ini')
|
||||
def sysrun(command):
|
||||
os.system(command+ " &")
|
||||
dev = InputDevice(config["DEVICE"]["path"])
|
||||
dev.grab()
|
||||
for event in dev.read_loop():
|
||||
if event.type == ecodes.EV_KEY:
|
||||
key = categorize(event)
|
||||
if key.keystate == key.key_down:
|
||||
print(key.keycode)
|
||||
if key.keycode in config["KEYS"].keys():
|
||||
print("Executing "+config["KEYS"][key.keycode])
|
||||
sysrun(config["KEYS"][key.keycode])
|
Reference in New Issue
Block a user