]> icculus.org git repositories - mikachu/openbox.git/blob - scripts/defaults.py
make the icons program a C app.
[mikachu/openbox.git] / scripts / defaults.py
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
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, 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()
21
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)
26 def histplace(data):
27     if data.client.appClass() == "XTerm": return 0
28     return 1
29 historyplacement.CONFIRM_CALLBACK = histplace
30
31
32 # run xterm from root clicks
33 ob.mbind("Left", ob.MouseContext.Root, ob.MouseAction.Click,
34          lambda(d): ob.execute("xterm", d.screen))
35
36 ob.kbind(["A-F4"], ob.KeyContext.All, callbacks.close)
37
38 ob.kbind(["W-d"], ob.KeyContext.All, callbacks.toggle_show_desktop)
39
40 # focus bindings
41 import stackedcycle # functions for doing stacked 'kde-style' cycling
42 ob.kbind(["A-Tab"], ob.KeyContext.All, stackedcycle.next)
43 ob.kbind(["A-S-Tab"], ob.KeyContext.All, stackedcycle.previous)
44
45 # if you want linear cycling instead of stacked cycling, comment out the focus
46 # bindings above, and use these instead.
47 #import focuscycle # functions for doing linear cycling
48 #focuscycle.RAISE_WINDOW = 0 # don't raise windows when they're activated
49 #ob.kbind(["A-Tab"], ob.KeyContext.All, focuscycle.next)
50 #ob.kbind(["A-S-Tab"], ob.KeyContext.All, focuscycle.previous)
51
52 # desktop changing bindings
53 ob.kbind(["C-1"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 0))
54 ob.kbind(["C-2"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 1))
55 ob.kbind(["C-3"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 2))
56 ob.kbind(["C-4"], ob.KeyContext.All, lambda(d): callbacks.change_desktop(d, 3))
57 ob.kbind(["C-A-Right"], ob.KeyContext.All,
58          lambda(d): callbacks.right_desktop(d))
59 ob.kbind(["C-A-Left"], ob.KeyContext.All,
60          lambda(d): callbacks.left_desktop(d))
61 ob.kbind(["C-A-Up"], ob.KeyContext.All,
62          lambda(d): callbacks.up_desktop(d))
63 ob.kbind(["C-A-Down"], ob.KeyContext.All,
64          lambda(d): callbacks.down_desktop(d))
65
66 ob.kbind(["C-S-A-Right"], ob.KeyContext.All,
67          lambda(d): callbacks.send_to_next_desktop(d))
68 ob.kbind(["C-S-A-Left"], ob.KeyContext.All,
69          lambda(d): callbacks.send_to_prev_desktop(d))
70
71 # focus new windows
72 ob.ebind(ob.EventAction.NewWindow, callbacks.focus)
73
74 print "Loaded defaults.py"