Support for external file descriptors.
Allows to run i3status directly from your __main__, like this: status.register(...) # and so on process = subprocess.Popen("i3status", stdout=subprocess.PIPE) status.fd = process.stdout # start the handler status.run()
This commit is contained in:
parent
7e2c61c21a
commit
973abc928e
@ -40,6 +40,7 @@ class IntervalModule(AsyncModule):
|
||||
|
||||
class I3statusHandler:
|
||||
modules = []
|
||||
fd = sys.stdin
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
@ -61,7 +62,7 @@ class I3statusHandler:
|
||||
|
||||
# try reading a line, removing any extra whitespace
|
||||
try:
|
||||
line = sys.stdin.readline().strip()
|
||||
line = self.fd.readline().decode("utf-8").strip()
|
||||
# i3status sends EOF, or an empty line
|
||||
if not line:
|
||||
sys.exit(3)
|
||||
|
Loading…
Reference in New Issue
Block a user