0

I would like to create a simple .desktop file that I can use in place of a default browser that simply copies any clicked url to the clipboard and displays a short confirming message. I have written this desktop entry but am having some problems with it...

[Desktop Entry]
Name=urltoclip
Exec=bash -c 'echo %U | xclip -selection c; echo copied url to clipboard!; $SHELL'
Terminal=true
Type=Application
Icon=browser

The .desktop runs from explorer (though without any input to %U doesn't copy anything) but when I set it as the default browser in the system settings and click a link I get the following error:

Unknown error code 100 execvp: Exec format error Please send a full bug report at https://bugs.kde.org

Unknown error code 100 execvp: Exec format error Please send a full bug report at https://bugs.kde.org

I am running kde plasma (within ubuntu-studio) and setting the default browser in the system settings here:

kde plasma system settings showing the applications tab > default applications > web browser set as a custom .desktop file

Anyone have an idea as to what might be the issue here? Thank you for any help.

3
  • The file with extension .desctop is not a program or an executable script. It is a shortcut that needs to be clicked. When you set it as the default browser, it does not run as on one clicks it. Try entering the mycode.desktp or whatever you called it in the terminal as a command and see what happens.
    – user68186
    Jun 6, 2022 at 14:00
  • Ah I see, so I should be using a shell script? I'm not sure how to pass the url from the clicked link to a script when it is set as the default browser (in the same way you would do with '%U' in a .desktop's Exec parameter)
    – Immy
    Jun 6, 2022 at 20:42
  • I have no idea.
    – user68186
    Jun 6, 2022 at 21:03

0

You must log in to answer this question.

Browse other questions tagged .