fenrir/src/fenrir-package/core/inputManager.py

25 lines
721 B
Python
Raw Normal View History

#!/bin/python
2016-07-07 15:40:10 -04:00
import evdev
from evdev import InputDevice
from select import select
class inputManager():
def __init__(self):
2016-07-07 15:40:10 -04:00
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 ''
2016-07-07 15:40:10 -04:00
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))
2016-07-07 17:59:21 -04:00
return runtime