cmus - Text can now be a different color, when cmus is not running
This commit is contained in:
parent
2eb0abf596
commit
aaf8eb38ea
@ -33,10 +33,12 @@ class Cmus(IntervalModule):
|
|||||||
('format', 'formatp string'),
|
('format', 'formatp string'),
|
||||||
('format_not_running', 'Text to show if cmus is not running'),
|
('format_not_running', 'Text to show if cmus is not running'),
|
||||||
('color', 'The color of the text'),
|
('color', 'The color of the text'),
|
||||||
|
('color_not_running', 'The color of the text, when cmus is not running'),
|
||||||
('status', 'Dictionary mapping status to output'),
|
('status', 'Dictionary mapping status to output'),
|
||||||
)
|
)
|
||||||
|
|
||||||
color = '#909090'
|
color = '#909090'
|
||||||
|
color_not_running = '#909090'
|
||||||
format = '{status} {song_elapsed}/{song_length} {artist} - {title}'
|
format = '{status} {song_elapsed}/{song_length} {artist} - {title}'
|
||||||
format_not_running = 'Not running'
|
format_not_running = 'Not running'
|
||||||
interval = 1
|
interval = 1
|
||||||
@ -72,9 +74,7 @@ class Cmus(IntervalModule):
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.output = {
|
self.output = {}
|
||||||
'color': self.color,
|
|
||||||
}
|
|
||||||
response = self._query_cmus()
|
response = self._query_cmus()
|
||||||
|
|
||||||
if response:
|
if response:
|
||||||
@ -99,8 +99,10 @@ class Cmus(IntervalModule):
|
|||||||
fdict['artist'], fdict['title'] = _extract_artist_title(filebase)
|
fdict['artist'], fdict['title'] = _extract_artist_title(filebase)
|
||||||
|
|
||||||
self.output['full_text'] = formatp(self.format, **fdict)
|
self.output['full_text'] = formatp(self.format, **fdict)
|
||||||
|
self.output['color'] = self.color
|
||||||
else:
|
else:
|
||||||
self.output['full_text'] = self.format_not_running
|
self.output['full_text'] = self.format_not_running
|
||||||
|
self.output['color'] = self.color_not_running
|
||||||
|
|
||||||
def playpause(self):
|
def playpause(self):
|
||||||
status = self._query_cmus().get('status', '')
|
status = self._query_cmus().get('status', '')
|
||||||
|
Loading…
Reference in New Issue
Block a user