ish icon indicating copy to clipboard operation
ish copied to clipboard

Drag and drop support

Open arguiot opened this issue 5 years ago • 9 comments

Hello 👋,
I believe that adding support of drag and drop to iSH would be great. Here is how and why: when you work on a file or directory (of a website for example) and you need to compile the code inside the folder; you can simply drag and drop the folder as a ZIP (or possibly another format) on the TerminalView and it's getting copied to the current directory on iSH.
Once you've finished, you can drag the folder icon on the bar sitting on top of the keyboard to your other app, and you can continue on the other app.

I think it would make iSH a bit more "desktop-like", as you can already drag and drop on a terminal.

arguiot avatar Mar 08 '19 06:03 arguiot

That sounds annoying to implement, but potentially quite useful. Among the difficulties: finding the current directory is hard, actual terminals put the file in a temporary directory and paste the path.

tbodt avatar Mar 08 '19 06:03 tbodt

It can be simplified by just copying the folder / file to the ~ folder, and inserting its path on the input

arguiot avatar Mar 08 '19 06:03 arguiot

What if there's already a file with that name? What if the user doesn't want their home directory to get cluttered up? What if the user has deleted their home directory for whatever reason?

tbodt avatar Mar 08 '19 06:03 tbodt

For the file name problem, it's easy to do what every other file system does: appending a -2 to the file name. And the other questions can be solved by adding a "default drop path" options in the About view

arguiot avatar Mar 08 '19 06:03 arguiot

Adding a default drop path setting doesn't solve the problem of the directory not existing, and adding -2 is kinda disgusting to me.

How about there's a directory created in the root, /ios, and drag/drop files go in uniquely named subdirectories of /ios/dnd? /ios would also be a good place to put files shared through the share sheet, etc.

tbodt avatar Mar 08 '19 07:03 tbodt

This is an excellent idea 💡

arguiot avatar Mar 08 '19 07:03 arguiot

@tbodt I know it's an old issue, but I would really like to implement drag and drop into your app. Could you just tell where can I start implementing a such thing. Especially the /ios part (how can this directory be created?). For the drag and drop part, I think I can totally do it without help

arguiot avatar Jun 17 '19 09:06 arguiot

In the AppDelegate.m there's a generic_mkdirat call to create /dev/pts if it doesn't exist. You can do the same thing to create /ios and /ios/dnd.

tbodt avatar Jun 17 '19 15:06 tbodt

@arguiot did you find some time to look at the implementation? Even if it's a stub - could you publish it?

dumblob avatar Oct 11 '21 20:10 dumblob