Closed dakra closed 5 years ago
In EXWM Emacs frames are not switched the normal way so the focus-in
& focus-out
events may not get generated. Actually we call focus-in-hook
& focus-out-hook
explicitly to workaround this problem. There's another hook you can reply on: exwm-workspace-switch-hook
. It get called every time you switch to another workspace.
OK, thanks. I'll close this issue now as I simply use exwm-workspace-switch-hook
for my own package.
But maybe it's good to keep in mind that from Emacs 27 onwards focus-in/out-hook
is deprecated and they say you should advice after-focus-change-function
instead.
Maybe exwm should also call this function manually like the focus-in/out hook right now to keep compatibility with other packages.
I'm reopening since this will stop working once 27 is out. Perhaps a forward-looking solution is invoking handle-focus-in/out
, temporarily bounding internal-handle-focus-in
to ignore
. Probably worth asking on emacs-devel.
@medranocalvo Thanks for the suggestion. I've updated exwm-workspace-switch
to include that. It seems internal-handle-focus-in
will generate a switch-frame
event at most so I simply leave it there.
@dakra Please verify if after-focus-change-function
and frame-focus-state
works now.
@ch11ng thank you, will try as well.
I tested it with my statusbar
package and there after-focus-change-function
is now working properly as well :+1:
frame-focus-state
doesn't seem to work in the Emacs instance that runs Exwm.I have the following in my code:
If I use the
focus-in-hook
it works fine, but Emacs 27 says it's obsolete and I try to do it the "proper way".If I start another Emacs instance (in exwm or not), the code works as expected. Only in my main Emacs that has exwm-mode on it doesn't work.