Skip to content

Commit

Permalink
address comment raised in ultrabug#109, now uses separate format stri…
Browse files Browse the repository at this point in the history
…ngs for on/off, rather than status strings
  • Loading branch information
shrimpza committed Jul 21, 2015
1 parent 6dc290a commit 580156b
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions py3status/modules/dpms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
by clicking on 'DPMS' in the status bar.
Configuration parameters:
- format: output format string
- status_off: string to display when DPMS is enabled
- status_on: string to display when DPMS is disabled
Format of status string placeholders:
{status} - DPMS status (defined by status_on/off parameters)
- format_off: string to display when DPMS is enabled
- format_on: string to display when DPMS is disabled
@author Andre Doser <dosera AT tf.uni-freiburg.de>
"""
Expand All @@ -24,9 +20,8 @@ class Py3status:
"""
"""
# available configuration parameters
format = "DPMS"
status_off = "Off"
status_on = "On"
format_off = "DPMS"
format_on = "DPMS"

def dpms(self, i3s_output_list, i3s_config):
"""
Expand All @@ -36,16 +31,10 @@ def dpms(self, i3s_output_list, i3s_config):
self.run = system('xset -q | grep -iq "DPMS is enabled"') == 0

response = {
'full_text': self.format.format(
status = self.status_on if self.run else self.status_off
)
'full_text': self.format_on if self.run else self.format_off,
'color': i3s_config['color_good'] if self.run else i3s_config['color_bad']
}

if self.run:
response['color'] = i3s_config['color_good']
else:
response['color'] = i3s_config['color_bad']

return response

def on_click(self, i3s_output_list, i3s_config, event):
Expand Down

0 comments on commit 580156b

Please sign in to comment.