support pseudocolor and greyscale displays by, using solid colors instead of gradients
[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 # 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 ob.kbind(["A-Tab"], ob.KeyContext.All, focus.focus_next_stacked)
37 ob.kbind(["A-S-Tab"], ob.KeyContext.All, focus.focus_prev_stacked)
38
39 # desktop changing bindings
40 ob.kbind(["C-1"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 0))
41 ob.kbind(["C-2"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 1))
42 ob.kbind(["C-3"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 2))
43 ob.kbind(["C-4"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 3))
44 ob.kbind(["C-A-Right"], ob.KeyContext.All,
45          lambda(d): callbacks.next_desktop(d))
46 ob.kbind(["C-A-Left"], ob.KeyContext.All,
47          lambda(d): callbacks.prev_desktop(d))
48
49 ob.kbind(["C-S-A-Right"], ob.KeyContext.All,
50          lambda(d): callbacks.send_to_next_desktop(d))
51 ob.kbind(["C-S-A-Left"], ob.KeyContext.All,
52          lambda(d): callbacks.send_to_prev_desktop(d))
53
54 # focus new windows
55 ob.ebind(ob.EventAction.NewWindow, callbacks.focus)
56
57 print "Loaded defaults.py"