Skip to content

Commit

Permalink
Add dont-steal-focus configuration property.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sarg committed Oct 15, 2024
1 parent 14e7881 commit 40ea6f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions exwm-manage.el
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ possible choices:
* prefix-keys: `exwm-input-prefix-keys' local to this X window.
* simulation-keys: `exwm-input-simulation-keys' local to this X window.
* workspace: The initial workspace.
* dont-steal-focus: Ignore _NET_ACTIVE_WINDOW signal from this X window.
* managed: Force to manage (non-nil) or not manage (nil) the X window.
For each X window managed for the first time, matching criteria (sexps) are
Expand Down Expand Up @@ -98,6 +99,7 @@ want to match against EXWM internal variables such as `exwm-title',
(alist :key-type (key-sequence :tag "From")
:value-type (key-sequence :tag "To")))
((const :tag "Workspace" workspace) integer)
((const :tag "Don't steal focus" dont-steal-focus) boolean)
((const :tag "Managed" managed) boolean)
;; For forward compatibility.
((other) sexp))))
Expand Down
3 changes: 2 additions & 1 deletion exwm.el
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,8 @@ DATA contains unmarshalled PropertyNotify event data."
(if (buffer-live-p buffer)
;; Either an `exwm-mode' buffer (an X window) or a floating frame.
(with-current-buffer buffer
(when (eq exwm--frame exwm-workspace--current)
(when (and (eq exwm--frame exwm-workspace--current)
(not (plist-get exwm--configurations 'dont-steal-focus)))
(if exwm--floating-frame
(select-frame exwm--floating-frame)
(setq window (get-buffer-window nil t))
Expand Down

0 comments on commit 40ea6f7

Please sign in to comment.