feat(desktop): remove ivy-posframe

This commit is contained in:
Pavel Korytov 2022-04-14 12:32:54 +03:00
parent a1eef2a025
commit efe1aadaa1
2 changed files with 32 additions and 27 deletions

View file

@ -253,6 +253,7 @@ DIR is either 'left or 'right."
(use-package ivy-posframe
:straight t
:disabled
:config
(setq ivy-posframe-parameters '((left-fringe . 10)
(right-fringe . 10)
@ -275,8 +276,8 @@ DIR is either 'left or 'right."
(apply fn args)
(x-set-mouse-absolute-pixel-position (car pos)
(cdr pos)))))
(advice-add #'ivy-posframe--read :around #'my/advise-fn-suspend-follow-mouse)
(with-eval-after-load 'ivy-posframe
(advice-add #'ivy-posframe--read :around #'my/advise-fn-suspend-follow-mouse))
(defun my/setup-posframe (&rest args)
(mapc
@ -290,7 +291,6 @@ DIR is either 'left or 'right."
(defun my/restore-posframe (&rest args)
(run-with-timer
0.25
nil
(lambda ()
(mapc
(lambda (var)
@ -300,8 +300,9 @@ DIR is either 'left or 'right."
mouse-autoselect-window
focus-follows-mouse)))))
(advice-add #'posframe--create-posframe :after #'my/setup-posframe)
(advice-add #'ivy-posframe-cleanup :after #'my/restore-posframe)
(with-eval-after-load 'ivy-posframe
(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)
(format "% -45s%s"
@ -406,7 +407,7 @@ _d_: Discord
(setq mouse-autoselect-window t)
(setq focus-follows-mouse t)
(setq exwm-input-prefix-keys
`(?\C-x
?\C-w
@ -414,7 +415,7 @@ _d_: Discord
?\M-u))
(defmacro my/app-command (command)
`(lambda () (interactive) (my/run-in-background ,command)))
(general-define-key
:keymaps '(exwm-mode-map)
"C-q" #'exwm-input-send-next-key
@ -429,46 +430,46 @@ _d_: Discord
`(
;; Reset to line-mode
(,(kbd "s-R") . exwm-reset)
;; Switch windows
(,(kbd "s-<left>") . (lambda () (interactive) (my/exwm-windmove 'left)))
(,(kbd "s-<right>") . (lambda () (interactive) (my/exwm-windmove 'right)))
(,(kbd "s-<up>") . (lambda () (interactive) (my/exwm-windmove 'up)))
(,(kbd "s-<down>") . (lambda () (interactive) (my/exwm-windmove 'down)))
(,(kbd "s-h"). (lambda () (interactive) (my/exwm-windmove 'left)))
(,(kbd "s-l") . (lambda () (interactive) (my/exwm-windmove 'right)))
(,(kbd "s-k") . (lambda () (interactive) (my/exwm-windmove 'up)))
(,(kbd "s-j") . (lambda () (interactive) (my/exwm-windmove 'down)))
;; Moving windows
(,(kbd "s-H") . (lambda () (interactive) (my/exwm-move-window 'left)))
(,(kbd "s-L") . (lambda () (interactive) (my/exwm-move-window 'right)))
(,(kbd "s-K") . (lambda () (interactive) (my/exwm-move-window 'up)))
(,(kbd "s-J") . (lambda () (interactive) (my/exwm-move-window 'down)))
;; Fullscreen
(,(kbd "s-f") . exwm-layout-toggle-fullscreen)
(,(kbd "s-F") . exwm-floating-toggle-floating)
;; Quit
(,(kbd "s-Q") . my/exwm-quit)
;; Split windows
(,(kbd "s-s") . evil-window-vsplit)
(,(kbd "s-v") . evil-window-hsplit)
;; Switch perspectives
(,(kbd "s-,") . persp-prev)
(,(kbd "s-.") . persp-next)
;; Switch buffers
(,(kbd "s-e") . persp-ivy-switch-buffer)
(,(kbd "s-E") . my/persp-ivy-switch-buffer-other-window)
;; Resize windows
(,(kbd "s-r") . my/exwm-resize-hydra/body)
;; Apps & stuff
(,(kbd "s-p") . counsel-linux-app)
(,(kbd "s-P") . async-shell-command)
@ -476,24 +477,24 @@ _d_: Discord
(,(kbd "s--") . password-store-ivy)
(,(kbd "s-=") . my/emojify-type)
(,(kbd "s-i") . ,(my/app-command "copyq menu"))
;; Basic controls
(,(kbd "<XF86AudioRaiseVolume>") . ,(my/app-command "ponymix increase 5 --max-volume 150"))
(,(kbd "<XF86AudioLowerVolume>") . ,(my/app-command "ponymix decrease 5 --max-volume 150"))
(,(kbd "<XF86MonBrightnessUp>") . ,(my/app-command "light -A 5"))
(,(kbd "<XF86MonBrightnessDown>") . ,(my/app-command "light -U 5"))
(,(kbd "<XF86AudioMute>") . ,(my/app-command "ponymix toggle"))
(,(kbd "<XF86AudioPlay>") . ,(my/app-command "mpc toggle"))
(,(kbd "<XF86AudioPause>") . ,(my/app-command "mpc pause"))
(,(kbd "<print>") . ,(my/app-command "flameshot gui"))
;; Switch workspace
(,(kbd "s-q") . my/exwm-switch-to-other-monitor)
(,(kbd "s-w") . exwm-workspace-switch)
(,(kbd "s-W") . exwm-workspace-move-window)
(,(kbd "s-<tab>") . my/exwm-workspace-switch-monitor)
;; Perspectives
(,(kbd "s-[") . perspective-exwm-cycle-exwm-buffers-backward)
(,(kbd "s-]") . perspective-exwm-cycle-exwm-buffers-forward)
@ -501,7 +502,7 @@ _d_: Discord
(,(kbd "s-<mouse-5>") . perspective-exwm-cycle-exwm-buffers-forward)
(,(kbd "s-`") . perspective-exwm-switch-perspective)
(,(kbd "s-o") . ,(my/app-command "rofi -show window"))
;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9)
,@(mapcar (lambda (i)
`(,(kbd (format "s-%d" i)) .
@ -509,7 +510,7 @@ _d_: Discord
(interactive)
(exwm-workspace-switch-create ,i))))
(number-sequence 0 9))))
(defun exwm-input--fake-last-command ()
"Fool some packages into thinking there is a change in the buffer."
(setq last-command #'exwm-input--noop)

View file

@ -746,9 +746,12 @@ Setting up some completion interfaces that fit particularly well to use with EXW
Take a look at [[https://github.com/ch11ng/exwm/issues/550][this issue]] in the EXWM repo about setting it up.
Edit <2022-04-09 Sat>: This looks nice, but unfortunately too unstable. Disabling it.
#+begin_src emacs-lisp
(use-package ivy-posframe
:straight t
:disabled
:config
(setq ivy-posframe-parameters '((left-fringe . 10)
(right-fringe . 10)
@ -775,8 +778,8 @@ Take a look at [[https://github.com/ch11ng/exwm/issues/550][this issue]] in the
(apply fn args)
(x-set-mouse-absolute-pixel-position (car pos)
(cdr pos)))))
(advice-add #'ivy-posframe--read :around #'my/advise-fn-suspend-follow-mouse)
(with-eval-after-load 'ivy-posframe
(advice-add #'ivy-posframe--read :around #'my/advise-fn-suspend-follow-mouse))
#+end_src
**** Disable changing focus
Not sure about that. The cursor occasionally changes focus when I'm exiting posframe, and this doesn't catch all the cases.
@ -803,8 +806,9 @@ Not sure about that. The cursor occasionally changes focus when I'm exiting posf
mouse-autoselect-window
focus-follows-mouse)))))
(advice-add #'posframe--create-posframe :after #'my/setup-posframe)
(advice-add #'ivy-posframe-cleanup :after #'my/restore-posframe)
(with-eval-after-load 'ivy-posframe
(advice-add #'posframe--create-posframe :after #'my/setup-posframe)
(advice-add #'ivy-posframe-cleanup :after #'my/restore-posframe))
#+end_src
*** Linux app
=counsel-linux-app= is a counsel interface to select a Linux desktop application.