Adding Environment Variables to Linux GUI Apps

Find the app your looking for:

sudo find / -type f -iname "*myapp*"

Edit the file:

nvim /usr/share/applications/org.myapp.MyApp.desktop

You’ll want to look for the Exec key, and prepend the env vars to the app command:

Exec=env MY_ENV_VAR=hello my-app-cmd %U
 

cmac4603

A random assortment of notes.


Categories


2026-08-17