fenrir/src/fenrir-package/core/inputManager.py
2016-07-07 23:59:21 +02:00

25 lines
721 B
Python

#!/bin/python
import evdev
from evdev import InputDevice
from select import select
class inputManager():
def __init__(self):
self.devices = map(evdev.InputDevice, (evdev.list_devices()))
self.devices = {dev.fd: dev for dev in self.devices}
for dev in self.devices.values(): print(dev)
def getShortcutCommand(self, runtime, shortcuts):
if not shortcuts:
return ''
return ''
def getKeyPressed(self, runtime):
r, w, x = select(self.devices, [], [])
for fd in r:
for event in self.devices[fd].read():
if event.type == evdev.ecodes.EV_KEY:
print(evdev.categorize(event))
return runtime