Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 738  / 2 Years ago, sun, may 8, 2022, 10:01:40

I'm using a pretty clean install of Ubuntu 20.04 at the moment, finally though to ask this here since it's been bugging me. Is there a way to find out where a launcher entry's .desktop file is at? In my mind, it should be as easy as right-clicking the icon and selecting an option that called Show .desktop file or something like that.


The inspiration for this question comes from me installing the Spotify snap. I need to add a command-line option since Spotify isn't playing nice with my 4K screen and everything is tiny. The problem is, there are three .desktop files and I'm not sure which is the right one.


$ locate *spotify*.desktop
/snap/spotify/53/meta/gui/spotify.desktop
/snap/spotify/53/usr/share/spotify/spotify.desktop
/var/lib/snapd/desktop/applications/spotify_spotify.desktop

Without some experimentation, I don't have a way of knowing which of these is actually associated with the icon I'm seeing in the launcher. I know I could do something silly like remove the icon entry from them one at a time until I find the "real" one, but I feel like there must be an easier way that I don't know about.


More From » gnome

 Answers
5

For daily use, the operating system should not bother you with a "right-clicking menu showing an option that called Show .desktop file or something like that.". Only the system admin should be concerned with this if there is an issue, but anyway, that is a different discussion.


The .desktop launcher that has precedence is the one that is appearing in your menu. The preference is dictated by the XDG_DATA_DIRS environmental variable. Display it with the command


printenv XDG_DATA_DIRS

Folders where .desktop files reside are existing as a folder applications under the folders listed in XDG_DATA_DIRS.


In your example, only one of the listed .desktop files is residing in an applications folder:


/var/lib/snapd/desktop/applications/spotify.desktop

So I can tell right now that that is the one appearing in your menu.


If you would have a second one living in an applications folder, e.g.


/usr/local/share/applications/spotify.desktop

then you can tell which one is in effect by checking which of the folders /var/lib/snapd/desktop or /usr/local/share comes first in the XDG_DATA_DIRS variable.


[#1096] Monday, May 9, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
shadowoof

Total Points: 293
Total Questions: 112
Total Answers: 137

Location: Burkina Faso
Member since Sun, Nov 21, 2021
3 Years ago
;