-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EXWM windows lose focus when switching persps with persp-mode #18
Comments
Do you have such focus issues only with |
Yeah, I think this can happen when switching buffer, switching window, etc, according to an old workaround I wrote years ago (but have disabled). Lately I don't use many programs outside of Emacs but definitely it seems to happen in Discord and not in Firefox. I wrote a workaround that doesn't work as well as I would like it to because it interrupts repeat mode and creates a race condition where if I switch workspaces and start typing before the timers finish it will be interrupted, but if the delays are too low, it will also not work:
Then add |
I currently use the workaround from ch11ng/exwm#933 and ch11ng/exwm#759. (advice-add #'exwm-layout--hide
:after (lambda (id)
(with-current-buffer (exwm--id->buffer id)
(setq exwm--ewmh-state
(delq xcb:Atom:_NET_WM_STATE_HIDDEN exwm--ewmh-state))
(exwm-layout--set-ewmh-state id)
(xcb:flush exwm--connection)))) This workaround completely defeats the |
Man. I've been using this for a few days and it's a game-changer. EXWM is not broken anymore. I think this fix alone will make a lot of people who try EXWM again stay in EXWM. |
Have you tried setting This might be a race between updating input focus (which we defer and serialize with a lock) and processing other X events (which we serialize with a per-connection lock). Unfortunately, we're using two different locks here. This is a shot in the dark, but could you test this patch? diff --git a/exwm-input.el b/exwm-input.el
index f1f035c..fd8ed51 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -324,7 +324,7 @@ defun exwm-input--update-focus-commit
"Attempt to update the window focus.
If we're currently updating the window focus, re-schedule a focus update
attempt later."
- (if exwm-input--update-focus-lock
+ (if (or exwm-input--update-focus-lock (< 0 (slot-value exwm--connection 'event-lock)))
(exwm-input--update-focus-defer)
(let ((exwm-input--update-focus-lock t))
(exwm-input--update-focus exwm-input--update-focus-window)))) |
Hi. I haven't tried your patch but I've been using the |
I'm having a lot of difficulty getting persp-mode working together with EXWM. For some reason, if I switch to a Persp containing Discord, Discord does not gain focus unless I was previously in a persp containing an EXWM buffer. Firefox seems to behave though.
The text was updated successfully, but these errors were encountered: