-def ob_focused(data):
- global ob_focus_raise
- global ob_focus_fallback
- global ob_focus_stack
- if data.client:
- window = data.client.window()
- # add/move to front the stack
- if window in ob_focus_stack:
- ob_focus_stack.remove(window)
- ob_focus_stack.insert(0, window)
- elif ob_focus_fallback:
- # pass around focus
- desktop = openbox.screen(data.screen).desktop()
- l = len(ob_focus_stack)
- i = 0
- while i < l:
- w = ob_focus_stack[i]
- client = openbox.findClient(w)
- if not client: # window is gone, remove it
- ob_focus_stack.pop(i)
- l = l - 1
- elif client.desktop() == desktop and \
- client.normal() and client.focus():
- break
- else:
- i = i + 1
+export_functions = ()
+
+config.add('focus',
+ 'avoid_skip_taskbar',
+ 'Avoid SkipTaskbar Windows',
+ "Don't focus windows which have requested to not be displayed " + \
+ "in taskbars. You will still be able to focus the windows, but " + \
+ "not through cycling, and they won't be focused as a fallback " + \
+ "if 'Focus Fallback' is enabled.",
+ 'boolean',
+ 1)
+
+config.add('focus',
+ 'fallback',
+ 'Focus Fallback',
+ "Send focus somewhere when nothing is left with the focus, if " + \
+ "possible.",
+ 'boolean',
+ 1)
+
+# maintain a list of clients, stacked in focus order
+_clients = []
+_skip = 0
+
+def _focusable(client, desktop):
+ if not client.normal(): return 0
+ if not (client.canFocus() or client.focusNotify()): return 0
+ if client.iconic(): return 0
+ if config.get('focus', 'avoid_skip_taskbar') and \
+ client.skipTaskbar(): return 0