From 077eaa55beed5141699815b5b3598c17397e6106 Mon Sep 17 00:00:00 2001 From: Julian lechner Date: Fri, 11 Sep 2026 15:44:04 +0200 Subject: [PATCH] fix(hooks): handle missing tkinter cleanly in flashbang.sh tkinter was imported at module level, before the try/except that was meant to catch a missing display or toolkit. On a Python install without the (often separately packaged) tkinter module, the script crashed instead of falling back to notify-send. The import is now wrapped in its own try/except with the same fallback. Co-Authored-By: Claude Sonnet 5 --- shared/hooks/flashbang.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shared/hooks/flashbang.sh b/shared/hooks/flashbang.sh index ff7f9bc..3a865a5 100644 --- a/shared/hooks/flashbang.sh +++ b/shared/hooks/flashbang.sh @@ -16,7 +16,6 @@ import re import shutil import subprocess import sys -import tkinter as tk def notify_fallback() -> None: @@ -25,6 +24,13 @@ def notify_fallback() -> None: subprocess.run([notify_send, "AI assistant requires attention"], check=False) +try: + import tkinter as tk +except ImportError: + notify_fallback() + sys.exit(0) + + def monitor_bounds(primary_only: bool) -> tuple[int, int, int, int]: root = tk.Tk() root.withdraw()