[core/input] Ignore errors during callbacks
If a callback command cannot be executed, do not terminate the whole bar. Furthermore, if such a failure occurs, try to fall back to a globally (i.e. non widget-specific) command, so that callbacks registered in the engine itself (such as mouse-wheel scrolling) still function properly. fixes #166
This commit is contained in:
parent
93768e3380
commit
b2d0979050
1 changed files with 9 additions and 4 deletions
|
@ -126,9 +126,14 @@ class I3BarInput(object):
|
||||||
|
|
||||||
if cmd is None:
|
if cmd is None:
|
||||||
return
|
return
|
||||||
if callable(cmd):
|
try:
|
||||||
cmd(event)
|
if callable(cmd):
|
||||||
else:
|
cmd(event)
|
||||||
bumblebee.util.execute(cmd, False)
|
else:
|
||||||
|
bumblebee.util.execute(cmd, False)
|
||||||
|
except Exception:
|
||||||
|
# fall back to global default
|
||||||
|
if not "__fallback" in event:
|
||||||
|
return self.callback({ "name": None, "instance": None, "__fallback": True, "button": event["button"] })
|
||||||
|
|
||||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||||
|
|
Loading…
Reference in a new issue