]>
Dogcows Code - chaz/openbox/blob - scripts/focus.py
1 ###########################################################################
2 ### Functions for helping out with your window focus. ###
3 ###########################################################################
11 'Avoid SkipTaskbar Windows',
12 "Don't focus windows which have requested to not be displayed " + \
13 "in taskbars. You will still be able to focus the windows, but " + \
14 "not through cycling, and they won't be focused as a fallback " + \
15 "if 'Focus Fallback' is enabled.",
22 "Send focus somewhere when nothing is left with the focus, if " + \
27 # maintain a list of clients, stacked in focus order
31 def _focusable(client
, desktop
):
32 if not client
.normal(): return 0
33 if not (client
.canFocus() or client
.focusNotify()): return 0
34 if client
.iconic(): return 0
35 if config
.get('focus', 'avoid_skip_taskbar') and \
36 client
.skipTaskbar(): return 0
38 desk
= client
.desktop()
39 if not (desk
== 0xffffffff or desk
== desktop
): return 0
44 """This function exists because Swig pointers don't define a __eq__
45 function, so list.remove(ptr) does not work."""
47 for i
in range(len(_clients
)):
48 if _clients
[i
].window() == win
:
51 raise ValueError("_remove(x): x not in _clients list.")
54 global _clients
, _skip
64 except ValueError: pass # happens if _focused comes before _newwindow
65 _clients
.insert(0, data
.client
)
66 elif config
.get('focus', 'fallback'):
68 desktop
= ob
.openbox
.screen(data
.screen
).desktop()
70 if _focusable(c
, desktop
):
75 # make sure its not already in the list
76 win
= data
.client
.window()
77 for i
in range(len(_clients
)):
78 if _clients
[i
].window() == win
:
80 _clients
.append(data
.client
)
82 def _closewindow(data
):
85 ob
.ebind(ob
.EventAction
.NewWindow
, _newwindow
)
86 ob
.ebind(ob
.EventAction
.CloseWindow
, _closewindow
)
87 ob
.ebind(ob
.EventAction
.Focus
, _focused
)
89 print "Loaded focus.py"
This page took 0.03718 seconds and 4 git commands to generate.