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