Comments (6)
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.
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.
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.
Nice! I'm glad you've got something working, @tecosaur!
Do you think we should add this example to the README?
from emacs-anywhere.
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.
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)
- Do not hardcore installation directory HOT 3
- Does not work with the freecodecamp editor HOT 2
- Does this work on mojave? HOT 4
- Populate the buffer with the current contents of the textarea HOT 6
- More robust pasting HOT 1
- How to define my keyborad shortcut HOT 1
- README should be more clear about where to put configuration
- Paste not working when there is a physical key pressed HOT 1
- Mac
- Macos HOT 1
- Would you recommend an especific keybinding (shortcut) on macOS?
- Is emacs-anywhere compatible with tiling window managers?
- Is it really necessary to use `C-x 5 0`? Why can't I use classic `C-x C-x` to quit? HOT 2
- Please, package this for NixOS
- Is it possible to configure emacs-anywhere with Karabiner-elements instead of setting a hotkey via the GUI SystemPreferences/keyboard/shortcuts/services/general?
- Feature request: save content of frame on kill ring before it is deletion
- Feature request: bring content already written on the text box to the frame created by Emacs Anywhere
- Thank you
- trouble on ubuntu 22.04
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emacs-anywhere.