From 9c90de0dc8a4572aaeb9f329f7e4d3abf8c1d146 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Sat, 4 Jul 2026 04:59:59 +0545 Subject: [PATCH] feat(src): add recursive CSS file monitoring and streamline stylesheet setting Monitor CSS files and their subdirectories for changes by walking the styles directory and connecting change events to each monitor. Simplify the `set_css` function by removing the unnecessary empty line and directly passing the path to `set_stylesheet_from_file`. This enhances file change detection and reduces redundant code. --- src/main.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main.py b/src/main.py index fbb747d..a7b2127 100644 --- a/src/main.py +++ b/src/main.py @@ -62,9 +62,12 @@ def main(): dock = Dock() osd = OSDWindow() - # Monitor CSS files for changes - css_file = monitor_file(get_relative_path("styles")) - _ = css_file.connect("changed", lambda *_: set_css()) + # Monitor CSS files and subdirectories for changes + css_monitors = [] + for root, dirs, files in os.walk(get_relative_path("styles/")): + monitor = monitor_file(root) + monitor.connect("changed", lambda *_: set_css()) + css_monitors.append(monitor) app = Application( f"{APP_NAME}", @@ -78,9 +81,7 @@ def main(): ) def set_css(): - app.set_stylesheet_from_file( - get_relative_path("styles/main.css"), - ) + app.set_stylesheet_from_file(get_relative_path("styles/main.css")) app.set_css = set_css app.set_css()