You are not logged in.

#1 2017-03-10 16:06:01

jimjamz
Member
From: Nagasaki, Japan
Registered: 2016-04-04
Posts: 189

Files wrapped in single-quotes (') when dragged into terminal windows

When I drag a file from the File Manager into a terminal window, it generates the full path and filename, which is what I would expect it to do.

However, it automatically wraps the whole path within single-quotes (') and adds two line breaks:

jimjamz@bunsen-dev-vm:~$ '/home/jimjamz/path/to/file.txt
> 
> '

macOS terminal does not do this:

mac-pro:~ jimjamz$ /Users/jimjamz/path/to/file.txt

This causes havoc with my shell scripts which expect a file to be dropped into them, so I have to do something like this:

echo "Drop the file here: "
read droppedFile

# have to do this because when dragging in a file it into the terminal
# it appends a ' to the beginning of the outputted filename
echo "The file to be used is: "
actualFile=$(echo $droppedFile | sed 's/'"'"'//g')
echo $actualFile

Is this a bug?

Offline

#2 2017-03-10 16:49:13

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,740

Re: Files wrapped in single-quotes (') when dragged into terminal windows

what OS / file manager / terminal? Certainly not the case here with Stretch/thunar/terminator.

Offline

#3 2017-03-10 17:15:36

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Files wrapped in single-quotes (') when dragged into terminal windows

I get the behaviour with BL/thunar/terminator running in VBox. I will have to reboot to test it on bare metal....

EDIT:  ....no problem with BL-Helium-dev/thunar/terminator.

@OP are you running in a VM?  I guess so - "jimjamz@bunsen-dev-vm"

Last edited by damo (2017-03-10 17:20:31)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#4 2017-03-10 18:31:02

cpoakes
Member
Registered: 2016-12-02
Posts: 108

Re: Files wrapped in single-quotes (') when dragged into terminal windows

Drag-and-drop in jessie from thunar to these terminals:

lxterminal - shows nothing at all
roxterm - full path, single quotes, plus trailing space, no newlines.
xfce4-terminal - full path, no quotes, no spaces, no newlines
xterm - shows nothing at all

Behaviour appears defined by the terminal emulator, sometimes not at all.

If you want a consistent drop target for files, you can create a desktop launcher. It is not difficult, but it is an additional step. Example (basic, not advanced values):

[Desktop Entry]
Version=1.0
Type=Application
Path=
Exec=/home/craig/bin/url-link %u
Icon=url-link
StartupNotify=false
Terminal=false
Name=URL
MimeType=application/x-mswinurl;application/x-desktop

Search for an (XDG) desktop launcher howto for details (or just experiment). My primary hint is to use "Exec=myscript %F" where %F (case sensitive) will be replaced with the file or group of files dropped on the launcher. Use %f for a single file. Similar action for URLs with %U and %u.

Offline

#5 2017-03-11 02:30:08

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,558
Website

Re: Files wrapped in single-quotes (') when dragged into terminal windows

One more terminal:
urxvt - shows nothing at all

A simple workaround is copy/paste instead of drag/drop. In urxvt that gives me the filepath, with no wrapping quotes. Slightly more effort.

I can confirm that cpoakes' .desktop file solution works for passing files to scripts with d&d.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#6 2017-03-11 06:27:20

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Files wrapped in single-quotes (') when dragged into terminal windows

for the script:
reading contents of selection (a.k.a. primary clipboard) could help.
so instead of drag'n'drop, the user would simply have to _highlight_ the file in question.
i think 'xclip -o' should be sufficient.

edit:
no, sorry, that wouldn't work with a graphical filemanager.

Last edited by ohnonot (2017-03-11 06:28:32)

Offline

#7 2017-03-13 13:18:19

jimjamz
Member
From: Nagasaki, Japan
Registered: 2016-04-04
Posts: 189

Re: Files wrapped in single-quotes (') when dragged into terminal windows

Yes, I am running bl-hydrogen in a VirtualBox VM on a macOS host.

Everything on the BunsenLabs guest VM is vanilla standard.  Original file manager and terminal window.

I do have the same version of bunsenlabs installed bare metal onto another laptop but I haven't been able to try it yet.

Really, this should just work out of the box as it's a rather trivial and widely-used bit of functionality, isn't it?

Offline

#8 2017-03-13 13:42:23

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Files wrapped in single-quotes (') when dragged into terminal windows

jimjamz wrote:

Yes, I am running bl-hydrogen in a VirtualBox VM on a macOS host.
...
Really, this should just work out of the box as it's a rather trivial and widely-used bit of functionality, isn't it?

I think you should blame Oracle Guest Additions, since it works OK in BL on bare metal.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#9 2017-03-13 19:29:16

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,740

Re: Files wrapped in single-quotes (') when dragged into terminal windows

jimjamz wrote:

Yes, I am running bl-hydrogen in a VirtualBox VM on a macOS host.

Confirmed with Jessie running as vm on OSX, no such problem with Stretch running as vm on OSX.

Offline

#10 2017-03-14 10:28:22

jimjamz
Member
From: Nagasaki, Japan
Registered: 2016-04-04
Posts: 189

Re: Files wrapped in single-quotes (') when dragged into terminal windows

damo wrote:

I think you should blame Oracle Guest Additions, since it works OK in BL on bare metal.

I'm afraid not, as I replicated the same issue last night on bl-hydrogen, installed bare metal onto an ASUS EEE PC.  Dragging any file into a terminal window does the exact same thing.

Offline

#11 2017-03-15 02:27:55

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,558
Website

Re: Files wrapped in single-quotes (') when dragged into terminal windows

As cpoakes has already pointed out, this is a function of the terminal emulator, not of BunsenLabs. Is there any Linux terminal emulator with the exact behaviour you want? If so, please feel free to suggest it as a replacement for Terminator in our next release. Meanwhile, install and use it.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#12 2017-03-20 09:38:31

jimjamz
Member
From: Nagasaki, Japan
Registered: 2016-04-04
Posts: 189

Re: Files wrapped in single-quotes (') when dragged into terminal windows

brontosaurusrex wrote:

Confirmed with Jessie running as vm on OSX, no such problem with Stretch running as vm on OSX.

When you refer to Jessie and Stretch, do you mean bunsenlabs based on these Debian versions?  Does this mean that the issue I'm having in bl-hydrogen (Jessie) will no longer be an issue in bl-helium (Stretch)?

If so, is that because we're going to be using a different terminal emulator?

Offline

#13 2017-03-20 09:43:19

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,740

Re: Files wrapped in single-quotes (') when dragged into terminal windows

jimjaz: that's right. p.s. Not a different terminal emulator, but a newer version of terminator.

Offline

#14 2017-03-20 09:46:10

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Files wrapped in single-quotes (') when dragged into terminal windows

^ Terminator is still planned to be the default on Helium, although as always there are mutterings to change it. The issue doesn't happen with my BL-Helium-dev + terminator, so take from that what you want! I suspect that the problem is fixed in newer terminator versions.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#15 2017-03-20 10:38:36

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,740

Re: Files wrapped in single-quotes (') when dragged into terminal windows

damo wrote:

there are mutterings to change it.

Any threads on the subject?

Offline

#16 2017-03-20 11:34:40

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Files wrapped in single-quotes (') when dragged into terminal windows

brontosaurusrex wrote:
damo wrote:

there are mutterings to change it.

Any threads on the subject?

Please, absolutely not! There is always pressure to change, but I doubt if there is any appetite to repeat the interminable(!) fight that was had when #! ended. Any terminal emulator is an apt-get away anyway.

If there is to be a change then IMO the devs should just do it unilaterally, because experience shows that there will never be a forum concensus!


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#17 2017-03-20 12:39:16

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,740

Re: Files wrapped in single-quotes (') when dragged into terminal windows

Sure smile

Offline

#18 2017-03-20 13:21:55

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Files wrapped in single-quotes (') when dragged into terminal windows

I almost hope someone starts a thread, so I can move it to Topics Going Nowhere  ]:D


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#19 2017-03-20 14:02:55

iMBeCil
WAAAT?
From: Edrychwch o'ch cwmpas
Registered: 2015-09-29
Posts: 767

Re: Files wrapped in single-quotes (') when dragged into terminal windows


Postpone all your duties; if you die, you won't have to do them ..

Offline

#20 2017-03-21 07:17:10

cpoakes
Member
Registered: 2016-12-02
Posts: 108

Re: Files wrapped in single-quotes (') when dragged into terminal windows

damo wrote:

Please, absolutely not! There is always pressure to change, but I doubt if there is any appetite to repeat the interminable(!) fight that was had when #! ended. Any terminal emulator is an apt-get away anyway.

My opinion exactly. I don't like terminator, remove terminator, and install something else. Yet I fully support defaulting to terminator for consistency. After that last round, I'd say we have a better chance reaching consensus on an official ice cream flavor for BunsenLabs than a terminal.

De gustabus non disputandum est.

Offline

Board footer

Powered by FluxBB