]> icculus.org git repositories - mikachu/openbox.git/blob - scripts/defaults.py
use history place by default
[mikachu/openbox.git] / 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 # set up the mouse buttons
12 focusmodel.setup_click_focus() # use focusmodel.setup_sloppy_focus() instead to
13                                # make focus follow the cursor
14 behavior.setup_window_clicks()
15 behavior.setup_window_buttons()
16 behavior.setup_scroll()
17
18 # my window placement algorithm
19 #ob.ebind(ob.EventAction.PlaceWindow, windowplacement.random)
20 ob.ebind(ob.EventAction.PlaceWindow, historyplacement.place)
21 # don't place terminals by history placement (xterm,aterm,rxvt)
22 def histplace(data):
23     if data.client.appClass() == "XTerm": return 0
24     return 1
25 historyplacement.confirm_callback = histplace
26
27
28 # run xterm from root clicks
29 ob.mbind("Left", ob.MouseContext.Root, ob.MouseAction.Click,
30          lambda(d): ob.execute("xterm", d.screen))
31
32 ob.kbind(["A-F4"], ob.KeyContext.All, callbacks.close)
33
34 # focus bindings
35 ob.kbind(["A-Tab"], ob.KeyContext.All, focus.focus_next_stacked)
36 ob.kbind(["A-S-Tab"], ob.KeyContext.All, focus.focus_prev_stacked)
37
38 # desktop changing bindings
39 ob.kbind(["C-1"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 0))
40 ob.kbind(["C-2"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 1))
41 ob.kbind(["C-3"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 2))
42 ob.kbind(["C-4"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 3))
43 ob.kbind(["C-A-Right"], ob.KeyContext.All,
44          lambda(d): callbacks.next_desktop(d))
45 ob.kbind(["C-A-Left"], ob.KeyContext.All,
46          lambda(d): callbacks.prev_desktop(d))
47
48 ob.kbind(["C-S-A-Right"], ob.KeyContext.All,
49          lambda(d): callbacks.send_to_next_desktop(d))
50 ob.kbind(["C-S-A-Left"], ob.KeyContext.All,
51          lambda(d): callbacks.send_to_prev_desktop(d))
52
53 # focus new windows
54 ob.ebind(ob.EventAction.NewWindow, callbacks.focus)
55
56 print "Loaded defaults.py"