]> Dogcows Code - chaz/openbox/blob - scripts/defaults.py
6467cf8ea0a0a3303572e3d644b59c8ea630ea75
[chaz/openbox] / scripts / defaults.py
1 import focus # add some default focus handling and cycling functions
2 import focusmodel # default focus models
3 import behavior # defines default behaviors for interaction with windows
4 import callbacks # a lib of functions that can be used as binding callbacks
5 import windowplacement # use a routine in here to place windows
6 import historyplacement # history window placement
7
8 # try focus something when nothing is focused
9 focus.FALLBACK = 1
10
11 # choose a default focus model
12 focusmodel.setup_click_focus() # use focusmodel.setup_sloppy_focus() instead to
13 # make focus follow the cursor
14 # set up the mouse buttons
15 behavior.setup_window_clicks()
16 behavior.setup_window_buttons()
17 behavior.setup_scroll()
18
19 # my window placement algorithm
20 #ob.ebind(ob.EventAction.PlaceWindow, windowplacement.random)
21 ob.ebind(ob.EventAction.PlaceWindow, historyplacement.place)
22 # don't place terminals by history placement (xterm,aterm,rxvt)
23 def histplace(data):
24 if data.client.appClass() == "XTerm": return 0
25 return 1
26 historyplacement.CONFIRM_CALLBACK = histplace
27
28
29 # run xterm from root clicks
30 ob.mbind("Left", ob.MouseContext.Root, ob.MouseAction.Click,
31 lambda(d): ob.execute("xterm", d.screen))
32
33 ob.kbind(["A-F4"], ob.KeyContext.All, callbacks.close)
34
35 # focus bindings
36 import stackedcycle # functions for doing stacked 'kde-style' cycling
37 ob.kbind(["A-Tab"], ob.KeyContext.All, stackedcycle.next)
38 ob.kbind(["A-S-Tab"], ob.KeyContext.All, stackedcycle.previous
39
40 # if you want linear cycling instead of stacked cycling, comment out the focus
41 # bindings above, and use these instead.
42 #import focuscycle
43 #focuscycle.RAISE_WINDOW = 0 # don't raise windows when they're activated
44 #ob.kbind(["A-Tab"], ob.KeyContext.All, focuscycle.next)
45 #ob.kbind(["A-S-Tab"], ob.KeyContext.All, focuscycle.previous)
46
47 # desktop changing bindings
48 ob.kbind(["C-1"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 0))
49 ob.kbind(["C-2"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 1))
50 ob.kbind(["C-3"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 2))
51 ob.kbind(["C-4"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 3))
52 ob.kbind(["C-A-Right"], ob.KeyContext.All,
53 lambda(d): callbacks.next_desktop(d))
54 ob.kbind(["C-A-Left"], ob.KeyContext.All,
55 lambda(d): callbacks.prev_desktop(d))
56
57 ob.kbind(["C-S-A-Right"], ob.KeyContext.All,
58 lambda(d): callbacks.send_to_next_desktop(d))
59 ob.kbind(["C-S-A-Left"], ob.KeyContext.All,
60 lambda(d): callbacks.send_to_prev_desktop(d))
61
62 # focus new windows
63 ob.ebind(ob.EventAction.NewWindow, callbacks.focus)
64
65 print "Loaded defaults.py"
This page took 0.038826 seconds and 4 git commands to generate.