Add 'Copy Path' context menu item to Dolphin

Published on Nov 10, 2020

Arxiv Link:


Reading time: 0 minutes.

This is for KDE5 with Dolphin as the file manager.

First we need to install xclip:

sudo apt-get install xclip

Next we then need create a desktop file at the following path: ~/.local/share/kservices5.

You may need to create the above directory.

Then run:

sudo nano ~/.local/share/kservices5/copy-path.desktop

Paste in the following:

[Desktop Action copy-path]
Exec=echo "%U" | tr -d '\n' | xclip -selection clipboard
Name=Copy Path
Icon=edit-copy

[Desktop Entry]
Actions=copy-path
ServiceTypes=KonqPopupMenu/Plugin
MimeType=all/all
Type=Service
X-KDE-Priority=TopLevel

Finally restart dolphin, a top level context menu should appear when you right click on a file, to copy its absolute path.