]>
Dogcows Code - chaz/openbox/blob - python/rc.py
1 import hooks
, ob
, keymap
, buttonmap
, os
, sys
, input, motion
, historyplacement
3 from input import Pointer
5 hooks
.managed
.append(historyplacement
.place
)
6 #import windowplacement
7 #hooks.managed.append(windowplacement.random)
10 def printshit(keydata
, client
):
15 def gfunc(data
, client
=None): pass
17 input.Keyboard
.grab(gfunc
)
18 input.Pointer
.grab(gfunc
)
20 input.Keyboard
.ungrab()
21 input.Pointer
.ungrab()
24 print "execing: ", prog
28 os
.execl("/bin/sh", "/bin/sh", "-c", prog
)
30 print str(sys
.exc_info()[0]) + ": " + str(sys
.exc_info()[1])
32 print "failed to execute '" + prog
+ "'"
34 print str(sys
.exc_info()[0]) + ": " + str(sys
.exc_info()[1])
38 if ob
.Openbox
.showingDesktop():
39 ob
.Openbox
.setShowingDesktop(False)
43 # if its not visible for other reasons, then don't mess with it
50 hooks
.requestactivate
.append(myactivate
)
53 if c
and c
.normal(): c
.focus()
55 #hooks.showwindow.append(myfocus)
56 hooks
.pointerenter
.append(myfocus
)
58 hooks
.visible
.append(myfocus
)
60 mykmap
=((("C-a", "d"), printshit
),
61 (("C-Tab",), stackedcycle
.next
),
62 (("C-S-Tab",), stackedcycle
.previous
),
63 (("Mod1-1",), lambda k
,c
: ob
.Openbox
.setDesktop(1)),
64 (("Mod1-2",), lambda k
,c
: ob
.Openbox
.setDesktop(2)),
65 (("Mod1-3",), lambda k
,c
: ob
.Openbox
.setDesktop(3)),
66 (("Mod1-4",), lambda k
,c
: ob
.Openbox
.setDesktop(4)),
67 (("Mod1-C-Left",), lambda k
,c
: ob
.Openbox
.setPreviousDesktop() or c
.setDesktop(ob
.Openbox
.desktop())),
68 (("Mod1-C-Right",), lambda k
,c
: ob
.Openbox
.setNextDesktop() or c
.setDesktop(ob
.Openbox
.desktop())),
69 (("Mod1-Left",), lambda k
,c
: ob
.Openbox
.setPreviousDesktop()),
70 (("Mod1-Right",), lambda k
,c
: ob
.Openbox
.setNextDesktop()),
71 (("C-space",), lambda k
,c
: myexec("xterm")))
74 def mytogglesticky(client
):
75 if client
.desktop() == 0xffffffff: d
= ob
.Openbox
.desktop()
79 mybmap
=(("1", "maximize", Pointer
.Action_Click
,
80 lambda c
: c
.setMaximized(not c
.maximized())),
81 ("2", "maximize", Pointer
.Action_Click
,
82 lambda c
: c
.setMaximizedVert(not c
.maximizedVert())),
83 ("3", "maximize", Pointer
.Action_Click
,
84 lambda c
: c
.setMaximizedHorz(not c
.maximizedHorz())),
85 ("1", "alldesktops", Pointer
.Action_Click
, mytogglesticky
),
86 ("1", "iconify", Pointer
.Action_Click
,
87 lambda c
: c
.setIconic(True)),
88 ("1", "icon", Pointer
.Action_DoubleClick
, ob
.Client
.close
),
89 ("1", "close", Pointer
.Action_Click
, ob
.Client
.close
),
90 ("1", "titlebar", Pointer
.Action_Motion
, motion
.move
),
91 ("1", "handle", Pointer
.Action_Motion
, motion
.move
),
92 ("Mod1-1", "frame", Pointer
.Action_Click
, ob
.Client
.raiseWindow
),
93 ("Mod1-1", "frame", Pointer
.Action_Motion
, motion
.move
),
94 ("1", "titlebar", Pointer
.Action_Press
, ob
.Client
.raiseWindow
),
95 ("1", "handle", Pointer
.Action_Press
, ob
.Client
.raiseWindow
),
96 ("1", "client", Pointer
.Action_Press
, ob
.Client
.raiseWindow
),
97 ("2", "titlebar", Pointer
.Action_Press
, ob
.Client
.lowerWindow
),
98 ("2", "handle", Pointer
.Action_Press
, ob
.Client
.lowerWindow
),
99 ("Mod1-3", "frame", Pointer
.Action_Click
, ob
.Client
.lowerWindow
),
100 ("Mod1-3", "frame", Pointer
.Action_Motion
, motion
.resize
),
101 ("1", "blcorner", Pointer
.Action_Motion
, motion
.resize
),
102 ("1", "brcorner", Pointer
.Action_Motion
, motion
.resize
),
103 ("1", "titlebar", Pointer
.Action_Press
, ob
.Client
.focus
),
104 ("1", "handle", Pointer
.Action_Press
, ob
.Client
.focus
),
105 ("1", "client", Pointer
.Action_Press
, ob
.Client
.focus
),
106 ("1", "titlebar", Pointer
.Action_DoubleClick
,
107 lambda c
: c
.setShaded(not c
.shaded())),
108 ("4", "titlebar", Pointer
.Action_Click
,
109 lambda c
: c
.setShaded(True)),
110 ("5", "titlebar", Pointer
.Action_Click
,
111 lambda c
: c
.setShaded(False)),
112 ("4", "root", Pointer
.Action_Click
,
113 lambda c
: ob
.Openbox
.setNextDesktop()),
114 ("5", "root", Pointer
.Action_Click
,
115 lambda c
: ob
.Openbox
.setPreviousDesktop()),
116 ("Mod1-4", "frame", Pointer
.Action_Click
,
117 lambda c
: ob
.Openbox
.setNextDesktop()),
118 ("Mod1-5", "frame", Pointer
.Action_Click
,
119 lambda c
: ob
.Openbox
.setPreviousDesktop()),
120 ("Mod1-4", "root", Pointer
.Action_Click
,
121 lambda c
: ob
.Openbox
.setNextDesktop()),
122 ("Mod1-5", "root", Pointer
.Action_Click
,
123 lambda c
: ob
.Openbox
.setPreviousDesktop()))
124 buttonmap
.set(mybmap
)
This page took 0.039543 seconds and 4 git commands to generate.