1 ###########################################################################
2 ### Functions for helping out with your window focus. ###
3 ###########################################################################
5 import config, ob, hooks
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 False
33 if not (client.canFocus() or client.focusNotify()): return False
34 if client.iconic(): return False
35 if config.get('focus', 'avoid_skip_taskbar') and \
36 client.skipTaskbar(): return False
38 desk = client.desktop()
39 if not (desk == 0xffffffff or desk == desktop): return False
44 global _clients, _skip
52 _clients.remove(client)
53 _clients.insert(0, client)
54 elif config.get('focus', 'fallback'):
56 desktop = ob.Openbox.desktop()
58 if focusable(c, desktop):
62 hooks.managed.append(lambda c: _clients.append(c))
63 hooks.closed.append(lambda c: _clients.remove(c))
64 hooks.focused.append(_focused)
66 print "Loaded focus.py"