All this logic runs in the context of the EXWM buffer. If there are
concerns about the X windows associating with a different buffer while
we're still trying to manage it, we probably have bigger problems.
* exwm-manage.el (exwm-manage--manage-window): assume that the current
buffer doesn't change.
Users can use this to configure system-wide themes, icons, fonts, etc.
* exwm-xsettings.el: Implement the XSETTINGS protocol (fixes
https://github.com/ch11ng/exwm/issues/876)
These functions and variables have been marked as obsolete over five years ago.
* exwm-input.el (exwm-input-set-simulation-keys): Remove obsolete function.
* exwm-randr.el (exwm-randr--refresh, exwm-randr-workspace-output-plist): Remove
obsolete aliases.
This patch starts Emacs as a foreground daemon (so it can accurately be
killed) and terminates it by sending a signal (because
'server-force-delete' stops the local server, not the named server).
* exwm.el (exwm--server-timeout): The time to politely wait for the
subordinate server to exit before killing it.
(exwm--server-stop): Send SIGTERM to the subordinate process instead of
using 'server-force-delete'.
(exwm--server-eval-at): Prevent Emacs from forking so we can manage it
as a subprocess.
When any of these functions are called, Emacs expects to receive all
input events until they return. Unfortunately, there doesn't appear to
be a reliable way to detect that these functions are currently running
other than advising them.
* exwm-input.el (exwm-input--init): Advise low-level input reading
functions to bind 'exwm-input-line-mode-passthrough' to t when called.
(exwm-input--exit): Unadvise.
(exwm-input--call-with-passthrough): The advice.
(exwm-input--passthrough-functions): The functions we now advise.
* exwm-input.el (exwm-input--fake-last-command): Catch and report
all errors raised when invoking `pre-command-hook' and
`post-command-hook'.
Copyright-paperwork-exempt: yes
* exwm-workspace.el (exwm-workspace--update-workareas): Clone the
value of the `exwm-geometry' frame parameter before modifying it
for calculating workareas.
(exwm-workspace--update-workareas): Simplify `pcase' patterns.
The guard clause was refacored incorrectly, leading to it having
no effect on the intended forms.
* exwm-layout.el (exwm-layout--on-minibuffer-setup): Guard
`exwm-layout--refresh' again.
The former is deprecated. The behavioural difference between
those functions does not impact us here, because the numbers
returned by `x-color-values' are natural.
* exwm-core.el (exwm--color->pixel): Convert `lsh' to `ash'.
For the case of vertical columns of workareas, top and bottom struts
should only apply to workareas containing the respective edge of the
strut offset.
To simplify, imagine three monitors arranged vertically and one
workarea per display:
+-------+
| 1 | 2000x1000 px
+-------+
| 2 | 2000x1000 px
+-------+
| 3 | 2000x1000 px
+-------+
In sexp form: ((0 0 2000 1000) (0 1000 2000 1000) (0 2000 2000 1000))
where each element represents a workarea as x, y, width, height
And example struts of the form (offset-type offset (x-start x-end))
a.) (top 42 (0 2000))
b.) (top 1042 (0 2000))
c.) (top 2042 (0 2000))
d.) (bottom 42 (0 2000))
e.) (bottom 1042 (0 2000))
f.) (bottom 2042 (0 2000))
Workareas adjusted for struts before this change:
a.) ((0 42 2000 958) (0 1000 2000 1000) (0 2000 2000 1000))
b.) ((0 1042 2000 -42) (0 1042 2000 958) (0 2000 2000 1000))
c.) ((0 2042 2000 -1042) (0 2042 2000 -42) (0 2042 2000 958))
d.) ((0 0 2000 1000) (0 1000 2000 1000) (0 2000 2000 902))
e.) ((0 0 2000 1000) (0 1000 2000 902) (0 2000 2000 -98))
f.) ((0 0 2000 902) (0 1000 2000 -98) (0 2000 2000 -1098))
Note that a. and d. are sensible, while b., c., e., and f. are quite
user unfriendly.
After this change, the same adjusted workareas are:
a.) no change
b.) ((0 0 2000 1000) (0 1042 2000 958) (0 2000 2000 1000))
c.) ((0 0 2000 1000) (0 1000 2000 1000) (0 2042 2000 958))
d.) no change
e.) ((0 0 2000 1000) (0 1000 2000 902) (0 2000 2000 1000))
f.) ((0 0 2000 902) (0 1000 2000 1000) (0 2000 2000 1000))
The intent is to allow dock type windows such as typical status bars
to occupy space in a workarea on any of a set of vertically arranged
displays without occluding the other workareas due to the limitations
of the X spec regarding strut offsets.
Note that this behaviour conflicts with EWMH 1.3:
> Struts MUST be specified in root window coordinates, that is,
they are *not* relative to the edges of any view port or Xinerama
monitor.
but is accepted by multiple WMs. See:
- https://blog.martin-graesslin.com/blog/2016/08/panels-on-shared-screen-edges/
- https://mail.gnome.org/archives/wm-spec-list/2009-November/msg00005.html
- https://gitlab.freedesktop.org/xdg/xdg-specs/-/merge_requests/22
* exwm-workspace.el (exwm-workspace--update-workareas): Assume
vertical struts apply from the monitor boundary when they cross
them.
Copyright-paperwork-exempt: yes
* exwm-workspace.el (exwm-workspace--remove-frame-as-workspace):
Add optional argument quit.
* exwm-background.el (exwm-background--exit):
* exwm-input.el (exwm-input--exit):
* exwm-manage.el (exwm-manage--unmanage-window):
* exwm-systemtray.el (exwm-systemtray--exit):
* exwm-workspace.el (exwm-workspace--exit-minibuffer-frame)
(exwm-workspace--exit):
* exwm-xim.el (exwm-xim--exit): Observe connection status when
deinitializing in order to support deinitializing when the
connection breaks.