1 import ob # base module
2 import focus # add some default focus handling and cycling functions
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
9 # try focus something when nothing is focused
12 # choose a default focus model
13 focusmodel.setup_click_focus() # use focusmodel.setup_sloppy_focus() instead to
14 # make focus follow the cursor, or bind things
15 # in some way like these functions do to make
16 # your own custom focus model.
17 # set up the mouse buttons
18 behavior.setup_window_clicks()
19 behavior.setup_window_buttons()
20 behavior.setup_scroll()
22 # my window placement algorithm
23 #ob.ebind(ob.EventAction.PlaceWindow, windowplacement.random)
24 ob.ebind(ob.EventAction.PlaceWindow, historyplacement.place)
25 # don't place terminals by history placement (xterm,aterm,rxvt)
27 if data.client.appClass() == "XTerm": return 0
29 historyplacement.CONFIRM_CALLBACK = histplace
32 # run xterm from root clicks
33 ob.mbind("Left", ob.MouseContext.Root, ob.MouseAction.Click,
34 lambda(d): ob.execute("xterm", d.screen))
36 ob.kbind(["A-F4"], ob.KeyContext.All, callbacks.close)
38 ob.kbind(["W-d"], ob.KeyContext.All, callbacks.toggle_show_desktop)
42 from cycle import CycleWindows
43 ob.kbind(["A-Tab"], ob.KeyContext.All, CycleWindows.next)
44 ob.kbind(["A-S-Tab"], ob.KeyContext.All, CycleWindows.previous)
46 # if you want linear cycling instead of stacked cycling, comment out the two
47 # bindings above, and use these instead.
48 #from cycle import CycleWindowsLinear
49 #ob.kbind(["A-Tab"], ob.KeyContext.All, CycleWindows.next)
50 #ob.kbind(["A-S-Tab"], ob.KeyContext.All, CycleWindows.previous)
52 from cycle import CycleDesktops
53 ob.kbind(["C-Tab"], ob.KeyContext.All, CycleDesktops.next)
54 ob.kbind(["C-S-Tab"], ob.KeyContext.All, CycleDesktops.previous)
56 # desktop changing bindings
57 ob.kbind(["C-1"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 0))
58 ob.kbind(["C-2"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 1))
59 ob.kbind(["C-3"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 2))
60 ob.kbind(["C-4"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 3))
61 ob.kbind(["C-A-Right"], ob.KeyContext.All,
62 lambda(d): callbacks.right_desktop(d))
63 ob.kbind(["C-A-Left"], ob.KeyContext.All,
64 lambda(d): callbacks.left_desktop(d))
65 ob.kbind(["C-A-Up"], ob.KeyContext.All,
66 lambda(d): callbacks.up_desktop(d))
67 ob.kbind(["C-A-Down"], ob.KeyContext.All,
68 lambda(d): callbacks.down_desktop(d))
70 ob.kbind(["C-S-A-Right"], ob.KeyContext.All,
71 lambda(d): callbacks.send_to_next_desktop(d))
72 ob.kbind(["C-S-A-Left"], ob.KeyContext.All,
73 lambda(d): callbacks.send_to_prev_desktop(d))
76 ob.ebind(ob.EventAction.NewWindow, callbacks.focus)
78 print "Loaded defaults.py"