Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linux .desktop file
#1
So I've been in the process of rebuilding my system from scratch and ran into something strange today.

I'm running Arch/xfce with Whisker Menu. I always had a panel at the top of my screen with some launchers for commonly used programs, gimp being one of them. Well I decided to get rid of the panel and just use Whisker Menu's program search instead which is like how Windows menu works for the uninitiated. Press the windows key and just start typing what you want.

This has been working well until I tried to launch gimp and it didn't return a match. It was trivial to figure out why, as the word gimp wasn't anywhere in the .desktop file, so there was nothing to match. It just struck me funny that it wasn't and I wondered who was in charge of that. I would think that you'd want the single word your program is known by to be somewhere in the name or the description/comment. 

It was easily fixed by adding gimp to the Comment line, but still....

Code:
[Desktop Entry]
Version=1.0
Type=Application
_Name=GNU Image Manipulation Program
_GenericName=Image Editor
_Comment=Create images and edit photographs
# Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
_Keywords=GIMP;graphic;design;illustration;painting;
Exec=@GIMP_COMMAND@ %U
TryExec=gimp-@GIMP_APP_VERSION@
Icon=gimp
Terminal=false
Categories=Graphics;2DGraphics;RasterGraphics;GTK;
StartupNotify=true
MimeType=@MIME_TYPES@
Reply
#2
Interesting. Might be how Gimp is installed in Arch.  The .desktop file in Debian comes with the package, same for flatpak versions.
What does $whereis gimp show?  This in my laptop kubuntu 18.04 
Code:
rich@rich-nova:~$ whereis gimp
gimp: /usr/bin/gimp /usr/lib/gimp /etc/gimp /usr/share/gimp /usr/share/man/man1/gimp.1.gz

but /usr/bin/gimp is a symbolic link to the actual executable gimp-2.10  and the .desktop contains 
Code:
Exec=gimp-2.10 %U
So that is your single word, the binary file which will be equivalent to TryExec=gimp-@GIMP_APP_VERSION@
But the 'other' single word' gimp (the symbolic link) should start from a terminal. 

FWIW On my old netbook, xubuntu 18.04 search gives what looks like a pointer to the .desktop and the actual executable or maybe that is the symbolic link.

   

A bit spoiled in the KDE machines, making .desktop files is really easy. KDE has a comprehensive menu editor.
Reply
#3
Quote:Might be how Gimp is installed in Arch.  The .desktop file in Debian comes with the package, same for flatpak versions.
The .desktop file comes with with the Arch package as well. In fact, I believe it's identical to the source code, other than the one installed has all the different localizations included, but the English entries are the same.

It appears our installations are identical as well.
Code:
$ whereis gimp
gimp: /usr/bin/gimp /usr/lib/gimp /etc/gimp /usr/share/gimp /usr/share/man/man1/gimp.1.gz

$ ls -la /usr/bin/ | grep gimp
lrwxrwxrwx  1 root root               9 Jun  8 03:28 gimp -> gimp-2.10
-rwxr-xr-x  1 root root       9,897,736 Jun  8 03:28 gimp-2.10
lrwxrwxrwx  1 root root              17 Jun  8 03:28 gimp-console -> gimp-console-2.10
-rwxr-xr-x  1 root root       3,738,808 Jun  8 03:28 gimp-console-2.10
-rwxr-xr-x  1 root root          30,544 Jun  8 03:28 gimp-debug-tool-2.0
-rwxr-xr-x  1 root root          18,264 Jun  8 03:28 gimp-test-clipboard-2.0
lrwxrwxrwx  1 root root              12 Jun  8 03:28 gimptool -> gimptool-2.0
-rwxr-xr-x  1 root root          22,352 Jun  8 03:28 gimptool-2.0
lrwxrwxrwx  1 root root               3 Jun  2 03:33 vgimport -> lvm
lrwxrwxrwx  1 root root               3 Jun  2 03:33 vgimportclone -> lvm

What I meant about the "single word", was a user facing name or description. In this context, a word you could search and find the application you were looking for. I know Whisker menu is not the only implementation of a search interface for all programs. I believe Ubuntu Unity uses a similar interface and I'm sure there are more.



So upon a closer look, I realized that the single word was indeed in the .desktop file under Keywords. You would think that would be a searchable field, but Whisker menu could never find it until I added the word "Gimp"  to the Comment field. It always did find the "Run gimp" link like in your example, but I thought it should find the true .desktop file with the app icon after a fresh installation, without having to modify anything.

Now that I am thoroughly intrigued I have been trying to roll back my changes to do more testing but I haven't been able clear the mime-cache properly it seems. When I edited the Comment field before to include the word "Gimp", it created a local copy of the .desktop file with my changes that overrides the system default. /home/akovia/.local/share/applications/gimp.desktop

Even after deleting this file and my attempt to update the mime-cache, 
update-mime-database ~/.local/share/mime 
it still finds gimp every time, so I have no idea how to get back to square 1. What I do know is when it couldn't find gimp from the search, I edited the Comment to read "Gimp Image Editor", and then I could find it. 

I'm in the middle of transferring around a terabyte of data right now or I would try rebooting. I think in the end this may be a Whisker Menu issue and not a gimp issue. As they have the word GIMP listed as a Keyword, it seems Whisker Menu should find it without having to change the Name or Comment fields. In fact, I found another issue already when searching for Kodi. Whisker Menu can't find it even though the Name field is the word "Kodi"

   

Code:
[Desktop Entry]
Version=1.0
Name=Kodi
GenericName=Media Center
GenericName[zh_CN]=媒体中心
Comment=Manage and view your media
Comment[ru]=Просмотр и управление мультимедиа
Comment[zh_CN]=管理和查看您的媒体
Exec=kodi
Icon=kodi
Terminal=false
Type=Application
Categories=AudioVideo;Video;Player;TV;Multimedia;

Actions=Fullscreen;Standalone;

[Desktop Action Fullscreen]
Name=Open in fullscreen
Name[zh_CN]=全屏打开
Exec=kodi -fs

[Desktop Action Standalone]
Name=Open in standalone mode
Name[zh_CN]=在独立模式下打开
Exec=kodi --standalone


I suppose I'll report a Whisker Menu bug. I really want to see what's going on here.
Reply


Forum Jump: