GameGodS3 / DropPoint

Make drag-and-drop easier using DropPoint. Drag content without having to open side-by-side windows
https://droppoint.netlify.app/
GNU General Public License v3.0
901 stars 59 forks source link

Add move files mode #9

Open rjcrz88 opened 3 years ago

rjcrz88 commented 3 years ago

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

GameGodS3 commented 3 years ago

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

srijit2002 commented 3 years ago

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

has12zen commented 3 years ago

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

all1000 commented 3 years ago

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

GameGodS3 commented 3 years ago

@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

tyropro commented 2 years ago

Has any advancement on this been made?

GameGodS3 commented 2 years ago

@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

tyropro commented 2 years ago

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

AnuraagReddy123 commented 12 months ago

Hey is there an update on this issue?