1 import hooks, ob, keymap, buttonmap, os, sys, input, motion, historyplacement
3 from input import Pointer
5 hooks.managed.append(historyplacement.place)
8 def printshit(keydata, client):
13 def gfunc(data, client=None): pass
15 input.Keyboard.grab(gfunc)
16 input.Pointer.grab(gfunc)
18 input.Keyboard.ungrab()
19 input.Pointer.ungrab()
22 print "execing: ", prog
26 os.execl("/bin/sh", "/bin/sh", "-c", prog)
28 print str(sys.exc_info()[0]) + ": " + str(sys.exc_info()[1])
30 print "failed to execute '" + prog + "'"
32 print str(sys.exc_info()[0]) + ": " + str(sys.exc_info()[1])
36 if ob.Openbox.showingDesktop():
37 ob.Openbox.setShowingDesktop(False)
41 # if its not visible for other reasons, then don't mess with it
48 hooks.requestactivate.append(myactivate)
51 if c and c.normal(): c.focus()
53 #hooks.showwindow.append(myfocus)
54 hooks.pointerenter.append(myfocus)
56 hooks.visible.append(myfocus)
58 mykmap=((("C-a", "d"), printshit),
59 (("C-Tab",), stackedcycle.next),
60 (("C-S-Tab",), stackedcycle.previous),
61 (("C-space",), lambda k, c: myexec("xterm")))
64 def mytogglesticky(client):
65 if client.desktop() == 0xffffffff: d = ob.Openbox.desktop()
69 mybmap=(("1", "maximize", Pointer.Action_Click,
70 lambda c: c.setMaximized(not c.maximized())),
71 ("2", "maximize", Pointer.Action_Click,
72 lambda c: c.setMaximizedVert(not c.maximizedVert())),
73 ("3", "maximize", Pointer.Action_Click,
74 lambda c: c.setMaximizedHorz(not c.maximizedHorz())),
75 ("1", "alldesktops", Pointer.Action_Click, mytogglesticky),
76 ("1", "iconify", Pointer.Action_Click,
77 lambda c: c.setIconic(True)),
78 ("1", "icon", Pointer.Action_DoubleClick, ob.Client.close),
79 ("1", "close", Pointer.Action_Click, ob.Client.close),
80 ("1", "titlebar", Pointer.Action_Motion, motion.move),
81 ("1", "handle", Pointer.Action_Motion, motion.move),
82 ("Mod1-1", "frame", Pointer.Action_Click, ob.Client.raiseWindow),
83 ("Mod1-1", "frame", Pointer.Action_Motion, motion.move),
84 ("1", "titlebar", Pointer.Action_Press, ob.Client.raiseWindow),
85 ("1", "handle", Pointer.Action_Press, ob.Client.raiseWindow),
86 ("1", "client", Pointer.Action_Press, ob.Client.raiseWindow),
87 ("2", "titlebar", Pointer.Action_Press, ob.Client.lowerWindow),
88 ("2", "handle", Pointer.Action_Press, ob.Client.lowerWindow),
89 ("Mod1-3", "frame", Pointer.Action_Click, ob.Client.lowerWindow),
90 ("Mod1-3", "frame", Pointer.Action_Motion, motion.resize),
91 ("1", "blcorner", Pointer.Action_Motion, motion.resize),
92 ("1", "brcorner", Pointer.Action_Motion, motion.resize),
93 ("1", "titlebar", Pointer.Action_Press, ob.Client.focus),
94 ("1", "handle", Pointer.Action_Press, ob.Client.focus),
95 ("1", "client", Pointer.Action_Press, ob.Client.focus),
96 ("1", "titlebar", Pointer.Action_DoubleClick,
97 lambda c: c.setShaded(not c.shaded())),
98 ("4", "titlebar", Pointer.Action_Click,
99 lambda c: c.setShaded(True)),
100 ("5", "titlebar", Pointer.Action_Click,
101 lambda c: c.setShaded(False)),
102 ("4", "root", Pointer.Action_Click,
103 lambda c: ob.Openbox.setNextDesktop()),
104 ("5", "root", Pointer.Action_Click,
105 lambda c: ob.Openbox.setPreviousDesktop()),
106 ("Mod1-4", "frame", Pointer.Action_Click,
107 lambda c: ob.Openbox.setNextDesktop()),
108 ("Mod1-5", "frame", Pointer.Action_Click,
109 lambda c: ob.Openbox.setPreviousDesktop()),
110 ("Mod1-4", "root", Pointer.Action_Click,
111 lambda c: ob.Openbox.setNextDesktop()),
112 ("Mod1-5", "root", Pointer.Action_Click,
113 lambda c: ob.Openbox.setPreviousDesktop()))
114 buttonmap.set(mybmap)