This forum has been archived. All content is frozen. Please use KDE Discuss instead.

how to copy filename without file://?

Tags: None
(comma "," separated)
User avatar
RazrFalcon
Registered Member
Posts
23
Karma
0
OS
When I copy file in Dolphin, to paste it somewhere as file path, it contains file://. How to remove it? It's realy annoying to delete it each time.

Example:
file:///media/data/shot0016.png

KDE 4.6.95, ArchLinux

PS: sorry for bad english.
User avatar
google01103
Manager
Posts
6668
Karma
25
you are copying the file not the file address
you want to use the right click -> copy path NOT right click -> copy


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
RazrFalcon
Registered Member
Posts
23
Karma
0
OS
I didn't have "right click -> copy path".
User avatar
google01103
Manager
Posts
6668
Karma
25


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
RazrFalcon
Registered Member
Posts
23
Karma
0
OS
It's not what is called a convenience =/
I have many actions in "Actions" menu, and it's really long to find this one.
Is there other way?
I want normal path via ctrl+c, I don't need this prefix.
Thanks.
User avatar
google01103
Manager
Posts
6668
Karma
25
you can look at the command in the service menu and assign it to a custom keyboard shortcut I would assume

remember if you assign this to ctrl+c then you will no longer be able to copy files just the address of the file with it


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
RazrFalcon
Registered Member
Posts
23
Karma
0
OS
I didn't understand.
Can you explain more detail?
Thanks.
User avatar
google01103
Manager
Posts
6668
Karma
25
if you open the copy path service menu (which you dl'ed) you will see that the command it executes to get the path of the file is
qdbus org.kde.klipper /klipper setClipboardContents %U
and if you (can) assign that code to a custom short cut using system-settings -> shortcuts and gestures -> custom shortcuts you should be able to attain what you wish BUT I don't know how to assign a qdbus command to a shortcut so you'll need to Google or post a new request to see how or even if it can be done

other options might be:

1) create a custom action in klipper to automatically strip the "file://" using regular expressions

2) create a custom paste shortcut that strips the "file://" in sysytemsettings -> shortcuts & gestures -> custom shortcuts


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
RazrFalcon
Registered Member
Posts
23
Karma
0
OS
Thanks, but:
1) Klipper works, but it change spaces " " to "%20" without a reason.
And after each Ctrl+C I get this window:
Image
How to disable it?
2) About other methods: I didn't know/found how to paste text from klipper.

Example:
Code: Select all
#!/bin/bash
clip="`qdbus org.kde.klipper /klipper  org.kde.klipper.klipper.getClipboardContents`"
clip_new="`echo "$clip" | sed 's/file:\/\///g'`"
qdbus org.kde.klipper /klipper  org.kde.klipper.klipper.setClipboardContents "$clip_new"
#and here I need to paste text


PS: In Nautilus/Explorer it's works fine. Why such simple and usable thing didn't works in Dolphin ???
User avatar
google01103
Manager
Posts
6668
Karma
25
1) maybe "automatic" is not checked in the action properties? or maybe actions are not automatic only the popup to execute them are?

2) ctrl+v or right_click+paste will paste the current contents of the clipboard

fyi "%20" is a space in url coding

maybe you should create a new thread like "how to automatically remove text string in ctrl+c contents (or kilpper)"

worst case you can run Nautilus under KDE use it if you wish


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
RazrFalcon
Registered Member
Posts
23
Karma
0
OS
I set "automatic" everywhere, but it still showing this popup.

>>worst case you can run Nautilus under KDE use it if you wish
Thanks, but no. =)
User avatar
toad
Global Moderator
Posts
1258
Karma
7
OS
fwiw - whenever I use dolphin for copying files I select whatever I need and make use of the universal CTRL+C/V/X keyboard shortcuts. Either that or drag and drop...


Debian testing
User avatar
RazrFalcon
Registered Member
Posts
23
Karma
0
OS
Yes. But I need this to copy file names(paths), not files.
User avatar
toad
Global Moderator
Posts
1258
Karma
7
OS
Oh, sorry... I use the command line for that sort of stuff. Not sure whether Dolphin (or any other file manager for that matter) is designed for the kind of use you are talking about.

You may find yakuake of interest, very nice terminal emulator :)


Debian testing
User avatar
RazrFalcon
Registered Member
Posts
23
Karma
0
OS
I use F4 to show terminal in Dolphin, and then start ls, to show file paths.

So, as I understand, Dolphin can't do what I want, pity.
Now time for brainshtorm ideas. ;)

Still, thanks all for helping.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], rockscient, Yahoo [Bot]