From c9a0fe8654809e261ba12dbe56f5582e803a942e Mon Sep 17 00:00:00 2001 From: Window Maker Date: Sun, 24 May 2026 14:55:10 +0200 Subject: [PATCH] wl_backend: handle IN_MOVED_TO for atomic file replacement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WMWritePropListToFile uses an atomic write pattern: write to a temp file, fsync, fclose, then rename to the destination. The inotify directory watch sees: 1. IN_CLOSE_WRITE on the temp file (WindowMaker.XXXXXX) 2. IN_MOVED_TO on WindowMaker (the rename) We were only handling IN_CLOSE_WRITE, but at that point the rename hadn't happened yet, so stat(WindowMaker) returned the OLD mtime and we skipped. The NEXT save's IN_CLOSE_WRITE would then catch the PREVIOUS save's mtime change — hence the 'one click behind' pattern users observed. Now handles IN_MOVED_TO too, catching the actual atomic replacement. Also removed debug logging. --- src/backend/wayland/wl_backend.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index 70e53b5..2a6680e 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -3281,7 +3281,8 @@ static void wl_handle_inotify_events(void) } wPreferences.flags.noupdates = 1; } - if ((pevent->mask & IN_CLOSE_WRITE) && oneShotFlag == 0) { + if (((pevent->mask & IN_CLOSE_WRITE) || (pevent->mask & IN_MOVED_TO)) + && oneShotFlag == 0) { wDefaultsCheckDomains(NULL); oneShotFlag = 1; }