Merge pull request #343 from rscholer/dpms_format
dpms: Allow a different format string when DPMS is disabled.
This commit is contained in:
commit
832061c426
@ -17,6 +17,7 @@ class DPMS(IntervalModule):
|
|||||||
|
|
||||||
settings = (
|
settings = (
|
||||||
"format",
|
"format",
|
||||||
|
"format_disabled",
|
||||||
"color",
|
"color",
|
||||||
"color_disabled",
|
"color_disabled",
|
||||||
)
|
)
|
||||||
@ -24,6 +25,7 @@ class DPMS(IntervalModule):
|
|||||||
color_disabled = "#AAAAAA"
|
color_disabled = "#AAAAAA"
|
||||||
color = "#FFFFFF"
|
color = "#FFFFFF"
|
||||||
format = "DPMS: {status}"
|
format = "DPMS: {status}"
|
||||||
|
format_disabled = "DPMS: {status}"
|
||||||
|
|
||||||
on_leftclick = "toggle_dpms"
|
on_leftclick = "toggle_dpms"
|
||||||
|
|
||||||
@ -33,9 +35,15 @@ class DPMS(IntervalModule):
|
|||||||
|
|
||||||
self.status = run_through_shell("xset -q | grep -q 'DPMS is Enabled'", True).rc == 0
|
self.status = run_through_shell("xset -q | grep -q 'DPMS is Enabled'", True).rc == 0
|
||||||
|
|
||||||
|
if self.status:
|
||||||
self.output = {
|
self.output = {
|
||||||
"full_text": self.format.format(status='on' if self.status else 'off'),
|
"full_text": self.format.format(status="off"),
|
||||||
"color": self.color if self.status else self.color_disabled
|
"color": self.color
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
self.output = {
|
||||||
|
"full_text": self.format_disabled.format(status="off"),
|
||||||
|
"color": self.color_disabled
|
||||||
}
|
}
|
||||||
|
|
||||||
def toggle_dpms(self):
|
def toggle_dpms(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user