summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--py3status/modules/aws_bill.py10
-rw-r--r--py3status/modules/imap.py16
2 files changed, 16 insertions, 10 deletions
diff --git a/py3status/modules/aws_bill.py b/py3status/modules/aws_bill.py
index 98643f6..5452718 100644
--- a/py3status/modules/aws_bill.py
+++ b/py3status/modules/aws_bill.py
@@ -18,6 +18,9 @@ Configuration parameters:
Follow this article to activate this feature:
http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/detailed-billing-reports.html
+Format of status string placeholders:
+ {bill_amount} - AWS bill amount
+
Requires:
- boto
@@ -41,6 +44,7 @@ class Py3status:
aws_secret_access_key = ''
billing_file = '/tmp/.aws_billing.csv'
cache_timeout = 3600
+ format = '{bill_amount}$'
s3_bucket_name = ''
def _get_bill_amount(self):
@@ -90,8 +94,8 @@ class Py3status:
def aws_bill(self, i3s_output_list, i3s_config):
response = {
'cached_until': time() + self.cache_timeout,
- 'full_text': '',
- 'color': i3s_config['color_bad']
+ 'color': i3s_config['color_bad'],
+ 'full_text': ''
}
bill_amount = self._get_bill_amount()
@@ -105,7 +109,7 @@ class Py3status:
elif bill_amount == 'conn_error':
response['full_text'] = 'Check your internet access'
elif bill_amount is not False:
- response['full_text'] = str(bill_amount) + '$'
+ response['full_text'] = self.format.format(bill_amount=bill_amount)
response['color'] = i3s_config['color_good']
else:
response['full_text'] = 'Global error - WTF exception'
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.