electron-plugin icon indicating copy to clipboard operation
electron-plugin copied to clipboard

Add Clipboard events

Open kirilldakhniuk opened this issue 1 year ago • 2 comments
trafficstars

This PR should add an abilty to fire Clipboard events. If this PR seems reasonable to you please leave a comment and I will create PR for NativePHP Laravel Repo to handle these events. Thanks.

kirilldakhniuk avatar Jun 04 '24 05:06 kirilldakhniuk

How do you intend to use this? Can you explain what you're doing/trying to do?

Also, I'm not sure what the name proceedToNotification is meant to imply... it seems ambiguous to me. Can we come up with a better name?

simonhamp avatar Jul 18 '24 11:07 simonhamp

I was trying to build a clipboard manager. The idea was to listen for clipboard events on Livewire component so I can create a new DB record. Earlier I thought about wire:poll to check if clipboard has value, but it's not a good idea. Could not agree more on naming... But I would think about a better one or might you suggest an option. Surely if you think it's something worth adding.

kirilldakhniuk avatar Jul 18 '24 14:07 kirilldakhniuk

@simonhamp I made changes according to our chat. However I keep enum names plural to be consistent. Let me know if you have any other suggestions. Thanks.

kirilldakhniuk avatar Sep 06 '24 09:09 kirilldakhniuk

I've looked through this with a fresh pair of eyes and I have more concerns...

These clipboard endpoints are used by the Laravel side of the application to read from and write to the clipboard... so in theory, if you're just trying to get event data over into Livewire, you should just be able to fire a custom event from your application that Livewire should pick it up via the native: callsign.

That would prevent this possible infinite loop that I think this implementation could more easily create.

simonhamp avatar Sep 08 '24 18:09 simonhamp

@kirilldakhniuk I'm going to close this for now, as I can't quite fathom how this PR is going to give you what you're after.

I did a bit of digging, and I think what you need isn't available in Electron.

You could implement something like a polling mechanism (e.g. a Scheduled Task in Laravel which checked the clipboard on a regular basis), but I think this is not very performant and would be quite a nasty solution imo.

Sorry for the run-around.

simonhamp avatar Sep 16 '24 12:09 simonhamp

@simonhamp got it. I thought about pulling using a command and felt the same unpleasant feeling about it. Thank you.

kirilldakhniuk avatar Sep 16 '24 13:09 kirilldakhniuk