From 4a9782a517e0069d4f8b04c118f53e2b6dc7541a Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Fri, 15 Sep 2017 20:05:09 +0200 Subject: [PATCH] [modules/title] Make unittests run through see #174 --- bumblebee/modules/title.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bumblebee/modules/title.py b/bumblebee/modules/title.py index 959c44a..f54fa7c 100644 --- a/bumblebee/modules/title.py +++ b/bumblebee/modules/title.py @@ -29,8 +29,11 @@ class Module(bumblebee.engine.Module): config, bumblebee.output.Widget(full_text=self.focused_title) ) - self._i3 = i3ipc.Connection() - self._full_title = self._i3.get_tree().find_focused().name + try: + self._i3 = i3ipc.Connection() + self._full_title = self._i3.get_tree().find_focused().name + except Exception: + self._full_title = "n/a" def focused_title(self, widget): title = self._full_title[0:self.parameter("max", 64)] @@ -42,6 +45,9 @@ class Module(bumblebee.engine.Module): def update(self, widgets): """Update current title.""" - self._full_title = self._i3.get_tree().find_focused().name + try: + self._full_title = self._i3.get_tree().find_focused().name + except Exception: + self._full_title = "n/a" # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4