Add sample config file.
diff --git a/qwerty.conf b/qwerty.conf
new file mode 100644
index 0000000..b231b91
--- /dev/null
+++ b/qwerty.conf
@@ -0,0 +1,94 @@
+Section: Graphics
+Icon: krita.png
+
+Key: G
+Title: Gimp
+Icon: gimp.svg
+Class: gimp
+Command: gimp
+
+Key: F
+Title: F-Spot
+Icon: f-spot.svg
+Class: f-spot
+Command: f-spot
+
+Key: I
+Title: Inkscape
+Icon: inkscape.png
+Class: inkscape
+Command: inkscape
+
+Key: V
+Title: Geeqie
+Icon: geeqie.png
+Class: geeqie
+Command: geeqie
+
+Key: Q
+Title: QtPFSgui
+Icon: qtpfsgui.png
+Class: qtpfsgui
+Command: qtpfsgui
+
+Key: H
+Title: Hugin
+Icon: hugin.png
+Class: hugin
+Command: hugin
+
+Section: Internet
+Icon: applications-internet.png
+
+Key: E
+Title: Epiphany
+Icon: gnome-web-browser.svg
+Class: epiphany-browser
+Command: epiphany
+
+Key: I
+Title: Iceweasel
+Icon: iceweasel.png
+Class: Iceweasel-bin
+Command: iceweasel
+
+Key: M
+Title: Claws-mail
+Icon: claws-mail.png
+Class: claws-mail
+Command: claws-mail
+
+Key: L
+Title: Liferea
+Icon: liferea.png
+Class: liferea
+Command: liferea
+
+Key: P
+Title: Pidgin
+Icon: pidgin.png
+Class: pidgin
+Command: pidgin
+
+Section: Office
+Icon: abiword.png
+
+Key: W
+Title: Writer
+Icon: ooo-writer.png
+Command: oowriter
+
+Key: C
+Title: Calc
+Icon: ooo-calc.png
+Command: oocalc
+
+Key: G
+Title: Gnucash
+Icon: gnucash-icon.png
+Command: gnucash
+
+Key: E
+Title: Gedit
+Icon: abiword.png
+Command: gedit
diff --git a/qwerty.py b/qwerty.py
index 775ba59..231bca8 100755
--- a/qwerty.py
+++ b/qwerty.py
@@ -5,6 +5,7 @@ import os
import re
from Xlib import X,display
+import Xlib.protocol.event
import gtk
ICON_PATHS = ["/usr/share/pixmaps", "/usr/share/icons/hicolor/48x48/apps", "/usr/share/icons/hicolor/scalable/apps"]
@@ -197,7 +198,7 @@ class GUI(object):
self.window.connect('key-release-event', self.on_key)
self.window.fullscreen()
-# self.window.resize(1024,768)
+# self.window.resize(800,600)
self.collect_windows()
@@ -206,6 +207,8 @@ class GUI(object):
self.root = self.display.screen().root
self.clients_list = self.root.query_tree()._data['children']
+ self.NET_ACTIVE_WINDOW = self.display.intern_atom('_NET_ACTIVE_WINDOW')
+
for w in self.clients_list:
clss = w.get_wm_class()
if isinstance(clss,tuple):
@@ -237,22 +240,27 @@ class GUI(object):
def do_button(self,key):
self.on_button(self.buttons[key])
- def activate_window(self,cls):
- wnd = self.by_class[cls]
- wnd = self.display.create_resource_object('window',wnd.id)
- wnd.change_attributes(event_mask=(X.PropertyChangeMask|X.FocusChangeMask|X.StructureNotifyMask))
+ def send_event(self,win,ctype,data):
+ data = (data+[0]*(5-len(data)))[:5]
+ ev = Xlib.protocol.event.ClientMessage(window=win, client_type=ctype, data=(32,(data)))
+ mask = (X.SubstructureRedirectMask|X.SubstructureNotifyMask)
+ self.root.send_event(ev, event_mask=mask)
- wnd.configure(stack_mode=X.Above)
- wnd.set_input_focus(X.RevertToNone, X.CurrentTime)
- wnd.map()
- self.display.flush()
+ def activate_window(self,cls):
+ self.display.flush()
+ wnd = self.by_class[cls]
+ wnd.configure(stack_mode=X.Above)
+ wnd.set_input_focus(X.RevertToNone, X.CurrentTime)
+# self.send_event(wnd, self.NET_ACTIVE_WINDOW, [X.CurrentTime])
+# wnd.map()
def on_button(self,widget):
if widget.running:
print "Activating", widget.label.get_text()
+ self.activate_window(widget.cls)
else:
self.key_exec(widget.key)
- self.exit()
+# self.exit()
def on_section(self,widget):
self.show_section(widget.key)