[modules/title] quotes
This commit is contained in:
parent
fd322aac6e
commit
efbd9588f7
1 changed files with 7 additions and 7 deletions
|
@ -7,7 +7,7 @@ Requirements:
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
* title.max : Maximum character length for title before truncating. Defaults to 64.
|
* title.max : Maximum character length for title before truncating. Defaults to 64.
|
||||||
* title.placeholder : Placeholder text to be placed if title was truncated. Defaults to "...".
|
* title.placeholder : Placeholder text to be placed if title was truncated. Defaults to '...'.
|
||||||
* title.scroll : Boolean flag for scrolling title. Defaults to False
|
* title.scroll : Boolean flag for scrolling title. Defaults to False
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import bumblebee.engine
|
||||||
|
|
||||||
from bumblebee.output import scrollable
|
from bumblebee.output import scrollable
|
||||||
|
|
||||||
_no_title = "n/a"
|
_no_title = 'n/a'
|
||||||
|
|
||||||
class Module(bumblebee.engine.Module):
|
class Module(bumblebee.engine.Module):
|
||||||
"""Window title module."""
|
"""Window title module."""
|
||||||
|
@ -37,9 +37,9 @@ class Module(bumblebee.engine.Module):
|
||||||
)
|
)
|
||||||
|
|
||||||
# parsing of parameters
|
# parsing of parameters
|
||||||
self._scroll = bumblebee.util.asbool(self.parameter("scroll", False))
|
self._scroll = bumblebee.util.asbool(self.parameter('scroll', False))
|
||||||
self._max = int(self.parameter("max", 64))
|
self._max = int(self.parameter('max', 64))
|
||||||
self._placeholder = self.parameter("placeholder", "...")
|
self._placeholder = self.parameter('placeholder', '...')
|
||||||
|
|
||||||
# set output of the module
|
# set output of the module
|
||||||
self.widgets(bumblebee.output.Widget(full_text=
|
self.widgets(bumblebee.output.Widget(full_text=
|
||||||
|
@ -49,7 +49,7 @@ class Module(bumblebee.engine.Module):
|
||||||
try:
|
try:
|
||||||
self._i3 = i3ipc.Connection()
|
self._i3 = i3ipc.Connection()
|
||||||
# event is called both on focus change and title change
|
# event is called both on focus change and title change
|
||||||
self._i3.on("window", lambda _p_i3, _p_e: self._pollTitle())
|
self._i3.on('window', lambda _p_i3, _p_e: self._pollTitle())
|
||||||
# begin listening for events
|
# begin listening for events
|
||||||
threading.Thread(target=self._i3.main).start()
|
threading.Thread(target=self._i3.main).start()
|
||||||
except:
|
except:
|
||||||
|
@ -78,7 +78,7 @@ class Module(bumblebee.engine.Module):
|
||||||
# cut the text if it is too long
|
# cut the text if it is too long
|
||||||
if len(self._full_title) > self._max:
|
if len(self._full_title) > self._max:
|
||||||
self._title = self._full_title[0:self._max - len(self._placeholder)]
|
self._title = self._full_title[0:self._max - len(self._placeholder)]
|
||||||
self._title = "{}{}".format(self._title, self._placeholder)
|
self._title = '{}{}'.format(self._title, self._placeholder)
|
||||||
else:
|
else:
|
||||||
self._title = self._full_title
|
self._title = self._full_title
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue