Skip to content

Commit 538e73d

Browse files
committed
Add dont-steal-focus configuration property.
Some applications send _NET_ACTIVE_WINDOW to activate their window. EXWM respects this message always and brings such up into focus. This might be unintended and there should be a way to turn this off. In my case the app is Spotify desktop client installed from Flatpak. Fixes ch11ng/exwm#732
1 parent 14e7881 commit 538e73d

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

exwm-manage.el

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ want to match against EXWM internal variables such as `exwm-title',
9898
(alist :key-type (key-sequence :tag "From")
9999
:value-type (key-sequence :tag "To")))
100100
((const :tag "Workspace" workspace) integer)
101+
((const :tag "Don't steal focus" dont-steal-focus) boolean)
101102
((const :tag "Managed" managed) boolean)
102103
;; For forward compatibility.
103104
((other) sexp))))

exwm.el

+11-10
Original file line numberDiff line numberDiff line change
@@ -494,16 +494,17 @@ DATA contains unmarshalled PropertyNotify event data."
494494
(if (buffer-live-p buffer)
495495
;; Either an `exwm-mode' buffer (an X window) or a floating frame.
496496
(with-current-buffer buffer
497-
(when (eq exwm--frame exwm-workspace--current)
498-
(if exwm--floating-frame
499-
(select-frame exwm--floating-frame)
500-
(setq window (get-buffer-window nil t))
501-
(unless window
502-
;; State change: iconic => normal.
503-
(setq window (frame-selected-window exwm--frame))
504-
(set-window-buffer window (current-buffer)))
505-
;; Focus transfer.
506-
(select-window window))))
497+
(unless (plist-get exwm--configurations 'dont-steal-focus)
498+
(when (eq exwm--frame exwm-workspace--current)
499+
(if exwm--floating-frame
500+
(select-frame exwm--floating-frame)
501+
(setq window (get-buffer-window nil t))
502+
(unless window
503+
;; State change: iconic => normal.
504+
(setq window (frame-selected-window exwm--frame))
505+
(set-window-buffer window (current-buffer)))
506+
;; Focus transfer.
507+
(select-window window)))))
507508
;; A workspace.
508509
(dolist (f exwm-workspace--list)
509510
(when (eq id (frame-parameter f 'exwm-outer-id))

0 commit comments

Comments
 (0)