dash-to-dock icon indicating copy to clipboard operation
dash-to-dock copied to clipboard

Drag & drop files to open with app

Open mreq opened this issue 12 years ago • 57 comments

As with docky - drag an image over GIMP icon to open that image in GIMP.

Is it possible with gnome-shell? I'd like to tackle that as I'm quite proficient in JS/coffee, but I don't know much about gnome-shell API. No problem on JS/html5 side.

mreq avatar Dec 29 '12 18:12 mreq

Hi,

this is definitely a good feature to implement. I'm not sure if it is easy to do it in a proper way, but I'm confident it's feasible. Unfortunately, Gnome Shell "API" documentation is not so good. The easy way to understand how Gnome Shell works is by reading it's source code. It's mainly javascript. Have a look at http://mathematicalcoffee.blogspot.it/2012/09/gnome-shell-javascript-source.html that gives a brief overview of the different source files. Some library like the Shell Toolkit are well documented instead (http://developer.gnome.org/st/stable/).

Thank you for your interest in helping with the implementation of this feature. I don't have a lot of time to spend doing it, but I can give you some help and advice. I've just had a look at the source code, and it seems that the first step is to capture the drag event on the app icon. This can be done by adding an handleDragHover method for example to the myAppWellIcon class (in the extension file myDash.js). The ActivitiesButton class (it's inside panel.js) does something similar handling the drag of a file over the activities button. Then I'm sure it's possible to launch the correct application making it open the dropped file, though I don't know exactly how at the moment.

Thanks again for you interest in contributing. Let me know if you try to write some code, I'll try to help you as much as I can.

micheleg avatar Dec 31 '12 17:12 micheleg

I'll definitely try that in about a week, once I pass the finals. I am interested in gnome-shell and have some extension ideas. This might be a good start.

mreq avatar Dec 31 '12 17:12 mreq

This is the feature I miss most. All desktops I have used has it: Windows XP, GNOME 2, XFCE. It's so sad that GNOME 3 creators forgot to add this.

psokol avatar Jan 18 '15 19:01 psokol

I really need this feature to keep using Dash to Dock as I throw files around via Filezilla, GIMP, etc... all day long.

Your hard work is appreciated @micheleg :)

ElectricPrism avatar Apr 16 '15 04:04 ElectricPrism

There is one mayor stopping thing: https://bugzilla.gnome.org/show_bug.cgi?id=696321. Support has to be provided upstream first. I did try patching gnome-shell with the patch attached to that bug and got a proof of concept, but can't go on without upstream support.

I have investigated the option of showing the application windows on drag and drop, so that at least you can release the item on an already opened windows. This is technically possible - right now in gnome-shell this can be done going throw the activities button but it's not very handy.

micheleg avatar Apr 16 '15 22:04 micheleg

Thanks for looking up the status of the XDnD implementation, again your hard work is much appreciated bro, keep it up :)

ElectricPrism avatar Apr 27 '15 22:04 ElectricPrism

Hello I'm really looking forward to this feature. When working with a graphic tablet, being able to grab anything and choose which application will open it, with dropping it to the right icon...it speeds up things a lot.

My suggestion would be to show the dock automatically when the user is dragging a file (and preferably highlighting the associated app launchers) to give the user a hint of where the file could/should go.

I understand if this is blocked by current gnome limitations but still hope for a quick fix! And thank you for all the work on this top extension!

corebots avatar Feb 10 '17 10:02 corebots

+1

IzhakJakov avatar Jan 05 '18 02:01 IzhakJakov

I use Dash to Dock on a Wacom MobileStudio Pro 16, a device with no keyboard, so I see the importance of being able to drag a PNG into Krita via the Dock.

I will poke around the upstream bug report, hopefully they can get it sorted and mainlined sometime soon as it improves Touch devices.

ElectricPrism avatar Feb 13 '18 21:02 ElectricPrism

Many would be really grateful if somebody with skills can work on the upstream support! Thanks in advance!

Filbuntu avatar May 04 '18 05:05 Filbuntu

I think I could implement it but this code is salat (sorry). Any chance to refactor the code into a well structured, well-documented one?

fxdave avatar Jul 22 '18 17:07 fxdave

@fxdave @Filbuntu yes the code is messy... extensions are dirty hacks by nature, and the projects has accumulated some dust in 6 years evolving following continuous upstream changes. Could it be better? For sure, but I do not have the resources to do a full refactor :). Pragmatically, the extension is a relatively small pieace of code, and most of the complexity comes from having to effectively live-patch the usptream code anyway. But help is wellcome!

If you are serious about considering working on this (and it would be very appreciated), you would need to look into how the extension interacts with upstream codebase and understand how to hook into it to achieve the desired functionality (which one by the way? How would you inplement this, given the dnd limitations?).

I can provide some guidance.

micheleg avatar Jul 29 '18 15:07 micheleg

@micheleg I can help with refactoring the upstream code if you want to. I don't know what the dnd limitation is, but there is on-drag event in gtk3 so I think it is possible.

EDIT: sorry I didn't read the comments above. So can't we catch on-drag? At least, it is enough without the target, just open the application then it will handle the target.

fxdave avatar Jul 30 '18 06:07 fxdave

I think the sistuation hasn't changed upstram yet: I think we are able to catch the drop but not get information about what you drop. Ideally someone would need to contribute upstream: they have no need for this functionality so it's totally fair for them to not implement this.

micheleg avatar Jul 30 '18 19:07 micheleg

I just imagine this like I drag my photo to the icon to change the window but don't drop in it. It is enough. So drop event is not required. As I think, we can add an event handler to the application icons that will fire if we drag something on top of the icon, so we can start the application or just showup the app window.

fxdave avatar Jul 31 '18 11:07 fxdave

so the problem is that upstream doesn't tell you anything about what you drop ? could you still catch the hover event when dragging, though ? because then we could at least open the window of the hovered application if there's one opened.

vccortez avatar Aug 22 '18 15:08 vccortez

@vekat, @fxdave yes, we could open the window of the application (similarly to what hapen if you drag something into the overview and on top of a window ther).

micheleg avatar Aug 26 '18 16:08 micheleg

Nice! I would be happy, if you explain your code to me. I will make it then. Write me if you want me to make it : [email protected]

fxdave avatar Aug 27 '18 11:08 fxdave

I think a good compromise would be to at least show the overview, like dock to panel does. Do you think it would be possible and easier?

fcole90 avatar Dec 12 '18 19:12 fcole90

I didn't get support, so I had to find another method. Now I'm not using dock. I am just dragging the file with mouse, while I can switch window by pressing alt+tab. It was hard to get used to, but actually the basic gnome concept is good. Without dock we can achieve more space. I use dash only for launching favorite applications with a plugin named "Appkeys". Whit Appkeys, I can launch them by pressing super+ app number in dash. (It's not a negative comment, just a temporary workaround)

fxdave avatar Dec 13 '18 01:12 fxdave

still hoping this will be implemented one day. d&d is so handy when working with a stylus. dash to dock is getting better though, thanks for the work.

corebots avatar Jan 11 '19 13:01 corebots

Any update on this? I desperately wait for this so I can upgrade our second computer to Ubuntu 18.04 (or later) as the rest of the family can not cope with the "alt+tab" workaround and need the drag&drop function. Thanks in advance for all attention and work!

Filbuntu avatar Mar 22 '19 01:03 Filbuntu

Any update on this? I desperately wait for this so I can upgrade our second computer to Ubuntu 18.04 (or later) as the rest of the family can not cope with the "alt+tab" workaround and need the drag&drop function. Thanks in advance for all attention and work!

This hack worked for me: gsettings set org.gnome.nautilus.preferences use-experimental-views false

Source: https://askubuntu.com/a/1090010

gjvnq avatar May 24 '19 01:05 gjvnq

@gjvnq Thank you for your comment! It still does not work for me on Ubuntu 18.04. I tried it with Nautilus and Nemo, also after restarting. With the hack, can you drag a file from Nautilus/Nemo on to the icon of the dock bar and the windows of the corresponding program/app (e.g. email client with email window) open and you can drop the file into the email which would then attach the file to the email?

Filbuntu avatar May 24 '19 07:05 Filbuntu

Dash to Panel in the same situation enables the overview (so like when doing Alt + Tab). A user can then move the cursor over the appropriate window and finally release the file there. I think it's a good workaround until the shell allows for true D&D.

What do you think about it?

fcole90 avatar May 24 '19 09:05 fcole90

@fcole90 Thanks for taking the workaround further. It is an good option if you have a keyboard and mouse working and if you know about it. But most users won't figure it out. Therefore we desperately need a real D&D. Hopefully somebody can work on this soon.

Filbuntu avatar May 24 '19 09:05 Filbuntu

I think I didn't explain it correctly, as it doesn't require the keyboard. Just the mouse or touchpad or whatever you use to move your cursor. You drag the element to the bar, this triggers the overview window, you then drag the item to the window you want, then the window get focus, finally release your item.

It is clearly not as good as D&D, but I think it's as closer as you can get with current APIs, and a good workaround while waiting for them. Also, please, try it for some time, as the way I describe it sounds much more cumbersome then it actually is.

fcole90 avatar May 24 '19 12:05 fcole90

@fcole90 Thanks for the clarification, it sounds a good step into the right direction and much better than nothing! Does this work in Ubuntu 18.04? I tried it but it did not work. I tried with the GNOME extension "Dash to Dock" disabled and enabled. If it works in 18.04, what could be the culprit?

Filbuntu avatar May 24 '19 14:05 Filbuntu

I don't really know, but if I discover it I'll comment back :wink:

fcole90 avatar May 25 '19 04:05 fcole90

@fcole90 Thanks! Does this work in Ubuntu 18.04?

Filbuntu avatar May 25 '19 06:05 Filbuntu