Ideas to debug/fix frame focus delay issues
bug
I recently started experiencing issues with `doom-modeline` frame focus/unfocus indication. I noticed that there have been some changes in this area of late and was seeking some advice to fix my setup. It may not be a bug with `doom-modeline` (see below).
Behaviour is as follows:
- When switching window manager focus away from an emacs frame to another application (whether via keyboard or mouse), the doom-modeline of active emacs window remains in focused state until, as best I can determine, an emacs timer related to the modeline (e.g. for displaying clock/battery) expires.
- When switching window manager focus back to an emacs frame (e.g. using Alt-Tab), the doom-modeline of active emacs window remains in unfocused state until either a key is pressed, or one of previously mentioned timers expires.
- When switching between emacs windows, focus/unfocus behaviour is correct.
- When switching between frames of the same emacs session, focus/unfocus behaviour is correct.
(Note that the timer expiration trigger is just a theory to explain the variable timing of focus/unfocus indication changes.)
I tried a minimal emacs configuration (retaining the same doom-modeline configuration) and the frame focus/unfocus behaviour always works correctly. Therefore, it must be some interaction with the rest of my main emacs setup.
I tried adding `doom-modeline-focus-change` and `doom-modeline-set-selected-window` in various combinations to `focus-in-hook` / `focus-out-hook`, but it did not make a difference. I also noticed that the hooks seem to be somehow managed within the `doom-modeline` code anyway.
(I am using emacs 30.2 in KDE Plasma (Wayland session) using `emacs-wayland` package from Arch Linux. I don't think this is relevant since behaviour is correct with a minimal config.)
关闭于 2026-01-29 7 条评论