diff options
| author | Ultrabug <ultrabug@gentoo.org> | 2015-07-19 16:29:56 +0200 |
|---|---|---|
| committer | Ultrabug <ultrabug@gentoo.org> | 2015-07-19 16:29:56 +0200 |
| commit | 8ce1cc500faa68ce2d45e8fb2f3b85e4e0234851 (patch) | |
| tree | 1bc3d5fba4137632f5421a78f57e5966bf5c313f /py3status/modules/imap.py | |
| parent | e9ea19693d46516b9f2be93dedc08eb959faaa2b (diff) | |
imap module: switch to support format option
Diffstat (limited to 'py3status/modules/imap.py')
| -rw-r--r-- | py3status/modules/imap.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/py3status/modules/imap.py b/py3status/modules/imap.py index 473c55d..ec1d90e 100644 --- a/py3status/modules/imap.py +++ b/py3status/modules/imap.py @@ -5,15 +5,18 @@ Display the unread messages count from your IMAP account. Configuration parameters: - cache_timeout : how often to run this check - criterion : status of emails to check for + - format : format to display - hide_if_zero : don't show on bar if 0 - imap_server : IMAP server to connect to - mailbox : name of the mailbox to check - - name : format to display - new_mail_color : what color to output on new mail - password : login password - port : IMAP server port - user : login user +Format of status string placeholders: + {unseen} - number of unread emails + @author obb """ @@ -30,7 +33,7 @@ class Py3status: hide_if_zero = False imap_server = '<IMAP_SERVER>' mailbox = 'INBOX' - name = 'Mail: {unseen}' + format = 'Mail: {unseen}' new_mail_color = '' password = '<PASSWORD>' port = '993' @@ -39,9 +42,7 @@ class Py3status: def check_mail(self, i3s_output_list, i3s_config): mail_count = self._get_mail_count() - response = { - 'cached_until': time() + self.cache_timeout - } + response = {'cached_until': time() + self.cache_timeout} if not self.new_mail_color: self.new_mail_color = i3s_config['color_good'] @@ -50,12 +51,12 @@ class Py3status: response['full_text'] = mail_count elif mail_count != 0: response['color'] = self.new_mail_color - response['full_text'] = self.name.format(unseen=mail_count) + response['full_text'] = self.format.format(unseen=mail_count) else: if self.hide_if_zero: response['full_text'] = '' else: - response['full_text'] = self.name.format(unseen=mail_count) + response['full_text'] = self.format.format(unseen=mail_count) return response @@ -78,6 +79,7 @@ class Py3status: except: return 'N/A' + if __name__ == "__main__": """ Test this module by calling it directly. |
