]>
Dogcows Code - chaz/openbox/blob - scripts/focus.py
2fb6188af9601ceac216bdfa4ca48f29fc765adc
1 ###########################################################################
2 ### Functions for helping out with your window focus. ###
3 ###########################################################################
5 ###########################################################################
6 ### Options that affect the behavior of the focus module. ###
7 ###########################################################################
9 """Don't focus windows which have requested to not be displayed in taskbars.
10 You will still be able to focus the windows, but not through cycling, and
11 they won't be focused as a fallback if 'fallback' is enabled."""
13 """Send focus somewhere when nothing is left with the focus, if possible."""
14 ###########################################################################
16 ###########################################################################
17 ###########################################################################
19 ###########################################################################
20 ### Internal stuff, should not be accessed outside the module. ###
21 ###########################################################################
25 # maintain a list of clients, stacked in focus order
29 def _focusable(client
, desktop
):
30 if not client
.normal(): return 0
31 if not (client
.canFocus() or client
.focusNotify()): return 0
32 if client
.iconic(): return 0
33 if AVOID_SKIP_TASKBAR
and client
.skipTaskbar(): return 0
35 desk
= client
.desktop()
36 if not (desk
== 0xffffffff or desk
== desktop
): return 0
41 """This function exists because Swig pointers don't define a __eq__
42 function, so list.remove(ptr) does not work."""
44 for i
in range(len(_clients
)):
45 if _clients
[i
].window() == win
:
48 raise ValueError("_remove(x): x not in _clients list.")
59 except ValueError: pass # happens if _focused comes before _newwindow
60 _clients
.insert(0, data
.client
)
63 desktop
= ob
.openbox
.screen(data
.screen
).desktop()
65 if _focusable(c
, desktop
) and c
.focus():
69 # make sure its not already in the list
70 win
= data
.client
.window()
71 for i
in range(len(_clients
)):
72 if _clients
[i
].window() == win
:
74 _clients
.append(data
.client
)
76 def _closewindow(data
):
79 ob
.ebind(ob
.EventAction
.NewWindow
, _newwindow
)
80 ob
.ebind(ob
.EventAction
.CloseWindow
, _closewindow
)
81 ob
.ebind(ob
.EventAction
.Focus
, _focused
)
83 print "Loaded focus.py"
This page took 0.035775 seconds and 3 git commands to generate.