2

I've written a software that runs on Ubuntu.. (18.04 and 20.04 tested). I did not package it, since I'm using Arch linux as well, but wrote an installation script. It copies some files and generates a desktop file which is recognized and can be run if I search it in "Activities".

But I do not see it in the "Select Application" dialog if I right click a video (for which the software has been written) and select "Open with Other Application".

The Desktop file looks like this:

#!/usr/bin/env xdg-open
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=/usr/local/bin/VideoCut 
Name=Video Cut
Comment=MPG4 cutter
Icon=/usr/local/bin/videocut/icons/movie-icon.png
NoDisplay=false
Categories=GTK;AudioVideo
MimeType=video/dv;video/mpeg;video/x-mpeg;video/msvideo;video/quicktime;video/x-anim;video/x-avi;video/x-ms-asf;video/x-ms-wmv;video/x-msvideo;video/x-nsv;video/x-flc;video/x-fli;video/x-flv;video/vnd.rn-realvideo;video/mp4;video/mp4v-es;video/mp2t;application/ogg;application/x-ogg;video/x-ogm+ogg;audio/x-vorbis+ogg;application/x-matroska;audio/x-matroska;video/x-matroska;video/webm;audio/webm;audio/x-mp3;audio/x-mpeg;audio/mpeg;audio/x-wav;audio/x-mpegurl;audio/x-scpls;audio/x-m4a;audio/x-ms-asf;audio/x-ms-asx;audio/x-ms-wax;application/vnd.rn-realmedia;audio/x-real-audio;audio/x-pn-realaudio;application/x-flac;audio/x-flac;application/x-shockwave-flash;misc/ultravox;audio/vnd.rn-realaudio;audio/x-pn-aiff;audio/x-pn-au;audio/x-pn-wav;audio/x-pn-windows-acm;image/vnd.rn-realpix;audio/x-pn-realaudio-plugin;application/x-extension-mp4;audio/mp4;audio/amr;audio/amr-wb;x-content/video-vcd;x-content/video-svcd;x-content/video-dvd;

The desktop file works on Xubuntu (and other XFCE Distros) as well as on Lubuntu & Kubuntu with the corresponding "Select Application" dialogs.

Something is missing in that desktop file, that obviously only gnome needs.

To sum it up:

  1. The application runs
  2. Can be called via "Activities"
  3. Is not available in the "Select Applications" dialog, which is opened via right click on a file.
kanehekili
  • 6,402

1 Answers1

1

Gnome requires that the Exec value contains a placeholder for the file(s) or URL(s). Use %f for a single file and %F for multiple files. See the Desktop Entry Specification for the valid placeholders.

You may also need to run sudo update-desktop-database after your changes to get gnome to pick up on your modifications.

T0xicCode
  • 347
  • 5
  • 15
  • 1
    Yep, I've used %u and it works. So reading your link I'm not quite sure what is the difference between %u and %f . Both seem to work – kanehekili Jun 27 '20 at 21:57
  • 2
    The u placeholders will use urls, so http://some.website/page or file:///path/to/file, whereas the f placeholders will use local file paths /path/to/file. If you pass a url to a desktop file that uses a f placeholder, gnome is supposed to download a local copy of the file and pass the local path to the local copy. – T0xicCode Jun 27 '20 at 22:04
  • Thanks T0xicCode, then %u will be my solution. %u will enable me to use shares as well. – kanehekili Jun 27 '20 at 22:18
  • Thanks T0xicCode ! I just used %F then update-desktop-database to make Notepad++ under Wine in Ubuntu 18.04 default for txt (and others ^-^) files, it works perfectly.

    I searched many times for this issue since months, but as it's a combination of NP++, Wine, .desktop and file association, I never found that solution before today... Should be pinned on an Ubuntu/Wine/NP++ FAQ wiki somewhere !

    – Mutos Jul 08 '20 at 09:26