In this example, a function will be added to the context menu that allows copying the absolute file path or the path of a directory to the clipboard. The xclip
package is used for this purpose. Alternatively, the xsel
package can be used.
-
Create a
.desktop
file: Create the directory$HOME/.local/share/file-manager/actions/
if it doesn't already exist. This name is expected by LXQt and pcmanfm-qt. Create a file named likecopy-path.desktop
within that directory with the following content:[Desktop Entry] Type=Action Profiles=profile1 Name=Copy path Name[de]=Pfad kopieren Icon=edit-copy [X-Action-Profile profile1] MimeTypes=all/allfiles;inode/directory; Exec=sh -c 'echo -n %f | xclip -selection clipboard'
-
Install
xclip
: Installxclip
if it is not already installed:sudo apt install xclip
- Directory structure: The file must be located in the directory
$HOME/.local/share/file-manager/actions/
. - Dependencies:
xclip
or an alternative must be installed (sudo apt install xclip
).