Skip to content

Commit 40ea6f7

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 40ea6f7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

exwm-manage.el

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ possible choices:
6565
* prefix-keys: `exwm-input-prefix-keys' local to this X window.
6666
* simulation-keys: `exwm-input-simulation-keys' local to this X window.
6767
* workspace: The initial workspace.
68+
* dont-steal-focus: Ignore _NET_ACTIVE_WINDOW signal from this X window.
6869
* managed: Force to manage (non-nil) or not manage (nil) the X window.
6970
7071
For each X window managed for the first time, matching criteria (sexps) are
@@ -98,6 +99,7 @@ want to match against EXWM internal variables such as `exwm-title',
9899
(alist :key-type (key-sequence :tag "From")
99100
:value-type (key-sequence :tag "To")))
100101
((const :tag "Workspace" workspace) integer)
102+
((const :tag "Don't steal focus" dont-steal-focus) boolean)
101103
((const :tag "Managed" managed) boolean)
102104
;; For forward compatibility.
103105
((other) sexp))))

exwm.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,8 @@ 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)
497+
(when (and (eq exwm--frame exwm-workspace--current)
498+
(not (plist-get exwm--configurations 'dont-steal-focus)))
498499
(if exwm--floating-frame
499500
(select-frame exwm--floating-frame)
500501
(setq window (get-buffer-window nil t))

0 commit comments

Comments
 (0)