summaryrefslogtreecommitdiff
path: root/plugins/Shortcuts.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Shortcuts.py')
-rw-r--r--plugins/Shortcuts.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/plugins/Shortcuts.py b/plugins/Shortcuts.py
new file mode 100644
index 0000000..f8956f5
--- /dev/null
+++ b/plugins/Shortcuts.py
@@ -0,0 +1,48 @@
+from PyQt4 import QtGui, QtCore
+
+from Xlib.display import Display
+from Xlib import X
+from Xlib.XK import *
+from thread import start_new_thread
+
+from clPlugin import Plugin
+from clSettings import settings
+
+
+class pluginShortcuts(Plugin):
+ display=None
+ root=None
+ def __init__(self, winMain):
+ global keycodes
+ Plugin.__init__(self, winMain, 'Shortcuts')
+
+ def _load(self):
+ return
+ self.disp=Display()
+ self.root=self.disp.screen().root
+ self.root.change_attributes(event_mask=X.KeyPressMask)
+ #for keycode,name in enumerate(keycodes):
+ #print keycode
+ #self.root.grab_key(keycode, X.AnyModifier, 0, X.GrabModeAsync, X.GrabModeAsync)
+ start_new_thread(self.keyHandler, (None,))
+
+ def err(self,param=None,param2=None):
+ print param
+ print param2
+
+ def getInfo(self):
+ return "Control playing using shortcuts."
+
+ def _getSettings(self):
+ return []
+ return [
+ ['shortcuts.playpauze', 'Play/pauze', 'Key to start playing/pauze.', QtGui.QLineEdit(settings.get('shortcuts.playpauze', 'Win+Home'))],
+ ]
+ def afterSaveSettings(self):
+ pass
+
+ def keyHandler(self, emptyParam):
+ while 1:
+ event=self.root.display.next_event()
+ keycode=event.detail
+ print keycode