From 6c79817b69475095a1b52cb133dfb98e80041cc1 Mon Sep 17 00:00:00 2001 From: Scott Moreau Date: Tue, 17 Feb 2026 09:23:09 -0700 Subject: [PATCH] wf-shell-app: Only call inotify_add_watch once upfront for each case This was causing intermittent crashes when editing the config file. This patch also changed config watch from IN_MODIFY to IN_CLOSE_WRITE. --- src/util/wf-shell-app.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/util/wf-shell-app.cpp b/src/util/wf-shell-app.cpp index b740d8647..c44541312 100644 --- a/src/util/wf-shell-app.cpp +++ b/src/util/wf-shell-app.cpp @@ -131,9 +131,6 @@ char buf[INOT_BUF_SIZE]; static void do_reload_css(WayfireShellApp *app) { app->on_css_reload(); - inotify_add_watch(app->inotify_css_fd, - app->get_css_config_dir().c_str(), - IN_CREATE | IN_MODIFY | IN_DELETE | IN_MOVED_FROM | IN_MOVED_TO | IN_DELETE); } /* Reload file and add next inotify watch */ @@ -142,7 +139,6 @@ static void do_reload_config(WayfireShellApp *app) wf::config::load_configuration_options_from_file( app->config, app->get_config_file()); app->on_config_reload(); - inotify_add_watch(app->inotify_fd, app->get_config_file().c_str(), IN_MODIFY); } /* Handle inotify event */ @@ -215,6 +211,12 @@ void WayfireShellApp::on_activate() inotify_css_fd = inotify_init(); do_reload_css(this); + inotify_add_watch(inotify_fd, + get_config_file().c_str(), + IN_CLOSE_WRITE); + inotify_add_watch(inotify_css_fd, + get_css_config_dir().c_str(), + IN_CREATE | IN_MODIFY | IN_DELETE | IN_MOVED_FROM | IN_MOVED_TO | IN_DELETE); Glib::signal_io().connect( sigc::bind<0>(&handle_inotify_event, this), inotify_fd, Glib::IOCondition::IO_IN | Glib::IOCondition::IO_HUP);