Make battery colors configurable
This commit is contained in:
parent
5aef5f529a
commit
6d8dba3468
@ -115,6 +115,8 @@ class BatteryChecker(IntervalModule):
|
||||
("alert_format_body", "The body text of the notification, all formatters can be used"),
|
||||
("path", "Override the default-generated path"),
|
||||
("status", "A dictionary mapping ('DIS', 'CHR', 'FULL') to alternative names"),
|
||||
("color", "The text color"),
|
||||
("critical_color", "The critical color"),
|
||||
)
|
||||
battery_ident = "BAT0"
|
||||
format = "{status} {remaining}"
|
||||
@ -128,6 +130,8 @@ class BatteryChecker(IntervalModule):
|
||||
alert_percentage = 10
|
||||
alert_format_title = "Low battery"
|
||||
alert_format_body = "Battery {battery_ident} has only {percentage:.2f}% ({remaining:%E%hh:%Mm}) remaining!"
|
||||
color = "#ffffff"
|
||||
critical_color = "#ff0000"
|
||||
|
||||
path = None
|
||||
|
||||
@ -138,7 +142,7 @@ class BatteryChecker(IntervalModule):
|
||||
|
||||
def run(self):
|
||||
urgent = False
|
||||
color = "#ffffff"
|
||||
color = self.color
|
||||
|
||||
battery = Battery.create(self.path)
|
||||
|
||||
@ -158,7 +162,7 @@ class BatteryChecker(IntervalModule):
|
||||
fdict["status"] = "DIS"
|
||||
if battery.percentage() <= self.alert_percentage:
|
||||
urgent = True
|
||||
color = "#ff0000"
|
||||
color = self.critical_color
|
||||
else:
|
||||
fdict["status"] = "CHR"
|
||||
else:
|
||||
@ -179,5 +183,5 @@ class BatteryChecker(IntervalModule):
|
||||
"full_text": formatp(self.format, **fdict).strip(),
|
||||
"instance": self.battery_ident,
|
||||
"urgent": urgent,
|
||||
"color": color
|
||||
"color": color,
|
||||
}
|
||||
|
@ -11,6 +11,8 @@ class Load(IntervalModule):
|
||||
settings = (
|
||||
("format",
|
||||
"format string used for output. {avg1}, {avg5} and {avg15} are the load average of the last one, five and fifteen minutes, respectively. {tasks} is the number of tasks (i.e. 1/285, which indiciates that one out of 285 total tasks is runnable)."),
|
||||
("critical_limit", "Limit under witch one the battery is critical"),
|
||||
("critical_color", "The critical color"),
|
||||
)
|
||||
|
||||
file = "/proc/loadavg"
|
||||
|
Loading…
Reference in New Issue
Block a user