Saturday, April 20, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 12961  / 1 Year 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

 Answers
4

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:


#!/bin/sh

(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 run-in-dir.sh 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, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
needstar

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

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