New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Popup at input cursor #150
Comments
I don't think it's possible to retrieve coordinates of the input cursor position on the screen. Maybe there are some ways, but I am unaware of them. I'll be glad to merge PR which adds it though. For now, maybe setting the popup position to the center will be more convenient for you. |
much required feature 💯 I have seen copyclip2 doing this @p0deje |
It's closed source and ain't free so I can't figure out how to implement it. |
According to these Stack Overflow questions, it may be possible to get the text cursor location using the accessibility API: https://stackoverflow.com/questions/19315250/how-to-find-absolute-value-of-caret-position-in-pixels-using-cocoa-in-macos ...however I'm not sure if these solutions work with the App Sandbox enabled. |
I looked through the answers and the proposed solutions are far from perfect and known not to work in Mail/Safari/non-Cocoa apps. If someone is willing to spend some time playing around with them to see how they work with Sandbox, I'll happily merge a PR with the most reliable solution possible. |
I think as a workaround showing at the center of currently active window is fine because text cursor must be in currently active window. |
+1 for showing the popup relative to the active window because that's usually (if not always?) where you want to paste |
The initial attempt to implement this via accessibility failed because App Sandbox blocks the calls, even though the app has accessibility permissions 🤷♂️ See http://www.openradar.me/10961566 for an open ticket. |
In the upcoming version, there will be a "Window center" option that should pop up Maccy centered in the focused application window, falling back to the cursor when no windows can be found. |
I have an implementation which works if sandboxing is disabled (Maccy needs to be manually given the accessibility permissions). https://github.com/weisJ/Maccy/tree/text-cursor Some thoughts: Of course an alternative "solution" is to provide a non-sandboxed build on GitHub for people who feel comfortable using it. Any thoughts? |
Thank you for looking into this even deeper, but I don't want to differentiate between open-source and App Store versions that much. In both scenarios, providing some of the code in a non-sandboxed environment would mean that it would never be accepted in the App Store so two versions would need to be maintained. My goal was always to let people use whatever version they prefer. They could use a free one or support the project by buying the app in the App Store, but creating a deliberate difference between the two versions would defeat the goal. |
I figured as much. I’m running a local build anyway so I’ll just keep my patch in the local version :) |
So there might actually be an option to do this without breaking sandboxing using the |
@weisJ Have you managed to find any examples of how to do so? |
Not yet. I'll look into it once the follow up post with a more in depth explanation is available. |
I use keyboard a lot, mouse cursor is usually far from the input cursor, so I have to look far away from the input cursor
If the popup can show right under input cursor, it will be much more convenient
I think mouse cursor can be used as fallback when no input cursor
The text was updated successfully, but these errors were encountered: