muffinmad / emacs-mini-frame

Show minibuffer in child frame on read-from-minibuffer
GNU General Public License v3.0
321 stars 20 forks source link

Display mini-frame at top of emacs' title bar? #39

Closed jsyjr closed 3 years ago

jsyjr commented 3 years ago

(I run emacs 28.0.50 built with --with-x-toolkit=gtk2.)

I would like to position the mini-frame over the OS window manager's title bar. (OS is Ubuntu 20.10.)

With mini-frame-standalone nil everything works very nicely except that mini-frame obliterates the first line of any Emacs window touching the top of the managed area.

Is this possible with the current package? If so, how? If not, could it be added?

jsyjr commented 3 years ago

Solved it:


(use-package mini-frame
  :straight (:host github :repo "muffinmad/emacs-mini-frame" :files("mini-frame.el"))
  :custom
  (mini-frame-color-shift-step 0)
  (mini-frame-create-lazy nil)
  (mini-frame-internal-border-color "white")
  ;; Overlay "parent" frame's title bar, stretch from left to right edge
  (mini-frame-show-parameters (lambda ()
                                (let ((sf (selected-frame)))
                                  `((user-position . t)
                                    (fullscreen . nil)
                                    (left . ,(+ (frame-parameter sf 'left)
                                                (car (cdr (assq 'external-border-size (frame-geometry sf))))))
                                    (width . ,(frame-parameter sf 'width))
                                    (top   . ,(frame-parameter sf 'top))))))
  (mini-frame-standalone t)) ; Escape parent confines to allow above positioning
muffinmad commented 3 years ago

Solved it:

Cool! I was going to propose exactly the same solution: make the mini-frame standalone and set the left, top and width parameters same as the selected frame :)