1

Ok, I know there are lots of ways to add to PATH. Each one has good reasons why you would choose a specific method vs another.

However, what I don't know is in the case of a program opened from the desktop (by double clicking its icon), how does one add to the PATH in this scenario?

By right-clicking and going to properties I can change the command run by double clicking. Could i potentially use && to tag on a command here? Surely there's a better, more global way of doing it?

Not sure if it makes a difference, but I'm using 18.04.

Suggestions much appreciated.

2
  • Use ~/.profile. It's sourced by the display manager and alters PATH for the whole session. Sep 8, 2021 at 16:47
  • @GunnarHjalmarsson - this did the trick globally. The other two suggested answers would have required manually editing each desktop icon individually. If you put this down as an answer I can mark it as solved.
    – user842741
    Sep 8, 2021 at 23:43

3 Answers 3

1

Use ~/.profile. It's sourced by the display manager and alters PATH for the whole session.

1
  • This is the solution which worked as it applied the change for all desktop icons in one go rather than needing to do each one individually.
    – user842741
    Sep 9, 2021 at 13:29
1

Replace the shortcut's command with a pointer to a bash script, set up your environment in the script, then call the shortcut's command.

1

Every *.desktop file has Exec= field. This field may include:

  • executable name which is already in $PATH;
  • full path to executable which is not in $PATH;
  • full path to user/system-created script which does what is needed.

Documentation to read: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables .

Traditional desktop environments like MATE have special tool for desktop-file creation named mate-desktop-item-edit. See its man-page online.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .