diff --git a/.i3/lemonbar/i3_lemonbar_common.py b/.i3/lemonbar/i3_lemonbar_common.py index cb38faa..179bad5 100755 --- a/.i3/lemonbar/i3_lemonbar_common.py +++ b/.i3/lemonbar/i3_lemonbar_common.py @@ -11,7 +11,7 @@ kill_on_unfocus = [] logger = None health_logger = None -write_queue = None # TODO Actually, why is this a queue? Just last element is important +bar_in_shelf = None # TODO bar mode can be moved to i3Module class bar_mode(Enum): diff --git a/.i3/lemonbar/i3_lemonbar_launcher.py b/.i3/lemonbar/i3_lemonbar_launcher.py index 74abcf0..1b682c1 100755 --- a/.i3/lemonbar/i3_lemonbar_launcher.py +++ b/.i3/lemonbar/i3_lemonbar_launcher.py @@ -107,7 +107,7 @@ def put_fifo_in_queue(): common.logger.debug("Writer closed") break data = data.rstrip() # Remove trailing newlines - common.write_queue.put(lemonparser.parse_line(data)) + common.bar_in_shelf.put(lemonparser.parse_line(data)) except BrokenPipeError: common.logger.debug('Broken pipe in parse status thread, exiting') common.health_logger.info('Broken pipe in parse status thread, exiting') @@ -124,12 +124,7 @@ def write_parsed(): , stdout=subprocess.PIPE, text=True) while True: - data = common.write_queue.get() # Blocking read - if data is None: - common.logger.debug('Queue closed') - common.health_logger.info('Queue closed') - break - + data = common.bar_in_shelf.get() # Blocking read p_lemonbar.stdin.write(data + '\n') p_lemonbar.stdin.flush() #common.logger.debug('Read: "{0}"'.format(data)) @@ -216,7 +211,7 @@ if __name__ == "__main__": signal.signal(signal.SIGTERM, handle_exit) signal.signal(signal.SIGINT, handle_exit) - common.write_queue = queue.Queue() + common.bar_in_shelf = common.Shelf() # Start writing and reading threads # Create readers before writers diff --git a/.i3/lemonbar/i3_lemonbar_modules.py b/.i3/lemonbar/i3_lemonbar_modules.py index 789bc68..9c3e255 100644 --- a/.i3/lemonbar/i3_lemonbar_modules.py +++ b/.i3/lemonbar/i3_lemonbar_modules.py @@ -42,7 +42,7 @@ class LemonModule(threading.Thread): break parsed = self.parse(line) - common.write_queue.put(parsed) + common.bar_in_shelf.put(parsed) def stop(self): self._stop_module()