tecosaur / emacs-everywhere

Mirror of https://git.tecosaur.net/tec/emacs-everywhere
GNU General Public License v3.0
551 stars 56 forks source link

Specify Frame Options #60

Closed theherk closed 2 years ago

theherk commented 2 years ago

I'd like to control how the everywhere frame opens. It seems the eval statement actually launches the frame which means running with /opt/homebrew/bin/emacsclient --eval "(progn (emacs-everywhere) (toggle-frame-maximized))" doesn't work as hoped.

On my macos machine the popup launches mostly off the window every time, and I can't sort how to configure this without access to frame options.

Any help is appreciated.

theherk commented 2 years ago

It seems I can affect size changes this way:

(setq emacs-everywhere-frame-parameters '((name . "emacs-everywhere") (height . 18) (width . 80)))

But positioning directives don't work, and this window is all over the place.

QiangF commented 2 years ago

The position is set in "emacs-everywhere-set-frame-position". The current behavior is relative to the cursor, the frame is barely visible when the cursor is at the bottom edge of the display. Maybe just put the frame at the bottom of the current display.

QiangF commented 2 years ago

I am settled with this:

 (require 'frame-cmds)
 (defun emacs-everywhere-set-frame-position ()
   "Set the size and position of the emacs-everywhere frame."
   (sleep-for 0.02)
   (move-frame-to-screen-bottom 0))
tecosaur commented 2 years ago
 (defun emacs-everywhere-set-frame-position ()
   "Set the size and position of the emacs-everywhere frame."
   (sleep-for 0.02)
   (move-frame-to-screen-bottom 0))

Overriding an existing function like this is quite bad practice. Just remove emacs-everywhere-set-frame-position from emacs-everywhere-init-hooks and add your own function. This sort of difference in personal taste is exactly why that's customisable.

theherk commented 2 years ago

Thanks for the response, @tecosaur. Unfortunately, the contents of this function you mention are precisely what I seek. I'm not sure why this is an invalid question. I'm sure there is a good reason the frame launches out of view every time, but I'm looking for how to resolve that.

tecosaur commented 2 years ago

This is invalid in the sense that it's trying to use emacs-everywhere in a way it's not designed to handle.

Re: the behaviour you're trying to seek:

theherk commented 2 years ago

I suspect I am out of my depth here. I am not directly making any calls to emacs-everywhere-set-frame-position, so I presume it is happening in the doom module somewhere. I'm not sure how to get the behavior where it is on the screen, but that is a shortcoming of mine. Thanks for your time.

tecosaur commented 2 years ago
  • emacs-everywhere-set-frame-position is only run because it is in emacs-everywhere-init-hooks
theherk commented 2 years ago

Just to clarify, when you say "This is invalid in the sense that it's trying to use emacs-everywhere in a way it's not designed to handle," I assume that doesn't mean this is not designed to handle being on screen, but that is actually the only thing I mean to learn. I genuinely not clear on what I've done wrong here.

tecosaur commented 2 years ago

"invalid" because tweaking the created frame properties via --eval is not the way emacs-everywhere has been designed to work.

theherk commented 2 years ago

Cool. Am I barking up the wrong tree then by asking, what is the designed method for having this be on screen?

tecosaur commented 2 years ago

IDK what you mean by "on screen", but:

you can remove emacs-everywhere-set-frame-position from emacs-everywhere-init-hooks and add your own function implementing whatever behaviour you want

theherk commented 2 years ago

By on screen, I simply mean not off the screen as shown here.

Screenshot 2022-08-31 at 19 27 41

Nevertheless, it seems clear that the option is to learn how to write the function you reference. Thank you.

tecosaur commented 2 years ago

Yep, so I'd use that function as a reference and tweak it so it works better for you. If there's a heuristic that you think generally improves the positioning logic, feel free to open a PR :slightly_smiling_face:.