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

Use currently selected file in Dolphin's terminal

Tags: None
(comma "," separated)
bovender
Registered Member
Posts
40
Karma
0
OS
Hi,

is there any way to reference the currently selected file(s) in Dolphin's terminal panel?

I guess the most natural way to do this was by way of some environment variable, but that is evidently not how it works.

What I would like to to is something like

Code: Select all
exiv2 $F


where `exiv2` is the command that I want to execute, and `$F` holds the selected file(s).
User avatar
pvzh
Registered Member
Posts
24
Karma
1
OS
I couldn't find that exact way. But there are others.

You can add an item to the Dolphin context menu:
https://develop.kde.org/docs/dolphin/service-menus/

You can also transfer the file name via the clipboard:
Code: Select all
exiv2 `xclip -o -selection clipboard | sed 's|file://||'`
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS
Hi!

You can just drag and drop them to insert the filename, but I would really prefer the ServiceMenu-way.
bovender
Registered Member
Posts
40
Karma
0
OS
Thanks for the suggestions. I'm an ardent keyboard user and prefer not to switch between mouse and keyboard as much (if I can), and I need a way to insert the name of the currently selected file for various commands in the terminal -- therefore, my personal favorite is the clipboard method. I created a one-line script in `$HOME/bin/F`:

Code: Select all
#!/bin/bash
xclip -o -selection clipboard | sed 's|file://||'


Now, I can press CTRL+C, F4 and enter

Code: Select all
$ my-command-exiv2-or-whatever `F`


That makes it a lot easier. Thanks again to both of you!


Bookmarks



Who is online

Registered users: Bing [Bot], gfielding, Google [Bot], markhm, sethaaaa, Sogou [Bot], Yahoo [Bot]