Added brightness value to Redshift module
This commit is contained in:
parent
0cc39bc9d6
commit
53b49a4fbd
@ -21,6 +21,7 @@ class RedshiftController(threading.Thread):
|
|||||||
self._temperature = 0
|
self._temperature = 0
|
||||||
self._period = 'Unknown'
|
self._period = 'Unknown'
|
||||||
self._location = (0.0, 0.0)
|
self._location = (0.0, 0.0)
|
||||||
|
self._brightness = 0.0
|
||||||
self._pid = None
|
self._pid = None
|
||||||
|
|
||||||
cmd = ["redshift"] + args
|
cmd = ["redshift"] + args
|
||||||
@ -42,8 +43,8 @@ class RedshiftController(threading.Thread):
|
|||||||
"""Convert output to key value pairs"""
|
"""Convert output to key value pairs"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
key, value = line.split(":")
|
key, value = line.strip().split(":")
|
||||||
self.update_value(key, value.strip())
|
self.update_value(key, value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -56,6 +57,8 @@ class RedshiftController(threading.Thread):
|
|||||||
self._temperature = int(value.rstrip("K"), 10)
|
self._temperature = int(value.rstrip("K"), 10)
|
||||||
elif key == "Period":
|
elif key == "Period":
|
||||||
self._period = value
|
self._period = value
|
||||||
|
elif key == "Brightness":
|
||||||
|
self._brightness = value
|
||||||
elif key == "Location":
|
elif key == "Location":
|
||||||
location = []
|
location = []
|
||||||
for x in value.split(", "):
|
for x in value.split(", "):
|
||||||
@ -83,6 +86,11 @@ class RedshiftController(threading.Thread):
|
|||||||
"""Current location"""
|
"""Current location"""
|
||||||
return self._location
|
return self._location
|
||||||
|
|
||||||
|
@property
|
||||||
|
def brightness(self):
|
||||||
|
"""Current brightness"""
|
||||||
|
return self._brightness
|
||||||
|
|
||||||
def set_inhibit(self, inhibit):
|
def set_inhibit(self, inhibit):
|
||||||
"""Set inhibition state"""
|
"""Set inhibition state"""
|
||||||
if self._pid and inhibit != self._inhibited:
|
if self._pid and inhibit != self._inhibited:
|
||||||
@ -143,6 +151,7 @@ class Redshift(IntervalModule):
|
|||||||
self.period = self._controller.period
|
self.period = self._controller.period
|
||||||
self.temperature = self._controller.temperature
|
self.temperature = self._controller.temperature
|
||||||
self.latitude, self.longitude = self._controller.location
|
self.latitude, self.longitude = self._controller.location
|
||||||
|
self.brightness = self._controller.brightness
|
||||||
|
|
||||||
def toggle_inhibit(self):
|
def toggle_inhibit(self):
|
||||||
"""Enable/disable redshift"""
|
"""Enable/disable redshift"""
|
||||||
@ -162,6 +171,7 @@ class Redshift(IntervalModule):
|
|||||||
"temperature": self.temperature,
|
"temperature": self.temperature,
|
||||||
"latitude": self.latitude,
|
"latitude": self.latitude,
|
||||||
"longitude": self.longitude,
|
"longitude": self.longitude,
|
||||||
|
"brightness": self.brightness,
|
||||||
}
|
}
|
||||||
output = formatp(self.format, **fdict)
|
output = formatp(self.format, **fdict)
|
||||||
color = self.color
|
color = self.color
|
||||||
|
Loading…
Reference in New Issue
Block a user