summaryrefslogtreecommitdiffstats
path: root/modules/current-title.py
diff options
context:
space:
mode:
authorVasiliy Horbachenko <shadowprince47@gmail.com>2014-05-19 19:34:51 +0300
committerVasiliy Horbachenko <shadowprince47@gmail.com>2014-05-19 19:34:51 +0300
commit1ff108ea4931ccf31da7d724298c52de9a839913 (patch)
treeecb800bc960deeb373bfc8dc155069695064e1c4 /modules/current-title.py
parent3c4b686cabc4c48325b09f158b65f5adf61bb3a6 (diff)
module for displaying current window\'s title
Diffstat (limited to 'modules/current-title.py')
-rw-r--r--modules/current-title.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/modules/current-title.py b/modules/current-title.py
index f995752..16248d1 100644
--- a/modules/current-title.py
+++ b/modules/current-title.py
@@ -33,15 +33,12 @@ def find_focused(tree):
class Py3status:
def currentTitle(self, json, i3status_config):
- response = {
- 'full_text': 'error',
- 'name': 'current-title',
- 'cached_until': time.time() + CACHED_TIME
- }
-
window = find_focused(i3.get_tree())
if window and "name" in window:
- response["full_text"] = len(window["name"]) > MAX_WIDTH and "..." + window["name"][-(MAX_WIDTH-3):] or window["name"]
+ text = len(window["name"]) > MAX_WIDTH and "..." + window["name"][-(MAX_WIDTH-3):] or window["name"]
- return (0, response)
+ return (0, {'full_text': text,
+ 'name': 'current-title',
+ 'cached_until': time.time() + CACHED_TIME,
+ })