perspective-exwm
perspective-exwm
A couple of tricks and fixes to make using EXWM and perspective.el a better experience.
Installation
This package is available on MELPA. Install it however you usually install packages, I use use-package and straight.el:
(use-package perspective-exwm
:straight t)
Or clone the repository, add the package to the load-path
and load it with require
.
The package provides a minor mode, perspective-exwm-mode
, which is meant to be loaded before exwm-init
. For instance, if you use use-package
:
(use-package exwm
:config
...
(perspective-exwm-mode)
(exwm-init))
Usage and details
-
perspective-exwm-mode
The mode does a couple of things:- advises away a bug with half-killing the current perspective when closing a floating window.
I haven’t tested this as thoroughlyI haven’t run into this issue for nearly a month, so it seems to be fixed. But there’sM-x perspective-exwm-revive-perspectives
if the problem arises anyway. - fixes a bug with running
persp-set-buffer
on an EXWM buffer that was moved between workspaces by advisingpersp-buffer-in-other-p
. - fixes a bug with
persp-set-buffer
copying all the perspectives from other workspaces to the current one. - adjusts the name of the initial perspective in the new workspace. It tries to get the name from the
perspective-exwm-override-initial-name
variable and fallbacks tomain-<index>
.
For the last point, I have the following in my configuration:
(setq perspective-exwm-override-initial-name '((0 . "misc") (1 . "core") (2 . "browser") (3 . "comms") (4 . "dev")))
Having distinct perspective names between frames also serves a purpose, because otherwise there are issues with multiple perspectives sharing the same scratch buffer.
- advises away a bug with half-killing the current perspective when closing a floating window.
-
M-x perspective-exwm-cycle-exwm-buffers-forward
,perspective-exwm-cycle-exwm-buffers-backward
Cycle EXWM buffers in the current perspective.The buffer highlighted in yellow is the current one, the buffer highlighted in blue is shown in another window of the perspective so it will be omitted from the cycle.
Set
perspective-exwm-get-exwm-buffer-name
to customize the displayed name, by default it’sexwm-class-name
. -
M-x perspective-exwm-cycle-all-buffers-forward
,perspective-exwm-cycle-exwm-all-backward
The same as above, but not restricted to EXWM buffers. -
M-x perspective-exwm-switch-perspective
Select a perspective from the list of all perspectives on all workspaces. -
M-x perspective-exwm-copy-to-workspace
Copy the current perspective to another EXWM workspace. -
M-x perspective-exwm-move-to-workspace
Move the current perspective to another EXWM workspace. -
perspective-exwm-assign-windows
A handy function to move the current window to a given workspace and/or perspective. Example usage:(defun my/exwm-configure-window () (interactive) (pcase exwm-class-name ((or "Firefox" "Nightly") (perspective-exwm-assign-window :workspace-index 2 :persp-name "browser")) ("Alacritty" (perspective-exwm-assign-window :persp-name "term")) ((or "VK" "Slack" "Discord" "TelegramDesktop") (perspective-exwm-assign-window :workspace-index 3 :persp-name "comms")))) (add-hook 'exwm-manage-finish-hook #'my/exwm-configure-window)
Known issues
perspective-exwm-move-to-workspace
kills X windows in the perspective it tries to move. Have no idea how to fix this at the moment.