Problem!: Linux .Desktop Files Don't Allow Relative Paths?!

Share
Today I tried to do things the Linux way and was once again disappointed by its pervasively anti-user design.

Unlike Windows, Linux has several commonly used graphical shells (called "desktop environments"), Linux Mint's is Cinnamon. None of them support the ultra-advanced desktop technology of "shortcuts." Instead, it's possible to create symlinks (which aren't as good as an actual shortcut), and you can create executable icons to run applications by (manually) writing .desktop files. This .desktop file format is a standard supported across DE's, which means it's probably the worst possible solution that offers only the minimal set of features that DE's could be bothered to support.

Turns out it doesn't support relative paths, even though symlinks do!

This makes .desktop files absolutely USELESS! for anything that isn't an application installed on the operating system!

Why is Linux like this...

What I Wanted To Do

I was making a GUI in Python using Qt to handle my increasing number of Python CLI scripts, and I needed a way to call main(). For that, I need a shell script to export PYTHONPATH so the module name resolution works in Python. When you double click a .sh file in Nemo, even if it's marked as executable, it asks you whether you want to execute it or not. I don't really mind this behavior, but there is no way to change it.

My 200 IQ genius idea was to just write a .desktop file for the shell script that calls the Python script. That should work perfectly. I set a cool smiley icon, it looks great on Nemo, I double click it and the GUI opens. Perfect!

EXCEPT IT DOESN'T WORK. >:(

For some reason, .desktop files don't support a relative path in Exec. Surely there is absolutely no reason for this restriction? Linux can handle relative symlinks, but relative paths in a .desktop file is too much? Just resolve the path according to the path of the .desktop file. This isn't hard.

HTML can manage this.

SVG can manage this. Inkscape can manage this with images inserted inside documents as links.

Krita can manage this with embedded file layers.

Literally every single program in the history of programs can resolve relative paths! How come .desktop files are so special that they absolutely NEED an absolute path in order to function properly?! This is nonsense!

LET ME DOUBLE CLICK THINGS LINUX!!!

Addendum

Why do I even need to edit .desktop files manually in the first place? It's like 10 fields. Just make a GUI for this.

No, Nemo's property dialog isn't a GUI for this. It can't even create .desktop files by itself, nor does it support editing all fields. Just make a GUI for this.

Literally just make a GUI for everything.

Quotes

The executable program can either be specified with its full path or with the name of the executable only. If no full path is provided the executable is looked up in the $PATH environment variable used by the desktop environment.

https://specifications.freedesktop.org/desktop-entry-spec/latest/exec-variables.html (accessed 2024-11-09)

There is a great answer on StackExchange by Nathaniel M. Beaver about this issue, including several links to bug reports of people wanting this feature, except for setting icons, I want to set the Exec field.

TIL: crippleware is a word. It's certainly apt!

let the man change his relativity for crying out loud, its cripplware

https://unix.stackexchange.com/questions/428992/why-do-freedesktop-desktop-files-not-allow-relative-paths#comment1149175_602736 (access 2024-11-09)

Other Perspectives

A .desktop file that is not intended to go into a standard applications directory is almost entirely useless.

Rodney Dawes [https://lists.freedesktop.org/archives/xdg/2008-September/009962.html] "Fri Sep 26 12:31:13 PDT 2008" (accessed 2024-11-09)

Well, then, I hope they add a ".shortcut" spec to actually implement real actual shortcuts to Linux desktop one day so I don't have to think about using .desktop files for their non-intended purpose!

Comments

Leave a Reply

Leave your thoughts! Required fields are marked *