fix(exwm): more posframe shenanigans

This commit is contained in:
Pavel Korytov 2022-02-17 22:57:31 +03:00
parent 78447d4749
commit 00ca2648ed
2 changed files with 44 additions and 18 deletions

View file

@ -256,9 +256,10 @@ DIR is either 'left or 'right."
:config :config
(setq ivy-posframe-parameters '((left-fringe . 10) (setq ivy-posframe-parameters '((left-fringe . 10)
(right-fringe . 10) (right-fringe . 10)
(parent-frame . nil))) (parent-frame . nil)
(max-width . 80)))
(setq ivy-posframe-height-alist '((t . 20))) (setq ivy-posframe-height-alist '((t . 20)))
(setq ivy-posframe-min-width 160) (setq ivy-posframe-width 180)
(setq ivy-posframe-min-height 5) (setq ivy-posframe-min-height 5)
(setq ivy-posframe-display-functions-alist (setq ivy-posframe-display-functions-alist
'((swiper . ivy-display-function-fallback) '((swiper . ivy-display-function-fallback)
@ -277,14 +278,26 @@ DIR is either 'left or 'right."
(advice-add #'ivy-posframe--read :around #'my/advise-fn-suspend-follow-mouse) (advice-add #'ivy-posframe--read :around #'my/advise-fn-suspend-follow-mouse)
(defun my/setup-posframe (posframe) (defun my/setup-posframe (&rest args)
(with-selected-frame posframe (mapc
(setq-local exwm-workspace-warp-cursor nil) (lambda (var)
(setq-local mouse-autoselect-window nil) (kill-local-variable var)
(setq-local focus-follows-mouse nil)) (setf (symbol-value var) nil))
posframe) '(exwm-workspace-warp-cursor
mouse-autoselect-window
focus-follows-mouse)))
(advice-add #'posframe--create-posframe :filter-return #'my/setup-posframe) (defun my/restore-posframe (&rest args)
(mapc
(lambda (var)
(kill-local-variable var)
(setf (symbol-value var) t))
'(exwm-workspace-warp-cursor
mouse-autoselect-window
focus-follows-mouse)))
(advice-add #'posframe--create-posframe :after #'my/setup-posframe)
(advice-add #'ivy-posframe-cleanup :after #'my/restore-posframe)
(defun my/counsel-linux-app-format-function (name comment _exec) (defun my/counsel-linux-app-format-function (name comment _exec)
(format "% -45s%s" (format "% -45s%s"

View file

@ -752,9 +752,10 @@ Take a look at [[https://github.com/ch11ng/exwm/issues/550][this issue]] in the
:config :config
(setq ivy-posframe-parameters '((left-fringe . 10) (setq ivy-posframe-parameters '((left-fringe . 10)
(right-fringe . 10) (right-fringe . 10)
(parent-frame . nil))) (parent-frame . nil)
(max-width . 80)))
(setq ivy-posframe-height-alist '((t . 20))) (setq ivy-posframe-height-alist '((t . 20)))
(setq ivy-posframe-min-width 160) (setq ivy-posframe-width 180)
(setq ivy-posframe-min-height 5) (setq ivy-posframe-min-height 5)
(setq ivy-posframe-display-functions-alist (setq ivy-posframe-display-functions-alist
'((swiper . ivy-display-function-fallback) '((swiper . ivy-display-function-fallback)
@ -781,14 +782,26 @@ Take a look at [[https://github.com/ch11ng/exwm/issues/550][this issue]] in the
Not sure about that. The cursor occasionally changes focus when I'm exiting posframe, and this doesn't catch all the cases. Not sure about that. The cursor occasionally changes focus when I'm exiting posframe, and this doesn't catch all the cases.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun my/setup-posframe (posframe) (defun my/setup-posframe (&rest args)
(with-selected-frame posframe (mapc
(setq-local exwm-workspace-warp-cursor nil) (lambda (var)
(setq-local mouse-autoselect-window nil) (kill-local-variable var)
(setq-local focus-follows-mouse nil)) (setf (symbol-value var) nil))
posframe) '(exwm-workspace-warp-cursor
mouse-autoselect-window
focus-follows-mouse)))
(advice-add #'posframe--create-posframe :filter-return #'my/setup-posframe) (defun my/restore-posframe (&rest args)
(mapc
(lambda (var)
(kill-local-variable var)
(setf (symbol-value var) t))
'(exwm-workspace-warp-cursor
mouse-autoselect-window
focus-follows-mouse)))
(advice-add #'posframe--create-posframe :after #'my/setup-posframe)
(advice-add #'ivy-posframe-cleanup :after #'my/restore-posframe)
#+end_src #+end_src
*** Linux app *** Linux app
=counsel-linux-app= is a counsel interface to select a Linux desktop application. =counsel-linux-app= is a counsel interface to select a Linux desktop application.