TermiT / Flycut

Clean and simple clipboard manager for developers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disable Fly Cut in Certain Applications

build3r opened this issue · comments

Is there a way to disable flycut in certain application.
Ex. I use cmfd+shift+v is android studio which has its own clipboard manager and I want to keep using it there. And I want to use FlyCut everywhere else.
Is there any way we can override flycut via automator or keyboard services?

This might be achievable by adding an active-application observer (you can get notified when the active app switches, I think it is in NSNotificationCenter, and I think the notification might even tell you the app so you don’t have to do other weird searches like we already do to find the active app). Then whenever the active app changes call pollPB (bypassing the once-per-second polling and all of the room for false positives / negatives that timing window brings with it) and store the path or bundleId of the active app to a property. Then in pollPB use that property to check against a block-list and also to replace the current scan for the active app.

Then on the way out of each app FlyCut will make one last check for new clippings, save them if not block-listed or filter them out if block-listed. When the 1-second timer then fires it’ll see nothing new.

Hope this helps. It’d make the password-manager folks happy too. :-) I just hadn’t thought about this angle on it in the decade since I added some of these features until now when other projects have taken me through app detection.
Mark

Nope. That doesn't work. In testing with the solution described above, it is far too easy to Command-C and then Command-Tab faster than a new entry can appear in the pasteboard. This isn't something our app can fix. macOS simply has some latency between the copy starting and the copy being available to any other app, and in within that latency it is realistic that the user could switch apps. The risk of a user believing that FlyCut won't observe from a certain app when actually it does, or of FlyCut failing to observe a clipping that a user is devastated to lose is just unacceptable.

If someone wanted to hack it into the code for personal use and accept the risk, it would be easy to do, but it's not something appropriate for inclusion in a build used by other people given that it doesn't work as advertised.

A more-reliable, though not automatic, solution would be to use the Option-Click on the FlyCut menu to disable and enable FlyCut.

Sorry there isn't a better solution. There just simply isn't a way on macOS to reliably associate the active application with a clipping.
Mark

No worries whatsoever - at first I thought there was some option that I was missing.

Sounds to me like the solution would be very heavily involved and not worth the effort. What I did to work around the problem described in thread was to rewire the keybind for FlyCut to alt + shift + v instead of cmd + shift + v. And that is perfectly fine.

Thanks a lot for giving it a go @MarkJerde !

PS: Can probably close this.