mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-27 10:36:12 +01:00
2.7 KiB
2.7 KiB
Helm
(use-package helm
:straight t
:disabled t
:config
(defun my-helm-display-frame-center (buffer &optional resume)
"Display `helm-buffer' in a separate frame which centered in parent frame."
(if (not (display-graphic-p))
;; Fallback to default when frames are not usable.
(helm-default-display-buffer buffer)
(setq helm--buffer-in-new-frame-p t)
(let* ((parent (selected-frame))
(frame-pos (frame-position parent))
(parent-left (car frame-pos))
(parent-top (cdr frame-pos))
(width (/ (frame-width parent) 2))
(height (/ (frame-height parent) 3))
tab-bar-mode
(default-frame-alist
(if resume
(buffer-local-value 'helm--last-frame-parameters
(get-buffer buffer))
`((parent . ,parent)
(width . ,width)
(height . ,height)
(parent-frame . nil)
(undecorated . ,helm-use-undecorated-frame-option)
(left-fringe . 0)
(right-fringe . 0)
(tool-bar-lines . 0)
(line-spacing . 0)
(desktop-dont-save . t)
(no-special-glyphs . t)
(inhibit-double-buffering . t)
(tool-bar-lines . 0)
(left . ,(+ parent-left (/ (* (frame-char-width parent) (frame-width parent)) 4)))
(top . ,(+ parent-top (/ (* (frame-char-width parent) (frame-height parent)) 6)))
(title . "Helm")
(vertical-scroll-bars . nil)
(menu-bar-lines . 0)
(fullscreen . nil)
(visible . ,(null helm-display-buffer-reuse-frame))
;; (internal-border-width . ,(if IS-MAC 1 0))
)))
display-buffer-alist)
(set-face-background 'internal-border (face-foreground 'default))
(helm-display-buffer-popup-frame buffer default-frame-alist))
(helm-log-run-hook 'helm-window-configuration-hook)))
(defun magic-rb/exwm-helm-at-bottom ()
(setq helm-split-window-in-side-p t)
(add-to-list 'display-buffer-alist
'("\\`\\*helm.*\\*\\'"
(display-buffer-in-side-window)
(inhibit-same-window . t)
(window-height . 0.4)))
(setq helm-swoop-split-with-multiple-windows nil
helm-swoop-split-direction 'split-window-vertically
helm-swoop-split-window-function 'helm-default-display-buffer))
(unless (string= (getenv "EXWM") "1") (setq helm-display-function 'my-helm-display-frame-center))
(when (string= (getenv "EXWM") "1") (magic-rb/exwm-helm-at-bottom))
(setq helm-display-buffer-reuse-frame t
helm-display-buffer-width 80)
(helm-mode)
:bind (("M-x" . helm-M-x)
("C-x r b" . helm-filtered-bookmarks)
("C-x C-f" . helm-find-files)
("C-x b" . helm-buffers-list)))
; <<helm-bufler>>