Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag & drop files to open with app #49

Open
mreq opened this issue Dec 29, 2012 · 33 comments
Open

Drag & drop files to open with app #49

mreq opened this issue Dec 29, 2012 · 33 comments

Comments

@mreq
Copy link

@mreq mreq commented Dec 29, 2012

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.

@micheleg

This comment has been minimized.

Copy link
Owner

@micheleg micheleg commented Dec 31, 2012

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.

@mreq

This comment has been minimized.

Copy link
Author

@mreq mreq commented Dec 31, 2012

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.

@psokol

This comment has been minimized.

Copy link
Contributor

@psokol psokol commented Jan 18, 2015

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.

@ElectricPrism

This comment has been minimized.

Copy link

@ElectricPrism ElectricPrism commented Apr 16, 2015

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 :)

@micheleg

This comment has been minimized.

Copy link
Owner

@micheleg micheleg commented Apr 16, 2015

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.

@ElectricPrism

This comment has been minimized.

Copy link

@ElectricPrism ElectricPrism commented Apr 27, 2015

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

@corebots

This comment has been minimized.

Copy link

@corebots corebots commented Feb 10, 2017

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!

@izhakjakov

This comment has been minimized.

Copy link

@izhakjakov izhakjakov commented Jan 5, 2018

+1

@ElectricPrism

This comment has been minimized.

Copy link

@ElectricPrism ElectricPrism commented Feb 13, 2018

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.

@Filbuntu

This comment has been minimized.

Copy link

@Filbuntu Filbuntu commented May 4, 2018

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

@fxdave

This comment has been minimized.

Copy link

@fxdave fxdave commented Jul 22, 2018

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?

@micheleg

This comment has been minimized.

Copy link
Owner

@micheleg micheleg commented Jul 29, 2018

@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.

@fxdave

This comment has been minimized.

Copy link

@fxdave fxdave commented Jul 30, 2018

@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.

@micheleg

This comment has been minimized.

Copy link
Owner

@micheleg micheleg commented Jul 30, 2018

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.

@fxdave

This comment has been minimized.

Copy link

@fxdave fxdave commented Jul 31, 2018

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.

@vekat

This comment has been minimized.

Copy link

@vekat vekat commented Aug 22, 2018

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.

@micheleg

This comment has been minimized.

Copy link
Owner

@micheleg micheleg commented Aug 26, 2018

@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).

@fxdave

This comment has been minimized.

Copy link

@fxdave fxdave commented Aug 27, 2018

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 : dbiro97@gmail.com

@fcole90

This comment has been minimized.

Copy link

@fcole90 fcole90 commented Dec 12, 2018

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?

@fxdave

This comment has been minimized.

Copy link

@fxdave fxdave commented Dec 13, 2018

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)

@corebots

This comment has been minimized.

Copy link

@corebots corebots commented Jan 11, 2019

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.

@Filbuntu

This comment has been minimized.

Copy link

@Filbuntu Filbuntu commented Mar 22, 2019

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!

@gjvnq

This comment has been minimized.

Copy link

@gjvnq gjvnq commented May 24, 2019

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

@Filbuntu

This comment has been minimized.

Copy link

@Filbuntu Filbuntu commented May 24, 2019

@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?

@fcole90

This comment has been minimized.

Copy link

@fcole90 fcole90 commented May 24, 2019

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?

@Filbuntu

This comment has been minimized.

Copy link

@Filbuntu Filbuntu commented May 24, 2019

@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.

@fcole90

This comment has been minimized.

Copy link

@fcole90 fcole90 commented May 24, 2019

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.

@Filbuntu

This comment has been minimized.

Copy link

@Filbuntu Filbuntu commented May 24, 2019

@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?

@fcole90

This comment has been minimized.

Copy link

@fcole90 fcole90 commented May 25, 2019

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

@Filbuntu

This comment has been minimized.

Copy link

@Filbuntu Filbuntu commented May 25, 2019

@fcole90 Thanks! Does this work in Ubuntu 18.04?

@fcole90

This comment has been minimized.

Copy link

@fcole90 fcole90 commented May 26, 2019

Yes. I just checked and it works, tough a bit slowly, it used to be more reactive. I don't know why it's taking some seconds before triggering the overview 🤔

@Filbuntu

This comment has been minimized.

Copy link

@Filbuntu Filbuntu commented Oct 24, 2019

Any update on this? Real Drag & Drop is dearly missed!

@ZLTM

This comment has been minimized.

Copy link

@ZLTM ZLTM commented Nov 27, 2019

Gonna be the issue 7 birthday soon, any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.