From f00b5ca655a0471a10d21a3e75b1a442a8d28941 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Thu, 18 Jul 2024 12:19:46 +0000 Subject: [PATCH 1/7] 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. --- exwm-randr.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/exwm-randr.el b/exwm-randr.el index 386b3c9..ad6cec5 100644 --- a/exwm-randr.el +++ b/exwm-randr.el @@ -305,11 +305,10 @@ Refresh when any CRTC/output changes." notify) (xcb:unmarshal evt data) (with-slots (subCode u) evt - (cl-case subCode - (xcb:randr:Notify:CrtcChange - (setq notify (slot-value u 'cc))) - (xcb:randr:Notify:OutputChange - (setq notify (slot-value u 'oc)))) + (cond ((= subCode xcb:randr:Notify:CrtcChange) + (setq notify (slot-value u 'cc))) + ((= subCode xcb:randr:Notify:OutputChange) + (setq notify (slot-value u 'oc)))) (when notify (with-slots (timestamp) notify (when (> timestamp exwm-randr--last-timestamp) From 2f4e6fea7e3bb609cdc88dbff0bd74cf00b9b630 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Sun, 18 Aug 2024 14:33:09 +0000 Subject: [PATCH 2/7] 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. --- exwm-floating.el | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/exwm-floating.el b/exwm-floating.el index 9d31f92..70b4377 100644 --- a/exwm-floating.el +++ b/exwm-floating.el @@ -710,17 +710,28 @@ Float resizing is stopped when TYPE is nil." :height height)) (when (bufferp buffer-or-id) ;; Managed. - (setq value-mask (logand value-mask (logior xcb:ConfigWindow:Width - xcb:ConfigWindow:Height))) - (when (/= 0 value-mask) - (with-current-buffer buffer-or-id + (with-current-buffer buffer-or-id + (let ((resize-value-mask + (logand value-mask (logior xcb:ConfigWindow:Width + xcb:ConfigWindow:Height))) + (move-value-mask + (logand value-mask (logior xcb:ConfigWindow:X + xcb:ConfigWindow:Y)))) + (when (/= 0 resize-value-mask) (xcb:+request exwm--connection (make-instance 'xcb:ConfigureWindow :window (frame-parameter exwm--floating-frame 'exwm-outer-id) :value-mask value-mask :width width - :height height))))) + :height height))) + (when (/= 0 move-value-mask) + (xcb:+request exwm--connection + (make-instance 'xcb:ConfigureWindow + :window exwm--id + :value-mask value-mask + :x (+ x exwm-floating-border-width) + :y (+ y exwm-floating-border-width))))))) (xcb:flush exwm--connection)))) (defun exwm-floating-move (&optional delta-x delta-y) From 8c61f7ef2c0810837fcb4a4dbd2cc21ea61760e4 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Sun, 18 Aug 2024 14:35:04 +0000 Subject: [PATCH 3/7] 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'. --- exwm-workspace.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/exwm-workspace.el b/exwm-workspace.el index 9337dc0..c86051c 100644 --- a/exwm-workspace.el +++ b/exwm-workspace.el @@ -258,9 +258,9 @@ Show PROMPT to the user if non-nil." (if (eq frame exwm-workspace--current) ;; Abort the recursive minibuffer if deleting the current workspace. (progn - (exwm--defer 0 #'delete-frame frame) + (exwm--defer 0 #'exwm-workspace-delete frame) (abort-recursive-edit)) - (delete-frame frame) + (exwm-workspace-delete frame) (exwm-workspace--update-switch-history) (goto-history-element (min minibuffer-history-position (exwm-workspace--count))))))) @@ -824,6 +824,11 @@ INDEX must not exceed the current number of workspaces." (exwm-workspace--workspace-from-frame-or-index frame-or-index) exwm-workspace--current))) + ;; Transfer over any surrogate minibuffers before trying to delete the workspace. + (let ((minibuf (minibuffer-window frame)) + (newminibuf (minibuffer-window (exwm-workspace--get-next-workspace frame)))) + (dolist (f (filtered-frame-list (lambda (f) (eq (frame-parameter f 'minibuffer) minibuf)))) + (set-frame-parameter f 'minibuffer newminibuf))) (delete-frame frame)))) (defun exwm-workspace--set-desktop (id) From 3179085c2962b73eefe515b3599e87575fbe6a13 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Sun, 18 Aug 2024 15:01:50 +0000 Subject: [PATCH 4/7] 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. --- exwm-floating.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exwm-floating.el b/exwm-floating.el index 70b4377..9a7a92d 100644 --- a/exwm-floating.el +++ b/exwm-floating.el @@ -722,14 +722,14 @@ Float resizing is stopped when TYPE is nil." (make-instance 'xcb:ConfigureWindow :window (frame-parameter exwm--floating-frame 'exwm-outer-id) - :value-mask value-mask + :value-mask resize-value-mask :width width :height height))) (when (/= 0 move-value-mask) (xcb:+request exwm--connection (make-instance 'xcb:ConfigureWindow :window exwm--id - :value-mask value-mask + :value-mask move-value-mask :x (+ x exwm-floating-border-width) :y (+ y exwm-floating-border-width))))))) (xcb:flush exwm--connection)))) From fa3393806c3e7e3d6dc767cd7c0e29b8d4d0a716 Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Sun, 18 Aug 2024 21:03:08 +0200 Subject: [PATCH 5/7] Drop obsolete xinitrc * xinitrc: Drop obsolete file. * exwm.el: Update commentary. --- exwm.el | 5 ++++- xinitrc | 26 -------------------------- 2 files changed, 4 insertions(+), 27 deletions(-) delete mode 100644 xinitrc diff --git a/exwm.el b/exwm.el index 7bb2ebc..8421a35 100644 --- a/exwm.el +++ b/exwm.el @@ -52,7 +52,10 @@ ;; (setq exwm-input-global-keys `(([?\s-r] . exwm-reset))) ;; (exwm-enable) ;; -;; 3. Link or copy the file 'xinitrc' to '~/.xinitrc'. +;; 3. Add the following lines to '~/.xinitrc': +;; +;; exec emacs +;; ;; 4. Launch EXWM in a console (e.g. tty1) with ;; ;; xinit -- vt01 diff --git a/xinitrc b/xinitrc deleted file mode 100644 index 4726ac9..0000000 --- a/xinitrc +++ /dev/null @@ -1,26 +0,0 @@ -echo "The xinitrc file has been deprecated. We do not recommend using -xinitrc directly as is. Instead copy the relevant settings to your -xsession or xinitrc file and modify them as needed. The code from here -will be moved out of the source repository to the manual after the -next release. See https://github.com/emacs-exwm/exwm/issues/57." - -# Disable access control for the current user. -xhost +SI:localuser:$USER - -# Make Java applications aware this is a non-reparenting window manager. -export _JAVA_AWT_WM_NONREPARENTING=1 - -# Set default cursor. -xsetroot -cursor_name left_ptr - -# Set keyboard repeat rate. -xset r rate 200 60 - -# Uncomment the following block to use the exwm-xim module. -#export XMODIFIERS=@im=exwm-xim -#export GTK_IM_MODULE=xim -#export QT_IM_MODULE=xim -#export CLUTTER_IM_MODULE=xim - -# Finally start Emacs -exec emacs From 423850fe8315acb050afeeaf6594a090571e23da Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Sun, 18 Aug 2024 21:04:47 +0200 Subject: [PATCH 6/7] 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. --- exwm-config.el | 145 ------------------------------------------------- 1 file changed, 145 deletions(-) delete mode 100644 exwm-config.el diff --git a/exwm-config.el b/exwm-config.el deleted file mode 100644 index a0dd994..0000000 --- a/exwm-config.el +++ /dev/null @@ -1,145 +0,0 @@ -;;; exwm-config.el --- Predefined configurations -*- lexical-binding: t -*- - -;; Copyright (C) 2015-2024 Free Software Foundation, Inc. - -;; Author: Chris Feng - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . - -;;; Commentary: - -;; This module contains an example configuration of EXWM. Do not require this -;; file directly in your user configuration. Instead take it as inspiration and -;; copy the relevant settings to your user configuration. - -;;; Code: - -(require 'exwm) - -(defun exwm-config--warn () - "Print obsoletion warning." - (fset #'exwm-config--warn #'ignore) - (warn "The `exwm-config' file has been deprecated. We do not recommend requiring -`exwm-config' directly in your Emacs configuration. Instead copy the relevant -settings to your configuration and modify them as needed. The code from here -will be moved out of the source repository to the manual after the next -release. See https://github.com/emacs-exwm/exwm/issues/57.")) - -(defun exwm-config-example () - "Default configuration of EXWM." - (exwm-config--warn) - ;; Set the initial workspace number. - (unless (get 'exwm-workspace-number 'saved-value) - (setq exwm-workspace-number 4)) - ;; Make class name the buffer name - (add-hook 'exwm-update-class-hook - (lambda () - (exwm-workspace-rename-buffer exwm-class-name))) - ;; Global keybindings. - (unless (get 'exwm-input-global-keys 'saved-value) - (setq exwm-input-global-keys - `( - ;; 's-r': Reset (to line-mode). - ([?\s-r] . exwm-reset) - ;; 's-w': Switch workspace. - ([?\s-w] . exwm-workspace-switch) - ;; 's-&': Launch application. - ([?\s-&] . (lambda (command) - (interactive (list (read-shell-command "$ "))) - (start-process-shell-command command nil command))) - ;; 's-N': Switch to certain workspace. - ,@(mapcar (lambda (i) - `(,(kbd (format "s-%d" i)) . - (lambda () - (interactive) - (exwm-workspace-switch-create ,i)))) - (number-sequence 0 9))))) - ;; Line-editing shortcuts - (unless (get 'exwm-input-simulation-keys 'saved-value) - (setq exwm-input-simulation-keys - '(([?\C-b] . [left]) - ([?\C-f] . [right]) - ([?\C-p] . [up]) - ([?\C-n] . [down]) - ([?\C-a] . [home]) - ([?\C-e] . [end]) - ([?\M-v] . [prior]) - ([?\C-v] . [next]) - ([?\C-d] . [delete]) - ([?\C-k] . [S-end delete])))) - ;; Enable EXWM - (exwm-enable) - ;; Configure Ido - (with-no-warnings (exwm-config-ido)) - ;; Other configurations - (with-no-warnings (exwm-config-misc))) -(make-obsolete 'exwm-config-example "Copy the relevant settings to your configuration." "0.30") - -(defun exwm-config--fix/ido-buffer-window-other-frame () - "Fix `ido-buffer-window-other-frame'." - (defalias 'exwm-config-ido-buffer-window-other-frame - (symbol-function 'ido-buffer-window-other-frame)) - (defun ido-buffer-window-other-frame (buffer) - "This is a version redefined by EXWM. - -You can find the original one at `exwm-config-ido-buffer-window-other-frame'." - (with-current-buffer (window-buffer (selected-window)) - (if (and (derived-mode-p 'exwm-mode) - exwm--floating-frame) - ;; Switch from a floating frame. - (with-current-buffer buffer - (if (and (derived-mode-p 'exwm-mode) - exwm--floating-frame - (eq exwm--frame exwm-workspace--current)) - ;; Switch to another floating frame. - (frame-root-window exwm--floating-frame) - ;; Do not switch if the buffer is not on the current workspace. - (or (get-buffer-window buffer exwm-workspace--current) - (selected-window)))) - (with-current-buffer buffer - (when (derived-mode-p 'exwm-mode) - (if (eq exwm--frame exwm-workspace--current) - (when exwm--floating-frame - ;; Switch to a floating frame on the current workspace. - (frame-selected-window exwm--floating-frame)) - ;; Do not switch to exwm-mode buffers on other workspace (which - ;; won't work unless `exwm-layout-show-all-buffers' is set) - (unless exwm-layout-show-all-buffers - (selected-window))))))))) - -(defun exwm-config-ido () - "Configure Ido to work with EXWM." - (exwm-config--warn) - (declare-function ido-mode "ido") - (ido-mode 1) - (add-hook 'exwm-init-hook #'exwm-config--fix/ido-buffer-window-other-frame)) -(make-obsolete 'exwm-config-ido "Copy the relevant settings to your configuration." "0.30") - -(defun exwm-config-misc () - "Other configurations." - (exwm-config--warn) - ;; Make more room - (menu-bar-mode -1) - (tool-bar-mode -1) - (scroll-bar-mode -1) - (fringe-mode 1)) -(make-obsolete 'exwm-config-misc "Copy the relevant settings to your configuration." "0.30") - - - -(provide 'exwm-config) - -;;; exwm-config.el ends here From f453664bd6c509a68da6e85242fe941cc64c7b5d Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 23 Aug 2024 19:08:02 +0000 Subject: [PATCH 7/7] 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. --- exwm-floating.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exwm-floating.el b/exwm-floating.el index 9a7a92d..ff17de2 100644 --- a/exwm-floating.el +++ b/exwm-floating.el @@ -351,6 +351,8 @@ If TILED-P is non-nil, set actions for tiled window." (set-window-buffer window (current-buffer)) ;this changes current buffer (add-hook 'window-configuration-change-hook #'exwm-layout--refresh) (set-window-dedicated-p window t) + (set-window-parameter window 'split-window + (lambda (&rest _) (user-error "Floating window cannot be split"))) (exwm-layout--show id window)) (with-current-buffer (exwm--id->buffer id) (if (exwm-layout--iconic-state-p id)