Set environment variable for unity application launcher

Solution 1:

In the desktop file itself, you can execute the program through env:

Exec=/usr/bin/env VAR=value /usr/bin/yourprogram

Alternatively, use a wrapper script (e.g. /usr/bin/yourprogram.env):

#!/bin/sh
VAR=value
export VAR
exec /usr/bin/yourprogram.real "$@"

However, both are poor solutions, since Unity will not be able to correctly track the program if it is started through a wrapper.

It would be much better to get ~/.profile working – make sure you're using the correct syntax and all that:

export VAR=value

or

VAR=value
export VAR

Also remember that ~/.profile is only read when you log in, so you must log out after changing it.