From 1ff108ea4931ccf31da7d724298c52de9a839913 Mon Sep 17 00:00:00 2001 From: Vasiliy Horbachenko Date: Mon, 19 May 2014 19:34:51 +0300 Subject: module for displaying current window\'s title --- modules/current-title.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'modules/current-title.py') 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, + }) -- cgit v1.3