Merge pull request #199 from cacyss0807/title_bug_fix

[modules/title] fixed runtime exception
This commit is contained in:
tobi-wan-kenobi 2017-10-27 18:21:20 +02:00 committed by GitHub
commit 3455ad3da4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,6 +23,8 @@ import bumblebee.engine
from bumblebee.output import scrollable from bumblebee.output import scrollable
no_title = "n/a"
class Module(bumblebee.engine.Module): class Module(bumblebee.engine.Module):
"""Window title module.""" """Window title module."""
@ -36,7 +38,7 @@ class Module(bumblebee.engine.Module):
self._i3 = i3ipc.Connection() self._i3 = i3ipc.Connection()
self._full_title = self._i3.get_tree().find_focused().name self._full_title = self._i3.get_tree().find_focused().name
except Exception: except Exception:
self._full_title = "n/a" self._full_title = no_title
def get_title(self, widget): def get_title(self, widget):
if bumblebee.util.asbool(self.parameter("scroll", False)): if bumblebee.util.asbool(self.parameter("scroll", False)):
@ -62,6 +64,9 @@ class Module(bumblebee.engine.Module):
try: try:
self._full_title = self._i3.get_tree().find_focused().name self._full_title = self._i3.get_tree().find_focused().name
except Exception: except Exception:
self._full_title = "n/a" self._full_title = no_title
if(self._full_title is None):
self._full_title = no_title
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4