Commit graph

679 commits

Author SHA1 Message Date
Steven Allen
9cdfe95066 Work around a bug where the tab-line isn't taken into account
In Emacs before version 31, window-inside-absolute-pixel-edges returns
the wrong y-offset when the per-buffer tab-line is enabled. The tab-line
is taken into account when computing the window's height, so we adjust
the y-offset after computing the height.

Fixed upstream in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=75576.

* exwm-layout.el (exwm-layout--show): Adjust the window's y-offset to
include the tab-line.  (Bug emacs-exwm/exwm#114)
2025-01-16 18:06:02 +00:00
Steven Allen
26d24e534a Set _NET_ACTIVE_WINDOW to the current EXWM workspace
When a non-X window is selected, set _NET_ACTIVE_WINDOW to the current
EXWM workspace (i.e., the Emacs frame containing the selected window).
This behavior can be tested with, e.g., `xdotool getactivewindow'.

* exwm-input.el (exwm-input--set-active-window): The window ID is now
mandatory.
(exwm--input-update-focus): When focusing on a workspace, set the active
window to the workspace's window ID.  (#77)
2025-01-03 17:37:06 +00:00
Daniel Mendler
521cdb824e
; Update copyright years 2025-01-01 10:16:38 +01:00
Steven Allen
a2a977365c Refresh workspaces when the monitor/workspace mapping changes
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.
2024-12-31 15:05:10 +00:00
Steven Allen
2f229de5af Improve exwm-workspace-switch keymaps
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.
2024-12-29 05:29:16 +00:00
Steven Allen
578e37e0e8
Use defvar-keymap and keymap-set instead of define-key (#108)
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.
2024-12-28 01:21:10 +00:00
Steven Allen
f5fa4b885b
Replace if/when-let with if/when-let* (#105)
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*.
2024-12-23 21:32:05 +00:00
Daniel Mendler
ac80bf13a9 exwm-enable: Set environment variable INSIDE_EXWM
* exwm.el (exwm-enable): Set environment variable INSIDE_EXWM such that EXWM can
be detected inside nested Emacs sessions.
2024-12-23 22:20:47 +01:00
Daniel Mendler
53ea124e99
exwm-enable: Set x-no-window-manager
* exwm.el (exwm-enable): Set `x-no-window-manager' which tells Emacs to not wait
for the window manager, which is Emacs itself if EXWM is used.
2024-12-23 22:06:21 +01:00
Daniel Mendler
6b49a2fa18 Reduce autoloads
Only entry points to EXWM are marked as autoloaded. These are the functions
`exwm-enable' and `exwm-*-mode'.
2024-12-23 14:14:58 +01:00
Daniel Mendler
66f610203d
; Use standard package footer formatting 2024-12-22 14:06:14 +01:00
Daniel Mendler
4321cc079b
Remove deprecated exwm-*-enable functions
The corresponding global minor modes should be used instead.

* exwm-background.el (exwm-background-enable): Remove function.
* exwm-core.el (exwm-debug): Remove function.
* exwm-randr.el (exwm-randr-enable): Remove function.
* exwm-systemtray.el (exwm-systemtray-enable): Remove function.
* exwm-xim.el (exwm-xim-enable): Remove function.
* exwm-xsettings.el (exwm-xsettings-enable): Remove function.
2024-12-22 14:04:40 +01:00
Steven Allen
9f310dd5c1
Remove exwm-input--during-command logic (#94)
`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.
2024-12-16 01:30:18 +00:00
Garklein
369b4171e8
Avoid sometimes selecting killed buffers (#87)
* exwm-layout.el (exwm-layout--refresh-workspace): avoid selecting deleted buffers.

Copyright-paperwork-exempt: yes
2024-11-18 09:04:16 +00:00
Daniel Mendler
14e78817f9
; Disable Eldoc in EXWM buffers
* exwm-core.el (exwm-mode): Minor optimization. Set eldoc-documentation-functions
to nil, such that globally configured Eldoc functions are never executed.
2024-10-06 02:32:03 +02:00
Steven Allen
68c3e7019a Disable irrelevant mode-line elements in EXWM buffers
* exwm-core (exwm-mode): disable mode-line-position,
mode-line-modified, mode-line-mule-info, and mode-line-remote in EXWM
buffers.
2024-10-06 02:09:47 +02:00
Daniel Mendler
1485fcf064
Bump version 0.32 2024-10-05 15:24:59 +02:00
Daniel Mendler
7292ec32c9
; Warn more explicitly about deprecations. 2024-09-24 08:36:18 +02:00
Steven Allen
f453664bd6
Disable splitting of floating frames (#76)
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.
2024-08-23 19:08:02 +00:00
Daniel Mendler
423850fe83
Drop obsolete exwm-config.el
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.
2024-08-18 21:13:37 +02:00
Daniel Mendler
fa3393806c
Drop obsolete xinitrc
* xinitrc: Drop obsolete file.
* exwm.el: Update commentary.
2024-08-18 21:04:03 +02:00
Steven Allen
3179085c29
Use the correct value masks when resizing/moving (#75)
* exwm-floating.el (exwm-floating--do-moveresize): use the correct value
  masks when resizing/moving floating windows.
2024-08-18 15:01:50 +00:00
Steven Allen
8c61f7ef2c
Transfer surrogate minibuffers to the next workspace on delete (#74)
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'.
2024-08-18 14:35:04 +00:00
Steven Allen
2f4e6fea7e
Don't leave the inner window behind when moving floating windows (#73)
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.
2024-08-18 14:33:09 +00:00
Manuel Giraud
f00b5ca655
Fix on-Notify (#71)
`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.
2024-07-18 12:19:46 +00:00
Daniel Mendler
770520cf97
Bump xelb dependency 2024-07-08 23:24:58 +02:00
Daniel Mendler
5fe0e27a6c
Bump Compat dependency 2024-07-08 23:24:37 +02:00
Daniel Mendler
512d0f0ef9
Bump version 0.31 2024-07-08 12:24:00 +02:00
Daniel Mendler
841ead8141
exwm-xsettings: Use color-dark-p from Compat 2024-07-07 18:43:18 +02:00
Daniel Mendler
87c429561f
Require compat 29.1
See emacs-exwm/xelb/commit/2d451e5d5d16fbee881d5607a156c3bdf7f6bcaa
2024-07-07 18:38:07 +02:00
Nicholas Vollmer
94c9f369dd exwm-layout-toggle-fullscreen: work non-interactively
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
2024-06-21 17:56:21 +00:00
Daniel Mendler
41d1e6c1c3
Deprecate xinitrc
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.
2024-06-15 09:17:21 +02:00
Steven Allen
dad0668fc8 RandR: Track the config timestamp instead of the sequence number
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`.
2024-06-11 20:19:03 -07:00
Steven Allen
dd95ff193a ; Fix last change in exwm-randr.el
* exwm-randr.el (exwm-randr--init): explicitly return from
exwm-randr--init.
2024-06-09 08:14:32 -07:00
Steven Allen
dd9c11125f Make exwm-randr-mode use a separate X connection
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
2024-06-08 23:24:08 +00:00
Daniel Mendler
382bdd899c
Deprecate exwm-config
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.
2024-06-07 12:33:40 +02:00
Daniel Mendler
cc8592d30f
exwm-config: Remove obsolete alias exwm-config-default
* exwm-config.el (exwm-config-default): Remove obsolete alias.
2024-06-06 19:29:39 +02:00
Daniel Mendler
c3d1bdabb0
; exwm--global-minor-mode-body: Fix docstring
* exwm-core.el (exwm--global-minor-mode-body): Fix docstring.
2024-06-06 19:28:00 +02:00
Nicholas Vollmer
4042de16fd add exwm--client-message-functions
* 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
2024-06-06 14:40:42 +00:00
Daniel Mendler
d41de490e3
exwm-systemtray--init, exwm-xsettings--init: Idempotent initialization
* exwm-systemtray.el (exwm-systemtray--init),
  exwm-xsettings.el (exwm-xsettings--init):
  Return early if already initialized.
2024-06-06 10:12:02 +02:00
Daniel Mendler
63bde86545
Restore non-obsolete exwm-debug variable
* exwm-core.el (exwm-debug): Reintroduce exwm-debug variable.
2024-06-06 10:11:48 +02:00
Nicholas Vollmer
9e965fd2af satisfy checkdoc
* exwm-background.el (exwm-background--connected-p): Add docstring.
(exwm-background--connect): Add docstring.
* exwm-core.el (exwm-debug-log-time-function):
(exwm-debug): Rename to exwm-debug-mode; define obsolete alias for old name.
(exwm--debug): Update docstring to reflect above name change.
(exwm--log): condition on exwm-debug-mode
(exwm-mode-map): update exwm-debug-mode binding
* exwm-floating.el (exwm-floating--set-allowed-actions):
Rename TILLING parameter to TILED-P; update docstring.
(exwm-floating--start-moveresize): Add parameters to docstring.
(exwm-floating--do-moveresize): Add parameter to docstring.
* exwm-input.el (exwm-input-prefix-keys): Remove embedded keybinding from docstring.
(exwm-input--on-PropertyNotify): Add parameter to docstring.
(exwm-input--on-EnterNotify): Add parameter to docstring.
(exwm-input--on-keysyms-update): Add docstring.
(exwm-input--set-active-window): Add parameter to docstring.
(exwm-input--on-ButtonPress): Add parameter to docstring.
(exwm-input--on-KeyPress): Add parameter to docstring.
(exwm-input--on-CreateNotify): Add parameter to docstring.
(exwm-input--grab-global-prefix-keys): Add docstring.
(exwm-input--set-key): Add docstring.
(exwm-input-set-key): Add parameter to docstring.
(exwm-input--unread-event): Add docstring.
(exwm-input--translate): Add docstring.
(exwm-input--cache-event): Add parameter to docstring.
(exwm-input--on-KeyPress-line-mode): Rename parameter; add parameter to docstring.
(exwm-input--on-KeyPress-char-mode): Rename parameter; add parameter to docstring.
(exwm-input-grab-keyboard): Add parameter to docstring.
(exwm-input-release-keyboard): Add parameter to docstring.
(exwm-input-toggle-keyboard): Add parameter to docstring.
(exwm-input-send-next-key): Rename parameter; mention limit in docstring.
(exwm-input--set-simulation-keys): Rename parameter; add parameter to docstring.
(exwm-input--read-keys): Add docstring.
(exwm-input-set-simulation-key): Add parameters to docstring.
(exwm-input-send-simulation-key): Rename parameter; add parameter to docstring.
* exwm-randr.el (exwm-randr--on-ScreenChangeNotify): Add parameter to docstring.
(exwm-randr--on-Notify): Add parameter to docstring.
(exwm-randr--on-ConfigureNotify): Add parameter to docstring.
* exwm-xim.el (exwm-xim--on-ClientMessage): Add parameter to docstring.
* exwm.el (exwm-restart): Remove question mark from prompt arg
(exwm-enable): Remove question mark from prompt arg; add parameter to docstring.
(exwm--confirm-kill-terminal): Remove question mark from prompt arg.
(exwm--confirm-kill-emacs): Ensure prompt ends in question mark.
2024-06-06 09:56:47 +02:00
Daniel Mendler
588f6ca043
; Fix make-obsolete calls for the enable functions
Don't use hashed symbols, since this will lead to byte compilation warnings.
Also refer to the currently released version.
2024-06-04 17:27:43 +02:00
Daniel Mendler
693ade989f
Use appropriate customization groups for newly added modes 2024-06-04 17:24:07 +02:00
Daniel Mendler
2fd5ab1039
; Remove autoloads from obsolete enable functions 2024-06-04 16:55:49 +02:00
Daniel Mendler
f9f90dcf8b
; Update module commentaries 2024-06-04 16:55:41 +02:00
Nicholas Vollmer
5516f24d5e
Use global minor modes for EXWM features (#46) 2024-06-04 16:55:06 +02:00
Daniel Mendler
3e6bfe36af
Bump version to 0.30
Same version as 0.29. Bump only required to trigger ELPA rebuild.
2024-05-24 09:19:18 +02:00
Daniel Mendler
3b28c051f5
Bump version to 0.29 2024-05-23 19:19:41 +02:00
Daniel Mendler
956e7eb175
Depend on xelb 0.19 2024-05-23 19:19:19 +02:00