core-popups: refactor
This commit is contained in:
parent
a46829a06c
commit
628b575566
1 changed files with 45 additions and 35 deletions
|
@ -48,46 +48,56 @@
|
||||||
(@def-package shackle :demand t
|
(@def-package shackle :demand t
|
||||||
:init
|
:init
|
||||||
(setq shackle-default-alignment 'below
|
(setq shackle-default-alignment 'below
|
||||||
shackle-select-reused-windows t)
|
|
||||||
|
|
||||||
:config
|
|
||||||
(shackle-mode 1)
|
|
||||||
|
|
||||||
;;; Baseline popup-window rules
|
;;; Baseline popup-window rules
|
||||||
;; :noesc and :modeline are custom settings and are not part of shackle. See
|
;; :noesc and :modeline are custom settings and are not part of shackle. See
|
||||||
;; `doom*popup-init' and `doom-popup-buffer' for how they're used.
|
;; `doom*popup-init' and `doom-popup-buffer' for how they're used.
|
||||||
(@set :popup
|
shackle-rules
|
||||||
'("^ ?\\*doom:.+\\*$" :size 40 :modeline t :regexp t)
|
'(("^ ?\\*doom:.+\\*$" :size 40 :modeline t :regexp t)
|
||||||
'("^ ?\\*doom .+\\*$" :size 30 :noselect t :regexp t)
|
("^ ?\\*doom .+\\*$" :size 30 :noselect t :regexp t)
|
||||||
'("^\\*.+-Profiler-Report .+\\*$" :size 0.3 :regexp t)
|
("^\\*.+-Profiler-Report .+\\*$" :size 0.3 :regexp t)
|
||||||
'("*esup*" :size 0.4 :noselect t :noesc t)
|
("*esup*" :size 0.4 :noselect t :noesc t)
|
||||||
'("*minor-modes*" :size 0.5 :noselect t)
|
("*minor-modes*" :size 0.5 :noselect t)
|
||||||
'("*eval*" :size 16 :noselect t)
|
("*eval*" :size 16 :noselect t)
|
||||||
'("*Pp Eval Output*" :size 0.3)
|
("*Pp Eval Output*" :size 0.3)
|
||||||
'("*Apropos*" :size 0.3)
|
("*Apropos*" :size 0.3)
|
||||||
'("*Backtrace*" :size 25 :noselect t)
|
("*Backtrace*" :size 25 :noselect t)
|
||||||
'("*Help*" :size 16)
|
("*Help*" :size 16)
|
||||||
'("*Messages*" :size 10)
|
("*Messages*" :size 10)
|
||||||
'("*Warnings*" :size 10 :noselect t)
|
("*Warnings*" :size 10 :noselect t)
|
||||||
'("*command-log*" :size 28 :noselect t :align right)
|
("*command-log*" :size 28 :noselect t :align right)
|
||||||
'("*Shell Command Output*" :size 20 :noselect t)
|
("*Shell Command Output*" :size 20 :noselect t)
|
||||||
'(compilation-mode :size 15 :noselect t :noesc t)
|
(compilation-mode :size 15 :noselect t :noesc t)
|
||||||
'(ivy-occur-grep-mode :size 25 :noesc t)
|
(ivy-occur-grep-mode :size 25 :noesc t)
|
||||||
'(eww-mode :size 30)
|
(eww-mode :size 30)
|
||||||
'(comint-mode :noesc t)
|
(comint-mode :noesc t)
|
||||||
'(tabulated-list-mode :noesc t)))
|
(tabulated-list-mode :noesc t)))
|
||||||
|
|
||||||
|
:config
|
||||||
|
(shackle-mode 1))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Modifications
|
;; Modifications
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
(defun doom*shackle-always-align (plist)
|
||||||
|
"Ensure popups are always aligned and selected by default. Eliminates the need
|
||||||
|
for the obvious :align t on every rule."
|
||||||
|
(when plist
|
||||||
|
(unless (plist-member plist :align)
|
||||||
|
(plist-put plist :align t))
|
||||||
|
(unless (or (plist-member plist :select)
|
||||||
|
(plist-member plist :noselect))
|
||||||
|
(plist-put plist :select t)))
|
||||||
|
plist)
|
||||||
|
(advice-add 'shackle--match :filter-return 'doom*shackle-always-align)
|
||||||
|
|
||||||
|
|
||||||
;; Tell `window-state-get' and `current-window-configuration' to persist these
|
;; Tell `window-state-get' and `current-window-configuration' to persist these
|
||||||
;; custom parameters. Allows `persp-mode' to remember popup states.
|
;; custom parameters. Allows `persp-mode' to remember popup states.
|
||||||
(setq window-persistent-parameters
|
(nconc window-persistent-parameters
|
||||||
(append '((popup . writable)
|
'((popup . writable)
|
||||||
(noesc . writable))
|
(noesc . writable)))
|
||||||
window-persistent-parameters))
|
|
||||||
|
|
||||||
|
|
||||||
(define-minor-mode doom-popup-mode
|
(define-minor-mode doom-popup-mode
|
||||||
|
@ -128,11 +138,7 @@ enables `doom-popup-mode'."
|
||||||
(doom-popup-mode +1))
|
(doom-popup-mode +1))
|
||||||
window)
|
window)
|
||||||
|
|
||||||
|
;;
|
||||||
(advice-add 'shackle-display-buffer :around 'doom*popup-init)
|
|
||||||
(advice-add 'balance-windows :around 'doom*popups-save)
|
|
||||||
(advice-add 'delete-window :around 'doom*delete-popup-window)
|
|
||||||
|
|
||||||
(defun doom*popup-init (orig-fn &rest args)
|
(defun doom*popup-init (orig-fn &rest args)
|
||||||
"Invokes `doom-popup--init' on windows that qualify as popups. Returns the window."
|
"Invokes `doom-popup--init' on windows that qualify as popups. Returns the window."
|
||||||
(unless (doom-popup-p)
|
(unless (doom-popup-p)
|
||||||
|
@ -164,6 +170,10 @@ prevent popups from messaging up the UI (or vice versa)."
|
||||||
(setq doom-popup-history (list (doom--popup-data window)))))))
|
(setq doom-popup-history (list (doom--popup-data window)))))))
|
||||||
(apply orig-fn args))
|
(apply orig-fn args))
|
||||||
|
|
||||||
|
(advice-add 'shackle-display-buffer :around 'doom*popup-init)
|
||||||
|
(advice-add 'balance-windows :around 'doom*popups-save)
|
||||||
|
(advice-add 'delete-window :around 'doom*delete-popup-window)
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Hacks
|
;; Hacks
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue