diff --git a/.emacs.d/desktop.el b/.emacs.d/desktop.el index 6ce5b02..7d538fa 100644 --- a/.emacs.d/desktop.el +++ b/.emacs.d/desktop.el @@ -82,6 +82,25 @@ _=_: Balance " ("=" balance-windows) ("q" nil "quit" :color blue)) +(defun my/exwm-fill-other-window (&rest _) + (interactive) + (when (and (eq major-mode 'exwm-mode) (not (eq (next-window) (get-buffer-window)))) + (let ((other-exwm-buffer + (cl-loop with other-buffer = (persp-other-buffer) + for buf in (sort (persp-current-buffers) (lambda (a _) (eq a other-buffer))) + with current-buffer = (current-buffer) + when (and (not (eq current-buffer buf)) + (buffer-live-p buf) + (not (string-match-p (persp--make-ignore-buffer-rx) (buffer-name buf))) + (not (get-buffer-window buf))) + return buf))) + (when other-exwm-buffer + (with-selected-window (next-window) + (switch-to-buffer other-exwm-buffer)))))) + +(advice-add 'evil-window-split :after #'my/exwm-fill-other-window) +(advice-add 'evil-window-vsplit :after #'my/exwm-fill-other-window) + (use-package perspective-exwm :straight (:host github :repo "SqrtMinusOne/perspective-exwm.el") :config @@ -146,7 +165,11 @@ _d_: Discord ((or "VK" "Slack" "Discord" "TelegramDesktop") (perspective-exwm-assign-window :workspace-index 3 - :persp-name "comms")))) + :persp-name "comms")) + ((or "Chromium-browser" "jetbrains-datagrip") + (perspective-exwm-assign-window + :workspace-index 4 + :persp-name "dev")))) (add-hook 'exwm-manage-finish-hook #'my/exwm-configure-window) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 5a6d87c..1e8b885 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -677,7 +677,8 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." proced-filter-interactive proced-sort-interactive perspective-exwm-switch-perspective - my/persp-ivy-switch-buffer-other-window)) + my/persp-ivy-switch-buffer-other-window + lsp-execute-code-action)) ;; Do not use prescient in find-file (ivy--alist-set 'ivy-sort-functions-alist #'read-file-name-internal #'ivy-sort-file-function-default)) diff --git a/Desktop.org b/Desktop.org index b34dfe0..db19907 100644 --- a/Desktop.org +++ b/Desktop.org @@ -439,6 +439,29 @@ _=_: Balance " ("=" balance-windows) ("q" nil "quit" :color blue)) #+end_src +*** Improving splitting windows +By default splitting a window duplicates the current buffer, but because one EXWM buffer can be only in one window, this function opens some other buffer in the split in that case. + +#+begin_src emacs-lisp +(defun my/exwm-fill-other-window (&rest _) + (interactive) + (when (and (eq major-mode 'exwm-mode) (not (eq (next-window) (get-buffer-window)))) + (let ((other-exwm-buffer + (cl-loop with other-buffer = (persp-other-buffer) + for buf in (sort (persp-current-buffers) (lambda (a _) (eq a other-buffer))) + with current-buffer = (current-buffer) + when (and (not (eq current-buffer buf)) + (buffer-live-p buf) + (not (string-match-p (persp--make-ignore-buffer-rx) (buffer-name buf))) + (not (get-buffer-window buf))) + return buf))) + (when other-exwm-buffer + (with-selected-window (next-window) + (switch-to-buffer other-exwm-buffer)))))) + +(advice-add 'evil-window-split :after #'my/exwm-fill-other-window) +(advice-add 'evil-window-vsplit :after #'my/exwm-fill-other-window) +#+end_src ** Perspectives My package that integrates perspective.el with EXWM. @@ -558,7 +581,11 @@ A function to automatially assign an app to its designated workspace and perspec ((or "VK" "Slack" "Discord" "TelegramDesktop") (perspective-exwm-assign-window :workspace-index 3 - :persp-name "comms")))) + :persp-name "comms")) + ((or "Chromium-browser" "jetbrains-datagrip") + (perspective-exwm-assign-window + :workspace-index 4 + :persp-name "dev")))) (add-hook 'exwm-manage-finish-hook #'my/exwm-configure-window) #+end_src diff --git a/Emacs.org b/Emacs.org index a88ec11..0dc982e 100644 --- a/Emacs.org +++ b/Emacs.org @@ -1372,7 +1372,8 @@ References: proced-filter-interactive proced-sort-interactive perspective-exwm-switch-perspective - my/persp-ivy-switch-buffer-other-window)) + my/persp-ivy-switch-buffer-other-window + lsp-execute-code-action)) ;; Do not use prescient in find-file (ivy--alist-set 'ivy-sort-functions-alist #'read-file-name-internal #'ivy-sort-file-function-default)) #+end_src