diff --git a/i3pystatus/core/__init__.py b/i3pystatus/core/__init__.py index 73bd820..eac72d9 100644 --- a/i3pystatus/core/__init__.py +++ b/i3pystatus/core/__init__.py @@ -42,11 +42,11 @@ class Status: :param input_stream: A file-like object that provides the input stream, if `standalone` is False. """ - def __init__(self, standalone=False, interval=1, input_stream=sys.stdin): + def __init__(self, standalone=False, interval=1, input_stream=sys.stdin, click_events=True): self.modules = util.ModuleList(self, ClassFinder(Module)) self.standalone = standalone if standalone: - self.io = io.StandaloneIO(interval) + self.io = io.StandaloneIO(click_events, interval) self.command_endpoint = CommandEndpoint( self.modules, lambda: io.JSONIO(io=io.IOHandler(sys.stdin, open(os.devnull, "w")), skiplines=1)) diff --git a/i3pystatus/core/io.py b/i3pystatus/core/io.py index f6fb856..02b872c 100644 --- a/i3pystatus/core/io.py +++ b/i3pystatus/core/io.py @@ -51,11 +51,14 @@ class StandaloneIO(IOHandler): """ n = -1 - proto = ('{"version":1,"click_events":true}', "[", "[]", ",[]",) + proto = [{"version":1,"click_events":True}, "[", "[]", ",[]",] - def __init__(self, interval=1): + def __init__(self, click_events, interval=1): super().__init__() self.interval = interval + self.proto[0]['click_events'] = click_events + self.proto[0] = json.dumps(self.proto[0]) + def read(self): while True: