from GizmoDaemon import * from GizmoScriptDefault import * import os import ReadSymLink ENABLED = True VERSION_NEEDED = 3.2 INTERESTED_CLASSES = [GizmoEventClass.Standard] MP_CONTROL_FILE = "/dev/shm/mpvfifo" REMOTE_DEVICE = ReadSymLink.readlinkabs("/dev/input/remote") class USBRemoteMP(GizmoScriptDefault): """ USB Remote control """ def onEvent(self, Event, Gizmo=None): """ Called from Base Class' onEvent method. See GizmodDispatcher.onEvent documention for an explanation of this function """ self.returnvalue = False if Event.Class == GizmoEventClass.Standard and Event.Type == GizmoEventType.EV_KEY and Gizmo.FileName == REMOTE_DEVICE and os.popen( "ps -e | grep mpv | head -n 1").read(): controlfile = open(MP_CONTROL_FILE, 'w') if str(Event.Code) == "KEY_PLAYPAUSE" and Event.Value == 1: controlfile.write("pause\n") self.returnvalue = True elif str(Event.Code) == "KEY_STOPCD" and Event.Value == 1: controlfile.write("frame_step\n") self.returnvalue = True
from GizmoDaemon import * from GizmoScriptDefault import * import os import ReadSymLink ENABLED = True VERSION_NEEDED = 3.2 INTERESTED_CLASSES = [GizmoEventClass.Standard] MP_CONTROL_FILE = os.path.expanduser("~") + "/ramdisk/mpvfifo" REMOTE_DEVICE = ReadSymLink.readlinkabs("/dev/input/remote") class USBRemoteMP(GizmoScriptDefault): """ USB Remote control """ def onEvent(self, Event, Gizmo = None): """ Called from Base Class' onEvent method. See GizmodDispatcher.onEvent documention for an explanation of this function """ self.returnvalue = False if Event.Class == GizmoEventClass.Standard and Event.Type == GizmoEventType.EV_KEY and Gizmo.FileName == REMOTE_DEVICE and os.popen("ps -e | grep mpv | head -n 1").read(): controlfile = open(MP_CONTROL_FILE, 'w') if str(Event.Code) == "KEY_PLAYPAUSE" and Event.Value == 1: controlfile.write("pause\n") self.returnvalue = True elif str(Event.Code) == "KEY_STOPCD" and Event.Value == 1: controlfile.write("frame_step\n") self.returnvalue = True
from GizmoDaemon import * from GizmoScriptDefault import * import subprocess import ReadSymLink ENABLED = True VERSION_NEEDED = 3.2 INTERESTED_CLASSES = [GizmoEventClass.Standard] RAPOO_DEVICE = ReadSymLink.readlinkabs("/dev/input/evdev-rapoo-keyboard") class RAPOOScrolling(GizmoScriptDefault): """ Disable RAPOO P7800 zoom and scroll instead """ def onEvent(self, Event, Gizmo=None): """ Called from Base Class' onEvent method. See GizmodDispatcher.onEvent documention for an explanation of this function """ if len(Gizmod.Mice) == 0: return False if Event.Class == GizmoEventClass.Standard and Event.Type == GizmoEventType.EV_KEY and Gizmo.FileName == RAPOO_DEVICE: if str(Event.Code) == "KEY_KPPLUS" and Event.Value > 0: Gizmod.Mice[0].createEventRaw(GizmoEventType.EV_REL, GizmoMouseAxis.WHEEL, pow(Event.Value, 4)) # power to scroll faster return True elif str(Event.Code) == "KEY_KPMINUS" and Event.Value > 0: Gizmod.Mice[0].createEventRaw(GizmoEventType.EV_REL, GizmoMouseAxis.WHEEL,
from GizmoDaemon import * from GizmoScriptDefault import * import subprocess import ReadSymLink ENABLED = True VERSION_NEEDED = 3.2 INTERESTED_CLASSES = [GizmoEventClass.Standard] RAPOO_DEVICE = ReadSymLink.readlinkabs("/dev/input/evdev-rapoo-keyboard") class RAPOOScrolling(GizmoScriptDefault): """ Disable RAPOO P7800 zoom and scroll instead """ def onEvent(self, Event, Gizmo = None): """ Called from Base Class' onEvent method. See GizmodDispatcher.onEvent documention for an explanation of this function """ if len(Gizmod.Mice) == 0: return False if Event.Class == GizmoEventClass.Standard and Event.Type == GizmoEventType.EV_KEY and Gizmo.FileName == RAPOO_DEVICE: if str(Event.Code) == "KEY_KPPLUS" and Event.Value > 0: Gizmod.Mice[0].createEventRaw(GizmoEventType.EV_REL, GizmoMouseAxis.WHEEL, pow(Event.Value, 4)) # power to scroll faster return True elif str(Event.Code) == "KEY_KPMINUS" and Event.Value > 0: Gizmod.Mice[0].createEventRaw(GizmoEventType.EV_REL, GizmoMouseAxis.WHEEL, -pow(Event.Value, 4)) return True else: return False
from GizmoDaemon import * from GizmoScriptDefault import * import ReadSymLink ENABLED = True VERSION_NEEDED = 3.2 INTERESTED_CLASSES = [GizmoEventClass.Standard] MOUSE_DEVICE = ReadSymLink.readlinkabs("/dev/input/evdev-mouse") class MouseMappings(GizmoScriptDefault): """ Enable keyboard mappings for mouse thumb buttons and tilt wheel """ def onEvent(self, Event, Gizmo=None): """ Called from Base Class' onEvent method. See GizmodDispatcher.onEvent documention for an explanation of this function """ if Event.Class != GizmoEventClass.Standard or Gizmo.FileName != MOUSE_DEVICE: return False if Event.Type == GizmoEventType.EV_KEY: if str(Event.Code) == "BTN_SIDE": if Event.Value == 1: Gizmod.Keyboards[0].createEventRaw(GizmoEventType.EV_KEY, GizmoKey.KEY_ENTER, 1) elif Event.Value == 0: Gizmod.Keyboards[0].createEventRaw(GizmoEventType.EV_KEY, GizmoKey.KEY_ENTER, 0) elif str(Event.Code) == "BTN_EXTRA":