Giter VIP home page Giter VIP logo

Comments (6)

zachcurry avatar zachcurry commented on June 14, 2024

Hi @tecosaur,
I'm glad to hear you are getting some use out of this project.

If I am understanding the issue correctly, it happens because of the way your window manager is configured (i.e., to focus the application which is under your mouse cursor). As it stands now, we don't provide any information about the cursor's position, but if we did, I suspect that you could make use of this information to position the newly created Emacs frame in the manner you have suggested.

At first glance, two possible solutions come to mind. The first solution, which is perhaps suboptimal for your situation, would be to set the position and size of the new frame such that it covers the focused window completely. This would fix the focus problem, but would prevent you from seeing the content of the other window as you work in Emacs. The second solution would be to get the mouse position and use it to position the frame. This could be something you do on your end within your hook function, or, if you think you could extend this project to help facilitate this use case without any breaking changes, code it up and submit a pull request.

Thanks for bringing this issue to our attention, @tecosaur. I wish I had a better answer for you. Let me know if you find a satisfactory solution, or if you have anymore questions.

from emacs-anywhere.

tecosaur avatar tecosaur commented on June 14, 2024

Hmm. I've had a look and this seems useful. Perhaps we could add some some env vars like EA_MOUSE_X?

$ xdotool getmouselocation --shell
X=1015
Y=688
SCREEN=0
WINDOW=132120581

from emacs-anywhere.

tecosaur avatar tecosaur commented on June 14, 2024

The second solution would be to get the mouse position and use it to position the frame. This could be something you do on your end within your hook function

Well, I've managed to get it working with

(let* ((mousepos (split-string (shell-command-to-string "xdotool getmouselocation | sed -E \"s/ screen:0 window:[^ ]*|x:|y://g\"")))
         (mouse-x (- (string-to-number (nth 0 mousepos)) 100))
         (mouse-y (- (string-to-number (nth 1 mousepos)) 50)))
  (set-frame-position (selected-frame) mouse-x mouse-y))

So I'll close the issue for now :)

from emacs-anywhere.

zachcurry avatar zachcurry commented on June 14, 2024

Nice! I'm glad you've got something working, @tecosaur!

Do you think we should add this example to the README?

from emacs-anywhere.

tecosaur avatar tecosaur commented on June 14, 2024

I'm not sure if it's a common 'issue', but I know that I personally prefer the positioning; simply on the basis that my attention is usually around where the cursor currently is.

As to whether it would benefit the readme, I'll leave you to judge :)

from emacs-anywhere.

zachcurry avatar zachcurry commented on June 14, 2024

For now, I'll keep this issue in the back of my mind. If we get more questions like this, I'll definitely throw it in the README.

Thanks again for bringing this to everyone's attention and for sharing your solution.

from emacs-anywhere.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.