Also improve documentation. Fixes#96.
* exwm-randr.el (exwm-randr--connection): Move mode declaration up.
(exwm-randr-workspace-monitor-plist): Call exwm-randr-refresh if
exwm-randr-mode is currently enabled and document the need to
exwm-randr-mode whenever this variable is changed.
Instead of one big keymap that we re-create when we initialize the
workspace module, this patch creates 4 keymaps:
1. A private "switch by index" keymap that's defined once.
2. A private "switch by name" keymap that's updated whenever
exwm-workspace-index-map is changed.
3. A public exwm-workspace-switch-map for general+user keybindings.
4. A fourth keymap that combines all three of these.
That way, the user can customize the public keymap as desired.
* exwm-workspace.el
(exwm-workspace--switch-history)
exwm-workspace--switch-history-outdated): Move declarations.
(exwm-workspace--switch-by-index-map): New keymap for switching
workspaces by index.
(exwm-workspace--switch-by-name-map): New keymap for switching
workspaces by name.
(exwm-workspace-index-map): Update the switch-by-name map and
mark the history as outdated whenever this variable is customized.
(exwm-workspace--switch-map)
(exwm-workspace--workspace-from-frame-or-index):
Renamed exwm-workspace--switch-map to exwm-workspace-switch-map.
(exwm-workspace--init-switch-map): Removed.
(exwm-workspace-switch-map): The new user-customizable map replacing
exwm-workspace--switch-map.
(exwm-workspace--switch-composed-map): The combined map used by
exwm-workspace-switch.
(exwm-workspace--update-switch-by-name-map): New function to update the
switch-by-name map, called on by the customization framework and on
initialization of the workspace module.
Emacs 29+ encourages these functions over define-key, so use them. We
still use define-key in simulation keys because we need to process raw
key definitions (vectors, not strings).
* exwm-core.el (exwm-mode-map, exwm--kmacro-map): Use defvar-keymap.
(exwm--kmacro-self-insert-command): change the kmacro self-insert
command from a lambda to a function.
* exwm-workspace.el (exwm-workspace--init-switch-map): Use keymap-set.
(exwm-workspace--switch-map-nth-prefix): Use keymap-set.
The former will be deprecated in Emacs 31.
* exwm-manage.el (exwm-manage--manage-window): Replace when-let with
when-let*.
* exwm-workspace.el (exwm-workspace--update-workareas): Replace if-let
with if-let*.
`exwm-input--duration-command' isn't reliably unset when exiting
commands initiated by emacsclient causing Emacs to swallow one key
press. See ch11ng/exwm#253 and emacs-exwm/exwm#93.
However, `exwm-input--duration-command' appears to be no longer
necessary now that bind `exwm-input-line-mode-passthrough' around all
input commands (via advice).
fixes#93
* exwm-core.el (exwm--kmacro-map): remove obsolete comment.
* exwm-input.el (exwm-input--during-command): Remove variable.
(exwm-input--event-passthrough-p): Remove reference to variable.
(exwm-input-pre-post-command-blacklist): Remove newly unused option.
(exwm-input--on-pre-command, exwm-input--on-post-command): Remove hooks.
(exwm-input--init, exwm-input--exit): Remove references to the above
hooks.
* exwm-workspace.el (exwm-input--during-command): Remove reference to
removed variable.
(exwm-workspace--on-echo-area-dirty): Use real-this-command to detect
in-progress commands.
* exwm-core.el (exwm-mode): Minor optimization. Set eldoc-documentation-functions
to nil, such that globally configured Eldoc functions are never executed.
Previously, floating frames were configured to never automatically
split, but they could be manually split (usually by accident).
* exwm-floating.el (exwm-floating--set-floating): disable splitting of
floating windows by setting a the `split-window' window parameter to a
function that always throws an error.
Instead of using the obsolete exwm-config in your init.el, we recommend to
create a custom configuration tailored to your needs. The old exwm-config file
and the EXWM wiki serve as starting points. The minimal configuration to get
EXWM working is as follows:
(require 'exwm)
(setq exwm-input-global-keys `(([?\s-r] . exwm-reset)))
(exwm-enable)
In addition you may want to customize `exwm-workspace-number',
`exwm-input-global-keys' and `exwm-input-simulation-keys'. In order to rename
EXWM buffers, such that they match the window class or window title, add custom
hooks to `exwm-update-title-hook' and `exwm-update-class-hook', for example:
(add-hook 'exwm-update-class-hook
(lambda () (exwm-workspace-rename-buffer exwm-class-name)))
* exwm-config.el: Drop obsolete file.
Othewise, we won't be able to delete the frame (frames with surrogate
minibuffers cannot be deleted).
* exwm-workspace.el
(exwm-workspace-delete): Transfer surrogate minibuffers to the next
workspace before attempting to delete a workspace (part of #64).
(exwm-workspace--prompt-delete): Use `exwm-workspace-delete' instead of
directly calling `delete-frame'.
Previously, EXWM would leave the inner window behind when dragging
around floating windows until the mouse was released. Now, the inner
window will be dragged along without any lag.
* exwm-floating.el (exwm-floating--do-moveresize): drag the inner window
along with the outer window.
`cl-case' matches symbols directly but xcb:randr:Notify:* are variables. This likely never worked.
* exwm-randr.el (exwm-randr--on-Notify): replace cond with cl-case.
Previous behavior required explicitly passing an ID when called from lisp
programs. New behavior attempts to set the ID to window-buffer when not
explicitly passed as an argument. A user-error is thrown if current-buffer has
no X window ID.
See: https://github.com/emacs-exwm/exwm/issues/60
The example configuration should not be used directly. Instead copy the
relevant settings to your X initialization script. See #57.
* xinitrc: Print warning when used.
The sequence number tracks how many request's we've sent, the config
timestamp tracks the last time the screen configuration was changed. The
previous logic only worked because we tended to send a lot of X messages
between screen change events, but that's no longer the case now that
we're using a different connection.
* exwm-randr.el (exwm-randr--prev-screen-change-timestamp): rename
`sequence` to `timestamp`.
(exwm-randr--on-ScreenChangeNotify): use `config-timestamp` instead of
`~sequence`.
And make enabling it idempotent (part of #47).
* exwm-randr.el (exwm-randr--connection): create a separate connection
variable for EXWM randr, following up from this [1] GitHub discussion.
(*): switch to the new variable.
(exwm-randr--assert-connected): a new function to assert that randr is
enabled & connected (for interactive commands).
(exwm-randr-refresh): use the aformentioned function.
(exwm-randr-mode, exwm-randr-enable): move these to the top so we can
reference the mode variable.
[1]: https://github.com/emacs-exwm/exwm/pull/48#discussion_r1626741032
The example configuration should not be loaded directly. Instead copy the
relevant settings to your user configuration. Fix#57.
* exwm.el: Update commentary.
* exwm-config.el: Update commentary. Print warning when used.
(exwm-config-example, exwm-config-misc, exwm-config-ido): Mark as obsolete.
* exwm.el (exwm--client-message-functions):
Alist for dispatching client messages to handlers.
(exwm-init): set exwm--client-message-functions once exwmh support enabled.
(exwm--on-ClientMessage): delegate via exwm--client-message-functions,
decompose body into separate handlers.
See: https://github.com/ch11ng/exwm/issues/931
* exwm.el (exwm--on-ClientMessage): Handle the case where a window is
hidden but not iconic. This code would previously error in some cases
because a buffer wouldn't have an active window even when it was not in
the iconic state, likely due to a focus race somewhere.
fixes#28