gnome-terminator / terminator

multiple GNOME terminals in one window
https://gnome-terminator.org
GNU General Public License v2.0
2.09k stars 252 forks source link

Cannot "Drag and Drop" Folders or Files #159

Closed dhasial closed 3 years ago

dhasial commented 4 years ago

Expected behaviour: Drag a file/folder icon and drop it onto Terminator to be able to enter the directory path in Terminator's buffer.

Steps to reproduce: Open terminator in terminal (meta) in order to get the debug output. Then open any file browser and attempt to drag the icon and drop it into Terminator. Get the following error message in the terminal you opened terminator in (still meta).

TypeError: a bytes-like object is required, not 'str' Traceback (most recent call last): File "/usr/lib/python3/dist-packages/terminatorlib/terminal.py", line 1122, in on_drag_data_received txt = txt.split('\n')[0] TypeError: a bytes-like object is required, not 'str'

dugb commented 4 years ago

I can not reproduce this using the latest from master.

Looking at the code, terminal.py lines 1142 and 1145 the decoding from str to bytes is being done.

I can reproduce this using terminator from the debian buster repository, version 1.91

What version of terminator are you using?

mattrose commented 4 years ago

This was fixed a while back in master. see #54 for fix

dhasial commented 4 years ago

Yes thank you, I build from the master instead of using Debian Stable repos and it works!

My only issue with it now is that dragging and dropping a file appends file:// to the beginning of the directory string, which results in Terminator outputting "No such file or directory".

I'm unsure if this is on the OS or Terminator's side, but do you know of a fix / way to remove or prevent this behaviour?

mattrose commented 4 years ago

hmm, shouldn't be doing that. Lemme check

mattrose commented 4 years ago

@Dhamma-valence I was unable to reproduce this. when I drag a file from the Files app in GNOME it just prints out the file name in quotes, not a file url. There is a lot of weird complicated logic around so it's possible that it's not doing the correct the thing in your case. Can you tell me what your desktop environment or window manager is, and what program you're dragging the file from?

im-AMS commented 4 years ago

Hey, I had the same issue of file:// I run manjaro KDE,

I think I have managed to fix it, ill make a pull request, please check it out

Thank you

dhasial commented 4 years ago

I use KDE, with the default Kwin WM on Debian Testing - Krohnkite Kwin tiling script too but that's likely irrelevant.

I think this might be related to another error I was having with something called KIOExec on KDE but I could be wrong.

It wasn't completing some translation between an HTML link in an app and the process that it was directed to (usually Firefox), and gave a similarly URLish output (though I've since fixed it and forgotten what exactly the output was).

mattrose commented 3 years ago

Figured this out. Dolphin sets up the mime type for the selection as text/x-moz-url whereas the GNOME Files program, and others have a mime type as text/plain. Boo.