diff --git a/README.md b/README.md index 001cb69..27e8f1b 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Test Coverage](https://codeclimate.com/github/tobi-wan-kenobi/bumblebee-status/badges/coverage.svg)](https://codeclimate.com/github/tobi-wan-kenobi/bumblebee-status/coverage) [![Issue Count](https://codeclimate.com/github/tobi-wan-kenobi/bumblebee-status/badges/issue_count.svg)](https://codeclimate.com/github/tobi-wan-kenobi/bumblebee-status) -**Many, many thanks to all contributors! As of now, 21 of the modules are from various contributors (!), and only 16 from myself.** +**Many, many thanks to all contributors! As of now, 22 of the modules are from various contributors (!), and only 16 from myself.** bumblebee-status is a modular, theme-able status line generator for the [i3 window manager](https://i3wm.org/). diff --git a/bumblebee/modules/title.py b/bumblebee/modules/title.py index 0bf0589..959c44a 100644 --- a/bumblebee/modules/title.py +++ b/bumblebee/modules/title.py @@ -15,7 +15,6 @@ try: except ImportError: pass -import textwrap import bumblebee.util import bumblebee.input import bumblebee.output @@ -33,13 +32,13 @@ class Module(bumblebee.engine.Module): self._i3 = i3ipc.Connection() self._full_title = self._i3.get_tree().find_focused().name - def focused_title(self): - """Truncates and returns proper-length title.""" - return textwrap.shorten( - self._full_title, - width=float(self.parameter("max", 64)), - placeholder=self.parameter("placeholder", "...") - ) + def focused_title(self, widget): + title = self._full_title[0:self.parameter("max", 64)] + if title != self._full_title: + title = self._full_title[0:self.parameter("max", 64) - 3] + title = "{}...".format(title) + + return title def update(self, widgets): """Update current title.""" diff --git a/screenshots/title.png b/screenshots/title.png new file mode 100644 index 0000000..1089a0b Binary files /dev/null and b/screenshots/title.png differ