]>
Dogcows Code - chaz/openbox/blob - python/rc.py
8ddfa4614692dc4ed5ea99f08759bf682a033cb0
1 import hooks
, ob
, keymap
, buttonmap
, os
, sys
, input, motion
, historyplacement
3 from input import Pointer
8 hooks
.managed
.append(historyplacement
.place
)
11 def printshit(keydata
, client
):
16 def gfunc(data
, client
=None): pass
18 input.Keyboard
.grab(gfunc
)
19 input.Pointer
.grab(gfunc
)
21 input.Keyboard
.ungrab()
22 input.Pointer
.ungrab()
25 print "execing: ", prog
29 os
.execl("/bin/sh", "/bin/sh", "-c", prog
)
31 print str(sys
.exc_info()[0]) + ": " + str(sys
.exc_info()[1])
33 print "failed to execute '" + prog
+ "'"
35 print str(sys
.exc_info()[0]) + ": " + str(sys
.exc_info()[1])
39 if ob
.Openbox
.showingDesktop():
40 ob
.Openbox
.setShowingDesktop(False)
44 # if its not visible for other reasons, then don't mess with it
51 hooks
.requestactivate
.append(myactivate
)
54 if c
and c
.normal(): c
.focus()
56 #hooks.showwindow.append(myfocus)
57 hooks
.pointerenter
.append(myfocus
)
59 hooks
.visible
.append(myfocus
)
61 mykmap
=((("C-a", "d"), printshit
),
62 (("C-Tab",), stackedcycle
.next
),
63 (("C-S-Tab",), stackedcycle
.previous
),
64 (("C-space",), lambda k
, c
: myexec("xterm")))
67 def mytogglesticky(client
):
68 if client
.desktop() == 0xffffffff: d
= ob
.Openbox
.desktop()
72 mybmap
=(("1", "maximize", Pointer
.Action_Click
,
73 lambda c
: c
.setMaximized(not c
.maximized())),
74 ("2", "maximize", Pointer
.Action_Click
,
75 lambda c
: c
.setMaximizedVert(not c
.maximizedVert())),
76 ("3", "maximize", Pointer
.Action_Click
,
77 lambda c
: c
.setMaximizedHorz(not c
.maximizedHorz())),
78 ("1", "alldesktops", Pointer
.Action_Click
, mytogglesticky
),
79 ("1", "iconify", Pointer
.Action_Click
,
80 lambda c
: c
.setIconic(True)),
81 ("1", "icon", Pointer
.Action_DoubleClick
, ob
.Client
.close
),
82 ("1", "close", Pointer
.Action_Click
, ob
.Client
.close
),
83 ("1", "titlebar", Pointer
.Action_Motion
, motion
.move
),
84 ("1", "handle", Pointer
.Action_Motion
, motion
.move
),
85 ("Mod1-1", "frame", Pointer
.Action_Click
, ob
.Client
.raiseWindow
),
86 ("Mod1-1", "frame", Pointer
.Action_Motion
, motion
.move
),
87 ("1", "titlebar", Pointer
.Action_Press
, ob
.Client
.raiseWindow
),
88 ("1", "handle", Pointer
.Action_Press
, ob
.Client
.raiseWindow
),
89 ("1", "client", Pointer
.Action_Press
, ob
.Client
.raiseWindow
),
90 ("2", "titlebar", Pointer
.Action_Press
, ob
.Client
.lowerWindow
),
91 ("2", "handle", Pointer
.Action_Press
, ob
.Client
.lowerWindow
),
92 ("Mod1-3", "frame", Pointer
.Action_Click
, ob
.Client
.lowerWindow
),
93 ("Mod1-3", "frame", Pointer
.Action_Motion
, motion
.resize
),
94 ("1", "blcorner", Pointer
.Action_Motion
, motion
.resize
),
95 ("1", "brcorner", Pointer
.Action_Motion
, motion
.resize
),
96 ("1", "titlebar", Pointer
.Action_Press
, ob
.Client
.focus
),
97 ("1", "handle", Pointer
.Action_Press
, ob
.Client
.focus
),
98 ("1", "client", Pointer
.Action_Press
, ob
.Client
.focus
),
99 ("1", "titlebar", Pointer
.Action_DoubleClick
,
100 lambda c
: c
.setShaded(not c
.shaded())),
101 ("4", "titlebar", Pointer
.Action_Click
,
102 lambda c
: c
.setShaded(True)),
103 ("5", "titlebar", Pointer
.Action_Click
,
104 lambda c
: c
.setShaded(False)),
105 ("4", "root", Pointer
.Action_Click
,
106 lambda c
: ob
.Openbox
.setNextDesktop()),
107 ("5", "root", Pointer
.Action_Click
,
108 lambda c
: ob
.Openbox
.setPreviousDesktop()),
109 ("Mod1-4", "frame", Pointer
.Action_Click
,
110 lambda c
: ob
.Openbox
.setNextDesktop()),
111 ("Mod1-5", "frame", Pointer
.Action_Click
,
112 lambda c
: ob
.Openbox
.setPreviousDesktop()),
113 ("Mod1-4", "root", Pointer
.Action_Click
,
114 lambda c
: ob
.Openbox
.setNextDesktop()),
115 ("Mod1-5", "root", Pointer
.Action_Click
,
116 lambda c
: ob
.Openbox
.setPreviousDesktop()))
117 buttonmap
.set(mybmap
)
This page took 0.039474 seconds and 4 git commands to generate.