CrossCopy / tauri-plugin-clipboard

A Tauri clipboard plugin with text, files, html, RTF, and image support. Clipboard content update monitoring is also supported.
https://crosscopy.github.io/tauri-plugin-clipboard/
MIT License
145 stars 10 forks source link

Ability to support getting app source #30

Open ayangweb opened 4 months ago

ayangweb commented 4 months ago

Hey 👋, this plugin does a really great job, but what about being able to support getting the app source? 🤩

HuakunShen commented 4 months ago

No, I am not sure if there is a system API that allows you to do that.

I have thought about supporting this feature while I was writing a clipboard manager app.

The simplest solution is to record the current frontmost app when clipboard updates.

MacOS has an API to do this https://developer.apple.com/documentation/appkit/nsworkspace/1532097-frontmostapplication

I have a rust crate https://crates.io/crates/applications to do this, but only supports MacOS for now. Still need to figure out how to get active app on windows and linux.

I am not sure if it's a good idea to put this feature in a clipboard plugin if it's not reporting the true source of clipboard content (but a guess).

If you really need this feature, try getting the frontmost application for now.

Other suggestions are welcomed. Let me know if you know how to do this for windows and linux.

ayangweb commented 4 months ago

No, I am not sure if there is a system API that allows you to do that.

I have thought about supporting this feature while I was writing a clipboard manager app.

The simplest solution is to record the current frontmost app when clipboard updates.

MacOS has an API to do this https://developer.apple.com/documentation/appkit/nsworkspace/1532097-frontmostapplication

I have a rust crate https://crates.io/crates/applications to do this, but only supports MacOS for now. Still need to figure out how to get active app on windows and linux.

I am not sure if it's a good idea to put this feature in a clipboard plugin if it's not reporting the true source of clipboard content (but a guess).

If you really need this feature, try getting the frontmost application for now.

Other suggestions are welcomed. Let me know if you know get to do this for windows and linux.

Ok, thanks, I'll try the functionality on macos first and then see how it works on windows.

ayangweb commented 4 months ago

No, I am not sure if there is a system API that allows you to do that.

I have thought about supporting this feature while I was writing a clipboard manager app.

The simplest solution is to record the current frontmost app when clipboard updates.

MacOS has an API to do this https://developer.apple.com/documentation/appkit/nsworkspace/1532097-frontmostapplication

I have a rust crate https://crates.io/crates/applications to do this, but only supports MacOS for now. Still need to figure out how to get active app on windows and linux.

I am not sure if it's a good idea to put this feature in a clipboard plugin if it's not reporting the true source of clipboard content (but a guess).

If you really need this feature, try getting the frontmost application for now.

Other suggestions are welcomed. Let me know if you know how to do this for windows and linux.

I tried the applications plugin, it is very delayed, waiting at least 3s to get the frontmost app, and if it replicates that I switched to another app within a short time, it prints the information of the app I switched to, unfortunately it doesn't work!