summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorVasiliy Horbachenko <shadowprince47@gmail.com>2014-05-20 11:09:34 +0300
committerVasiliy Horbachenko <shadowprince47@gmail.com>2014-05-20 11:09:34 +0300
commit94c99351d72b91c3f6063fac3c98001ed893b3cd (patch)
treefc7786d60a8f2492f4353c32a63f16c637fa6e30 /modules
parent5608ad5258a682985fd97a11454d60d2274aa88b (diff)
current-title: updated
Diffstat (limited to 'modules')
-rw-r--r--modules/current-title.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/modules/current-title.py b/modules/current-title.py
index ad2b97a..1f0822d 100644
--- a/modules/current-title.py
+++ b/modules/current-title.py
@@ -32,13 +32,20 @@ def find_focused(tree):
return find_focused(tree["nodes"] + tree["floating_nodes"])
class Py3status:
+ def __init__(self, *args, **kwargs):
+ self.text = ""
+ super(Py3status).__init__(*args, **kwargs)
+
def currentTitle(self, json, i3status_config):
window = find_focused(i3.get_tree())
- if window and "name" in window:
- text = len(window["name"]) > MAX_WIDTH and "..." + window["name"][-(MAX_WIDTH-3):] or window["name"]
+ transformed = False
+ if window and "name" in window and window["name"] != self.text:
+ self.text = len(window["name"]) > MAX_WIDTH and "..." + window["name"][-(MAX_WIDTH-3):] or window["name"]
+ transformed = True
- return (0, {'full_text': text,
+ return (0, {'full_text': self.text,
+ 'transformed': transformed,
'name': 'current-title',
'cached_until': time.time() + CACHED_TIME,
})