1

I have an application that I'd like to execute with some configs that get calculated at runtime. To achieve this, I can simply use an alias and it works fine, the problem is that the executable itself is still there of course, so if I launch the application from a .desktop file, or a shortcut, or anywhere else that isn't the terminal, then the alias is not set, and I lose this ability.

I thought about the possibility of just moving the executable somewhere else, and then replacing it with a shell script that runs it how I want. The problem with this solution is that an update would probably overwrite it, so it's not something I can really do.

Any suggestions? I'd basically like to transform how the executable is ran globally, in the whole session.

I'm currently on Arch Linux KDE.

0

2 Answers 2

1

You have options;

  1. you can modify the .desktop file to include your environment variables, command-line arguments/options or whatever you are executing on start.
  • you would just modify the exec= line of the .desktop file

alternatively,

  1. you could create an executable sh script that starts the executable as desired, putting it in your PATH.
  • note: you would give the script a different name than the executable. you should just leave the binary alone, not trying to replace, move it or anything like that.
  1. then edit the .desktop file to execute your sh script (and point your alias to it, as well, if desired).

either solution should work fine.

I use #2 solution on my system for a few wine applications that need a number of environment variables set, but that i can't set globally (eg: in .bashrc)... I mostly do this for readability, as modifying the .desktop with a long string of variables looks unpleasant and it is much easier to read from a script.

0

A simple way to avoid upgrades messing your changes up is to make those changes somewhere else than the system directories.

Create a directory for your own programs within your home directory, e.g. ~/bin. Add that directory to $PATH and put the shell script there and/or point the desktop link there.

You must log in to answer this question.

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