DropPoint icon indicating copy to clipboard operation
DropPoint copied to clipboard

Add move files mode

Open rjcrz88 opened this issue 3 years ago • 9 comments

Add move mode for dropping files (instead of just copying files), that would be great if added :)

rjcrz88 avatar Sep 29 '21 09:09 rjcrz88

I have only read that Electron API's drag-and-drop can copy files. So to implement a move, we might have to delete the source after the copy was successful. Pretty sure that can be done by adding a function for deleting on completion.

Marking this as a good first issue, especially since Hacktoberfest is round the corner. Thank you, Cheers

GameGodS3 avatar Sep 29 '21 09:09 GameGodS3

@GameGodS3 I want to work on this issue. Can you please guide me?

srijit2002 avatar Sep 30 '21 08:09 srijit2002

hi, @srijit2002 if you would like we can work on this together.

has12zen avatar Sep 30 '21 08:09 has12zen

Thanks for the great app...I wish if you add Cut Instead of deleting mannuly ... it's important

all1000 avatar Sep 30 '21 10:09 all1000

@srijit2002 @has12zen Maybe use this as a starting point. https://stackoverflow.com/questions/55328916/electron-run-shell-commands-with-arguments

Considering @all1000 's request since on further thought it makes more sense, I think if you both could modify the drag function of the existing app to instead execute a copy command. When required, copy can be replaced with a move.

Remember to write code for all three platforms (Windows, Mac and Linux) when coding the solution. Cheers

GameGodS3 avatar Sep 30 '21 12:09 GameGodS3

Has any advancement on this been made?

tyropro avatar Oct 01 '22 09:10 tyropro

@tyropro Thanks for asking.

Lemme tell you the progress, so to speak, so far. We were initially planning on executing shell commands to move files when a dragout happens. Although we haven't completely ruled out the possibility of implementing it that way, I thought it would be better to implement it in a way that I came across in an article.

I stumbled upon this while I was looking at native approaches for drag-and-drop in electron. https://www.fileside.app/blog/2019-04-22_fixing-drag-and-drop/

In a very simplified summary, what's mentioned in the article is that we could use C++ modules to run along with the electron process so that it becomes easier to use native system calls provided by the OSs in C++ (which is much more easily accessible than it is for JavaScript).

Why I, personally, think this is the better idea is because of the upcoming features that could be added to DropPoint. This includes the aforementioned move mode, holding Shift for copy - alt for shorcut - ctrl for move, a mouse-shake gesture for opening DropPoint, using native thumbnails for files rather than custom icons, etc... These are better implemented in C++ and therefore having a start at it through this would be nice.

However, this approach comes with some pretty substantial caveats. Firstly, often times the documentation for such native modules are pretty sparse (*cough Win... *cough ....dows). Secondly, doing so would require extra effort for writing custom modules for Windows, MacOS and Linux (and its gazillion varieties) separately, which would be a huge overhead. There might be more caveats, but these two were what I could pull out of my head as I write this.

I am also considering to contribute to the actual Electron project itself so that these changes may just directly come from the framework which is much more convenient, and could help a lot more people too.

I am only still learning this method. So far, I am exploring node-gyp and how to use it. And I would love to have some company of others who could learn these and discuss about them together here. So if you (or anyone reading this) is interested in taking up this task, please feel free.

Cheers

GameGodS3 avatar Oct 01 '22 18:10 GameGodS3

Thanks for the update. I'm unable to help (sorry) and I hope this can be implemented into electron in the future. Good luck :)

tyropro avatar Oct 01 '22 20:10 tyropro