Friday, September 29, 2023
 Popular · Latest · Hot · Upcoming
rated 0 times [  4] [ 0]  / answers: 1 / hits: 12849  / 9 Months ago, tue, january 10, 2023, 2:27:10

I want to set the 'Path' variable in a .desktop file relative to the location where the desktop file is located and I can't manage to do that.

When I don't declare it or set it to blank it defaults to my home folder no matter where I run it from; and it doesn't accept values relative to my current location within the file system.

More From » xdg


You cannot set the CWD inside a .desktop file. If you want an application to have a specific CWD, you will need to write a simple wrapper script for the application, that looks something like this:


(cd /where/you/want/it/to/be && exec your_program)

You can replace your_program there with $@ and run the script with your_program as an argument, like your_program. This way you can use the same script to wrap any program you want to start in that directory.

[#44731] Tuesday, January 10, 2023, 9 Months  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 268
Total Questions: 108
Total Answers: 117

Location: Seychelles
Member since Mon, Jun 28, 2021
2 Years ago