feat: minor changes

This commit is contained in:
Pavel Korytov 2021-12-12 22:28:56 +03:00
parent f8eb4f63ce
commit f4476648fa
4 changed files with 56 additions and 4 deletions

View file

@ -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)

View file

@ -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))

View file

@ -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

View file

@ -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