]> icculus.org git repositories - dana/openbox.git/blob - scripts/defaults.py
install the scripts as python, so they get compiled
[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 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, or bind things
14                                # in some way like these functions do to make
15                                # your own custom focus model.
16 # set up the mouse buttons
17 behavior.setup_window_clicks()
18 behavior.setup_window_buttons()
19 behavior.setup_scroll()
20
21 # my window placement algorithm
22 #ob.ebind(ob.EventAction.PlaceWindow, windowplacement.random)
23 ob.ebind(ob.EventAction.PlaceWindow, historyplacement.place)
24 # don't place terminals by history placement (xterm,aterm,rxvt)
25 def histplace(data):
26     if data.client.appClass() == "XTerm": return 0
27     return 1
28 historyplacement.CONFIRM_CALLBACK = histplace
29
30
31 # run xterm from root clicks
32 ob.mbind("Left", ob.MouseContext.Root, ob.MouseAction.Click,
33          lambda(d): ob.execute("xterm", d.screen))
34
35 ob.kbind(["A-F4"], ob.KeyContext.All, callbacks.close)
36
37 # focus bindings
38 import stackedcycle # functions for doing stacked 'kde-style' cycling
39 ob.kbind(["A-Tab"], ob.KeyContext.All, stackedcycle.next)
40 ob.kbind(["A-S-Tab"], ob.KeyContext.All, stackedcycle.previous)
41
42 # if you want linear cycling instead of stacked cycling, comment out the focus
43 # bindings above, and use these instead.
44 #import focuscycle # functions for doing linear cycling
45 #focuscycle.RAISE_WINDOW = 0 # don't raise windows when they're activated
46 #ob.kbind(["A-Tab"], ob.KeyContext.All, focuscycle.next)
47 #ob.kbind(["A-S-Tab"], ob.KeyContext.All, focuscycle.previous)
48
49 # desktop changing bindings
50 ob.kbind(["C-1"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 0))
51 ob.kbind(["C-2"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 1))
52 ob.kbind(["C-3"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 2))
53 ob.kbind(["C-4"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 3))
54 ob.kbind(["C-A-Right"], ob.KeyContext.All,
55          lambda(d): callbacks.next_desktop(d))
56 ob.kbind(["C-A-Left"], ob.KeyContext.All,
57          lambda(d): callbacks.prev_desktop(d))
58
59 ob.kbind(["C-S-A-Right"], ob.KeyContext.All,
60          lambda(d): callbacks.send_to_next_desktop(d))
61 ob.kbind(["C-S-A-Left"], ob.KeyContext.All,
62          lambda(d): callbacks.send_to_prev_desktop(d))
63
64 # focus new windows
65 ob.ebind(ob.EventAction.NewWindow, callbacks.focus)
66
67 print "Loaded defaults.py"