]>
Dogcows Code - chaz/openbox/blob - scripts/focusmodel.py
1 ###############################################################################
2 ### Functions for setting up some default focus models. ###
3 ###############################################################################
8 def setup_click_focus(click_raise
= 1):
9 """Sets up for focusing windows by clicking on or in the window.
10 Optionally, clicking on or in a window can raise the window to the
11 front of its stacking layer."""
12 ob
.mbind("Left", ob
.MouseContext
.Titlebar
,
13 ob
.MouseAction
.Press
, callbacks
.focus
)
14 ob
.mbind("Left", ob
.MouseContext
.Handle
,
15 ob
.MouseAction
.Press
, callbacks
.focus
)
16 ob
.mbind("Left", ob
.MouseContext
.Grip
,
17 ob
.MouseAction
.Press
, callbacks
.focus
)
18 ob
.mbind("Left", ob
.MouseContext
.Window
,
19 ob
.MouseAction
.Press
, callbacks
.focus
)
20 ob
.mbind("Middle", ob
.MouseContext
.Window
,
21 ob
.MouseAction
.Press
, callbacks
.focus
)
22 ob
.mbind("A-Left", ob
.MouseContext
.Frame
,
23 ob
.MouseAction
.Press
, callbacks
.focus
)
25 ob
.mbind("Left", ob
.MouseContext
.Titlebar
,
26 ob
.MouseAction
.Press
, callbacks
.raise_win
)
27 ob
.mbind("Left", ob
.MouseContext
.Handle
,
28 ob
.MouseAction
.Press
, callbacks
.raise_win
)
29 ob
.mbind("Left", ob
.MouseContext
.Grip
,
30 ob
.MouseAction
.Press
, callbacks
.raise_win
)
31 ob
.mbind("Left", ob
.MouseContext
.Window
,
32 ob
.MouseAction
.Press
, callbacks
.raise_win
)
34 def setup_sloppy_focus(click_focus
= 1, click_raise
= 0):
35 """Sets up for focusing windows when the mouse pointer enters them.
36 Optionally, clicking on or in a window can focus it if your pointer
37 ends up inside a window without focus. Also, optionally, clicking on or
38 in a window can raise the window to the front of its stacking layer."""
39 ob
.ebind(ob
.EventAction
.EnterWindow
, callbacks
.focus
)
41 ob
.mbind("Left", ob
.MouseContext
.Titlebar
,
42 ob
.MouseAction
.Press
, callbacks
.focus
)
43 ob
.mbind("Left", ob
.MouseContext
.Handle
,
44 ob
.MouseAction
.Press
, callbacks
.focus
)
45 ob
.mbind("Left", ob
.MouseContext
.Grip
,
46 ob
.MouseAction
.Press
, callbacks
.focus
)
47 ob
.mbind("Left", ob
.MouseContext
.Window
,
48 ob
.MouseAction
.Press
, callbacks
.focus
)
50 ob
.mbind("Left", ob
.MouseContext
.Titlebar
,
51 ob
.MouseAction
.Press
, callbacks
.raise_win
)
52 ob
.mbind("Left", ob
.MouseContext
.Handle
,
53 ob
.MouseAction
.Press
, callbacks
.raise_win
)
54 ob
.mbind("Left", ob
.MouseContext
.Grip
,
55 ob
.MouseAction
.Press
, callbacks
.raise_win
)
56 ob
.mbind("Left", ob
.MouseContext
.Window
,
57 ob
.MouseAction
.Press
, callbacks
.raise_win
)
59 print "Loaded focusmodel.py"
This page took 0.036464 seconds and 4 git commands to generate.