Commit graph

651 commits

Author SHA1 Message Date
Daniel Mendler
c069e8195d
exwm-blocking-subrs: x-* functions may be missing on some Emacs builds
Avoid compiler warnings. Follow-up of https://github.com/ch11ng/exwm/pull/937.
2024-01-12 10:10:30 +01:00
Daniel Mendler
2e79830e39
; First line of docstring should be a full sentence 2024-01-12 10:07:08 +01:00
Daniel Mendler
22aa38b0cd
; Use two spaces after sentence
I follow this convention in Elisp files only.
2024-01-12 10:07:04 +01:00
Daniel Mendler
b51389ce8f
; exwm-background: Wrap docstrings to avoid compiler warnings 2024-01-12 10:07:01 +01:00
Daniel Mendler
262aa04855
; README and commentary: Mention background and xim features 2024-01-12 10:06:59 +01:00
Adrián Medraño Calvo
798dc60a9b ; Shorten docstrings 2024-01-08 00:00:00 +00:00
Adrián Medraño Calvo
4192762223 Merge branch 'minad.github.com/blocking-subrs' into externals/exwm 2024-01-08 00:00:00 +00:00
Adrián Medraño Calvo
9b5e4dc1c0 Merge branch 'minad.github.com/remove-cm' into externals/exwm 2024-01-08 00:00:00 +00:00
Adrián Medraño Calvo
01ae286e49 Merge branch 'Stebalien.github.com/steb/passthrough-input' into externals/exwm 2024-01-08 00:00:00 +00:00
Adrián Medraño Calvo
64d324e6ea Merge branch 'Stebalien.github.com/steb/fix-subordinate-daemon' into externals/exwm
* ch11ng.github.com/pull/939:
  Correctly stop the subordinate Emacs daemon
2024-01-08 00:00:00 +00:00
Adrián Medraño Calvo
92fbafee6c Update copyright year to 2024 2024-01-08 00:00:00 +00:00
Steven Allen
6eaa0301f1 Correctly stop the subordinate Emacs daemon
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.
2023-12-31 08:47:49 -08:00
Steven Allen
8ea607ba85 Passthrough input when explicitly reading events and keys
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.
2023-12-29 14:36:11 -08:00
Daniel Mendler
50681727e3 Add message-box and message-or-box to exwm-blocking-subrs (fix #874)
* exwm.el (exwm-blocking-subrs): Add `message-box' and
`message-or-box' to the list of blocking subrs.
2023-12-29 15:39:07 +01:00
Daniel Mendler
0b23607ca3 Remove exwm-cm
The exwm-cm feature has been obsoleted over five years ago in 7823eb98.  Stop
distributing it.

* exwm-cm.el: Remove file.
2023-12-29 14:08:32 +01:00
Adrián Medraño Calvo
56db521a3e Merge branch 'arnebab.github.com/master' into externals/exwm 2023-10-06 00:00:00 +00:00
Adrián Medraño Calvo
86f43494eb Bump version to 0.28 2023-10-06 00:00:00 +00:00
David Wilson
31f0f0a9c7 Catch and report all errors raised when invoking command hooks
* 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
2023-09-11 00:00:00 +00:00
Adrián Medraño Calvo
8cab6c03fa Fix workspace height unsharing workarea value
* 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.
2023-09-10 00:00:00 +00:00
Adrián Medraño Calvo
381637aa1c Declare external function
* exwm.el:
* exwm-randr.el: Declare `x-get-atom-name' function.
2023-08-18 00:00:00 +00:00
Adrián Medraño Calvo
d3567a8c7f Fix bytecompiler warnings, improve docstrings
* exwm-core.el:
* exwm-input.el:
* exwm-layout.el:
* exwm-manage.el:
* exwm-systemtray.el:
* exwm-workspace.el:
* exwm-xim.el: Improve docstrings.

* exwm-xim.el (cl-lib): Require `cl-lib' at runtime for
  `cl-position'.
* exwm-core.el (exwm-debug): Specify custom's group.
* exwm-systemtray.el (xcb:systemtray:-ClientMessage): Quote
  `:initform''s argument.
2023-08-18 00:00:00 +00:00
Adrián Medraño Calvo
c7d1fd45bc Fix layout being refreshed too often on minibuffer setup
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.
2023-08-18 00:00:00 +00:00
Adrián Medraño Calvo
fb73aaaf8f Convert lsh' to ash'
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'.
2023-08-18 00:00:00 +00:00
Adrián Medraño Calvo
612e64bf9b Update copyright year to 2023 2023-08-18 00:00:00 +00:00
Adrián Medraño Calvo
d8fcf18db7 Declare defsubst indentation
* exwm-core.el (exwm--id->buffer, exwm--buffer->id, exwm--terminal-p):
* exwm-input.el (exwm-input--unread-event):
* exwm-workspace.el (exwm-workspace--position)
(exwm-workspace--workspace-p): Declare indentation.
2023-08-18 00:00:00 +00:00
Adrián Medraño Calvo
d340a6a563 Merge branch 'jollm.github.com/ignore-struts-top-bottom' into externals/exwm 2023-08-18 00:00:00 +00:00
Adrián Medraño Calvo
23f1ca740d Selectively ignore left & right struts in horizontally aligned monitors
* exwm-workspace.el (exwm-workspace--update-workareas): Simplify
cross-monitor strut conditionals and apply them to horizontally
aligned monitors.
2023-08-18 00:00:00 +00:00
Adrián Medraño Calvo
937da86458 Convert `delta' to the size the strut occupies in the workarea
* exwm-workspace.el (exwm-workspace--update-workareas): Repurpose
`delta' to be the positive size occupied by the strut in the
workarea.
2023-08-18 00:00:00 +00:00
Adrián Medraño Calvo
67c5b316be Convert exwm-workspace--workareas' to a list of xcb:RECTANGLE's
* exwm-workspace.el (exwm-workspace--set-fullscreen)
(exwm-workspace--resize-minibuffer-frame)
(exwm-workspace--on-ConfigureNotify):
* exwm-floating.el (exwm-floating--set-floating):
* exwm-manage.el (exwm-manage--manage-window):
* exwm-systemtray.el (exwm-systemtray--refresh)
(exwm-systemtray--on-workspace-switch)
(exwm-systemtray--refresh-all, exwm-systemtray--init):
Adjust to `xcb:RECTANGLE'
workarea.
2023-08-18 00:00:00 +00:00
Adrián Medraño Calvo
b100eb74c5 Merge branch 'nbarrientos.github.com/ib_exwm_conn_nil' into externals/exwm 2023-06-14 00:00:00 +00:00
Fran Ley
4970d6ad4e More selectively ignore top and bottom struts
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
2023-06-09 00:00:00 +00:00
Adrián Medraño Calvo
a417f0d45e Merge branch 'nbarrientos.github.com/post-command-hook' into externals/exwm 2023-06-09 00:00:00 +00:00
Adrián Medraño Calvo
7318f857f2 Observe connection status on deinitialization
* 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.
2023-06-09 00:00:00 +00:00
Nacho Barrientos
4d5b0e81cd Make sure the buffer that generates the event is current
* exwm-input.el (exwm-input--on-ButtonPress): Set current buffer
when running pre- and post-command hooks.
2023-06-09 00:00:00 +00:00
Nacho Barrientos
cff02333e2 Don't assume that exwm--connection is non-nil
`exwm-input--exit` could be called (via `exwm-exit`) from `exwm-init`
in case of error when initialising EXWM. It could happen that the bit
that failed when exwm-init is executed was the call to `xcb:connect`,
hence `exwm--connection` would be nil when errors are handled (and
`exwm-exit` is called).

Without this patch, in the case above, the user will see a crash as
there's no method allowing a nil XCB connection object:

  Debugger entered--Lisp error:
  (cl-no-applicable-method xcb:-+request nil #<xcb:SetInputFocus ...

even worse, not even giving the chance to the `warn` call in
`exwm-init`'s error handler to actually inform the user about the
actual problem ("[XELB] Connection timeout", for instance).

* exwm-input.el (exwm-input--exit): Check `exwm--connection' is
set before trying to send requests.
2023-06-09 00:00:00 +00:00
Adrián Medraño Calvo
b62d5e79b0 Use active-minibuffer-window' rather than minibuffer-window'
* exwm-layout.el (exwm-layout--on-minibuffer-setup)
(exwm-layout--on-echo-area-change): Use
`active-minibuffer-window`, instead of the minibuffer window of
selected frame, as there's no guarantee that the selected frame is
the frame containing the minibuffer.  Also make sure the frame is
an EXWM workspace.
2022-11-22 00:00:00 +00:00
Adrián Medraño Calvo
1c706daeb0 Merge branch 'drop-client-p' into externals/exwm 2022-11-22 00:00:00 +00:00
Adrián Medraño Calvo
6408a74312 Merge branch 'stebalien.github.com/fix/systemtray-height' into externals/exwm 2022-11-22 00:00:00 +00:00
Adrián Medraño Calvo
8e0c5ee327 Reduce logging verbosity
* exwm-input.el (exwm-input--on-echo-area-dirty)
(exwm-input--on-echo-area-clear): Reduce logging verbosity.
2022-11-22 00:00:00 +00:00
Steven Allen
cb0093411b Pick the correct line height for the systemtray
* exwm-systemtray.el (exwm-systemtray--init): Use the line-height
of the minibuffer-window, not that of the selected one.
2022-11-22 00:00:00 +00:00
Adrián Medraño Calvo
ac16b9a468 Merge branch 'stebalien.github.com/feat/background' into externals/exwm 2022-11-22 00:00:00 +00:00
Steven Allen
4e1bb33f37 Add a module for setting the X background
When enabled, EXWM will automatically set the background color either
the user-specified color, or theme's default background color. This will
even work with compositors such as picom.

* background.el: add it.
* exwm-core (exwm--intern-atom): optionally take a conn.
2022-11-22 00:00:00 +00:00
Adrián Medraño Calvo
e9cc0962cc Bump version to 0.27 2022-11-11 00:00:00 +00:00
Adrián Medraño Calvo
3fb1ebe58c Default exwm-systemtray color to `workspace-background'
* exwm-systemtray.el (exwm-systemtray-background-color): Change
default to `workspace-background', as it's supported in all
configurations.
2022-11-09 00:00:00 +00:00
Steven Allen
e95b9ebf1d Refresh the tray icon background when updating the background color
* exwm-systemtray.el (exwm-systemtray--refresh-background-color):
Add optional parameter REMAP to force redrawing of the background.
(exwm-systemtray--on-theme-change): Use it.
2022-11-09 00:00:00 +00:00
Steven Allen
b3766e52d6 * exwm-systemtray.el (exwm-systemtray--on-theme-change): Add missing parameter. 2022-11-09 00:00:00 +00:00
Adrián Medraño Calvo
f93bfb21f7 * exwm-systemtray.el (exwm-systemtray--init): Set EWMH window type to dock. 2022-11-09 00:00:00 +00:00
Adrián Medraño Calvo
07b9b2ccf8 Support setting system tray background color to current workspace's
* exwm-systemtray.el (exwm-systemtray-background-color): Add
support for using current workspace's background color as system
tray background color.
(exwm-systemtray--refresh-background-color): New function to set
the background color upon theme changes or workspace switches.
(exwm-systemtray--on-workspace-switch)
(exwm-systemtray--on-theme-change): Use it.
(exwm-systemtray--init): React to theme changes.
2022-11-09 00:00:00 +00:00
Adrián Medraño Calvo
b8d621041a Use default visual, depth and colormap in systray embedder window
We were using the Emacs' frame's depth, but not the visual nor colormap.
This failed with Emacs 29 and its support for 32-bit depths.

We now use the default screen's visual: using a non-default visual in
the system tray requires support for embedding icons with different
visuals, which is not implemented.  We restrict our limited transparency
support to Emacs frames with depth equal to the default visual's detph.

* exwm-core.el (exwm--get-visual-depth-colormap): New function.
* exwm-systemtray.el (exwm-systemtray--init): Use root window's
visual, depth and colormap. Reset all attributes that refer
(perhaps due to defaults) to the parent window, as it might have a
different visual, depth or colormap.
(exwm-systemtray--init): Set _NET_SYSTEM_TRAY_VISUAL.
(exwm-systemtray-background-color): Emit a warning when
transparency is selected but not supported.
(exwm-systemtray--set-background-color): New function to set
embedder window background.
(exwm-systemtray--embedder-window-depth): Add variable.
(exwm-systemtray--transparency-supported-p): New function to check
whether transparency is supported.
2022-11-04 00:00:00 +00:00
Adrián Medraño Calvo
e8e4a66094 Merge branch 'j4m3s-s.github.com/master' into externals/exwm 2022-10-29 00:00:00 +00:00