summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUltrabug <ultrabug@gentoo.org>2014-12-16 23:27:02 +0100
committerUltrabug <ultrabug@gentoo.org>2014-12-16 23:27:02 +0100
commit5df6b3b3175e6f43ab2ac278b7a7041fa6b29209 (patch)
tree00e3404ce88eb3322bb61ae8ebe853ccb46c1f38
parent354bef9b49a1c9684914f112ad73614aff813e62 (diff)
module scratchpad-counter QA and config
-rw-r--r--py3status/modules/scratchpad-counter.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/py3status/modules/scratchpad-counter.py b/py3status/modules/scratchpad-counter.py
index 390745f..8bcc110 100644
--- a/py3status/modules/scratchpad-counter.py
+++ b/py3status/modules/scratchpad-counter.py
@@ -1,8 +1,4 @@
# -*- coding: utf-8 -*-
-
-import i3
-from time import time
-
"""
Module showing amount of windows at the scratchpad.
@@ -10,10 +6,8 @@ Module showing amount of windows at the scratchpad.
@license Eclipse Public License
"""
-CACHE_TIMEOUT = 5
-HIDE_WHEN_NONE = False # hide indicator when there is no windows
-POSITION = 0
-STRFORMAT = "{} ⌫" # format of indicator. {} replaces with count of windows
+import i3
+from time import time
def find_scratch(tree):
@@ -28,6 +22,12 @@ def find_scratch(tree):
class Py3status:
+
+ # available configuration parameters
+ cache_timeout = 5
+ format = "{} ⌫" # format of indicator. {} replaces with count of windows
+ hide_when_none = False # hide indicator when there is no windows
+
def __init__(self):
self.count = -1
@@ -41,10 +41,12 @@ class Py3status:
transformed = False
response = {
- 'cached_until': time() + CACHE_TIMEOUT,
- 'full_text': '' if HIDE_WHEN_NONE and count == 0 else STRFORMAT.format(count),
- 'name': 'scratchpad-counter',
+ 'cached_until': time() + self.cache_timeout,
'transformed': transformed
}
+ if self.hide_when_none and count == 0:
+ response['full_text'] = ''
+ else:
+ response['full_text'] = self.format.format(count)
- return (POSITION, response)
+ return response