Skip to content

Instantly share code, notes, and snippets.

@QiangF
Created September 16, 2026 08:48
Show Gist options
  • Select an option

  • Save QiangF/dc3e98b84c2baf2b31c03f51ef3efaac to your computer and use it in GitHub Desktop.

Select an option

Save QiangF/dc3e98b84c2baf2b31c03f51ef3efaac to your computer and use it in GitHub Desktop.
Reading the log, the focus loss is caused by a second X window that maps at the same moment — not by the GIMP dialog itself.
## What the log shows
The GIMP "Open Image" dialog (`#x1e04e81`) maps and gets focus correctly:
```
[01:21:05] exwm-input--update-focus: Set focus on #x1e04e81
```
But in the same second, another window from the Emacs process — `#x416efd` (and later `#x41713c`), class `Emacs`, instance `editor`, geometry `200x200+0+0` — is mapped. EXWM then:
1. `exwm-manage--manage-window: Manage #x416efd`
2. `exwm-input--on-buffer-list-update: current-buffer=#<buffer Emacs::editor-416efd>` — switches to the popup's buffer
3. `exwm-input-grab-keyboard: id=#x416efd` — grabs the keyboard
4. The GIMP dialog is hidden and the client withdraws it: `exwm-manage--unmanage-window: Unmanage #x1e04e81 ... widthdraw: t`
5. The popup unmaps, the dialog re-maps, the popup maps again — the whole cycle repeats ~3 times in the log
So the dialog never gets to keep focus because some Emacs component is repeatedly creating a transient 200×200 X window titled "editor" that EXWM manages and focuses on map.
## Identify the popup
Run `xprop` and click the popup (or, while it's alive, `xwininfo -root -tree | grep -i emacs`). The `WM_CLASS` should confirm `Emacs`, `"editor"`. Candidates: a posframe/child-frame package (`mini-frame`, `which-key-posframe`, `company-posframe`, `corfu` popup, `consult` preview frames), or an Emacs utility window (DND, tooltip with system tooltips enabled, xwidget).
## Fix 1: stop EXWM from managing it
Once confirmed via xprop:
```elisp
(setq exwm-manage-configurations
'(((equal exwm-instance-name "editor")
managed nil)))
```
Restart EXWM (`exwm-restart`) or eval and re-trigger. If the class is different, adjust the predicate accordingly.
## Fix 2: fix/stop the source
If it's a posframe-based package, the child frame shouldn't be a top-level managed window at all — check for an outdated posframe/EXWM combination, or disable the offending popup for that command. If it's an Emacs child frame being wrongly managed, a newer EXWM may already skip frames whose X parent isn't root; otherwise Fix 1 is the practical workaround.
Either way, the log is unambiguous: the GIMP dialog is fine — the Emacs "editor" popup is stealing focus and forcing the withdraw.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment