new/better/cleaner scripting interface
[dana/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
7 # try focus something when nothing is focused
8 focus.fallback = 1
9
10 # set up the mouse buttons
11 focusmodel.setup_sloppy_focus()
12 behavior.setup_window_clicks()
13 behavior.setup_window_buttons()
14 behavior.setup_scroll()
15
16 # my window placement algorithm
17 ob.ebind(ob.EventAction.PlaceWindow, windowplacement.random)
18
19 # run xterm from root clicks
20 ob.mbind("Left", ob.MouseContext.Root, ob.MouseAction.Click,
21          lambda(d): ob.execute("xterm", d.screen))
22
23 ob.kbind(["A-F4"], ob.KeyContext.All, callbacks.close)
24
25 # desktop changing bindings
26 ob.kbind(["C-1"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 0))
27 ob.kbind(["C-2"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 1))
28 ob.kbind(["C-3"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 2))
29 ob.kbind(["C-4"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 3))
30 ob.kbind(["C-A-Right"], ob.KeyContext.All,
31          lambda(d): callbacks.next_desktop(d))
32 ob.kbind(["C-A-Left"], ob.KeyContext.All,
33          lambda(d): callbacks.prev_desktop(d))
34
35 ob.kbind(["C-S-A-Right"], ob.KeyContext.All,
36          lambda(d): callbacks.send_to_next_desktop(d))
37 ob.kbind(["C-S-A-Left"], ob.KeyContext.All,
38          lambda(d): callbacks.send_to_prev_desktop(d))
39
40 # focus new windows
41 ob.ebind(ob.EventAction.NewWindow, callbacks.focus)
42
43 print "Loaded defaults.py"