From 6fc80428992e5f1ebbe517a49ace8bd6a0b4f2d3 Mon Sep 17 00:00:00 2001 From: tobi-wan-kenobi Date: Sun, 3 May 2020 11:32:38 +0200 Subject: [PATCH] [main] always show errors in status line try to completely get rid of the occasional ("exited with status N") in the status bar by catching exceptions and showing a very very minimal error message. --- bumblebee-status | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bumblebee-status b/bumblebee-status index 920dff1..286f630 100755 --- a/bumblebee-status +++ b/bumblebee-status @@ -3,6 +3,7 @@ import os import sys import json +import time import socket import select import logging @@ -67,7 +68,6 @@ def handle_input(output): def main(): config = core.config.Config(sys.argv[1:]) - level = logging.DEBUG if config.debug() else logging.ERROR if config.logfile(): logging.basicConfig( @@ -112,14 +112,15 @@ def main(): if __name__ == "__main__": - main() try: main() except Exception as e: - output = core.output.i3() - output.modules(core.module.Error(module="main", error=e)) - output.draw("start") - output.update() - output.draw("statusline") + # really basic errors -> make sure these are shown in the status bar by minimal config + sys.stdout.write("{\"version\":1}\n[\n") + while True: + sys.stdout.write(json.dumps([{ "full_text": " {} ".format(e), "background": "#ff0000", "color": "#ffffff", "name": "error", "instance": "the-only-one" }])) + sys.stdout.write(",\n") + sys.stdout.flush() + time.sleep(5) # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4