feat: revive perspectives and more docstrings

This commit is contained in:
Pavel Korytov 2021-12-01 11:52:10 +03:00
parent cbaf6182a4
commit 9b3c3561d0

View file

@ -231,9 +231,42 @@ Overrides `persp-initial-frame-name' according to `perspective-exwm-override-ini
(format "main-%s" (funcall exwm-workspace-index-map workspace-index)))))
(apply fun args)))
;;;###autoload
(defun perspective-exwm-revive-perspectives ()
"Make perspectives in the current frame not killed."
(interactive)
(let ((to-switch nil))
(maphash
(lambda (_ v)
(setf (persp-killed v) nil)
(unless to-switch
(setq to-switch v)))
(frame-parameter nil 'persp--hash))
(when to-switch
(persp-switch (persp-name to-switch)))))
;;;###autoload
(define-minor-mode perspective-exwm-mode
"A minor mode for intergrating perspective.el and EXWM."
"A minor mode for intergrating perspective.el and EXWM.
The mode does a couple of things:
- fixes a bug with half-killing the current perspective when closing
a floating window. I haven't tested this as thoroughly, so run
`perspective-exwm-revive-perspectives' if the problem arises
anyway.
- adjusts the name of the inital perspective in the new workspace.
It tries to get the name from the
`perspective-exwm-override-initial-name' variable and falls back to
\"main-<index>\".
The latter also serves a purpose, because otherwise there are
issues with multiple perspectives sharing the same scratch
buffer.
Be sure to activate this mode before `exwm-enable', so that the
inital workspaces are created with the new perspective names."
:global t
:after-hook
(progn
@ -252,7 +285,5 @@ Overrides `persp-initial-frame-name' according to `perspective-exwm-override-ini
(advice-remove #'exwm-workspace-switch-create
#'perspective-exwm--workspace-switch-create-around))))
(advice-mapc 'prin1-to-string 'persp-delete-frame)
(provide 'perspective-exwm)
;;; perspective-exwm.el ends here