diff --git a/src/redshift-gtk/statusicon.py b/src/redshift-gtk/statusicon.py index 08f28ef7..ec0dfe85 100644 --- a/src/redshift-gtk/statusicon.py +++ b/src/redshift-gtk/statusicon.py @@ -289,7 +289,7 @@ def child_key_change_cb(self, key, value): if key == 'Status': self.change_status(value != 'Disabled') elif key == 'Color temperature': - self.change_temperature(int(value[:-1], 10)) + self.change_temperature(int(value.rstrip('K'), 10)) elif key == 'Period': self.change_period(value) elif key == 'Location': @@ -308,9 +308,10 @@ def child_data_cb(self, f, cond, data): ib.buf += os.read(f, 256).decode('utf-8') # Split input at line break - sep = True - while sep != '': + while True: first, sep, last = ib.buf.partition('\n') + if sep == '': + break ib.buf = last ib.lines.append(first) if stdout: