Set environment variable for application

Hi.
I’d like to set an environment variable for the media player application.

I’m able to do that from the terminal with the following command:

env NEMO_RESOURCE_CLASS_OVERRIDE=event /usr/bin/sailjail -p jolla-mediaplayer.desktop /usr/bin/jolla-mediaplayer

but writing the exact same line in the Exec key of the .desktop file doesn’t work (the application behaves as if the environment variable was not set).

What am I missing?
Thanks.

I would guess that sailjail is discarding it. shouldn’t you pass it WITH sailjail:

–env=name=value

Not sure myself.

It seems that sailjail doesn’t forward unknown arguments to firejail, so I get the following error:

/usr/bin/sailjail: unrecognized option '--env=NEMO_RESOURCE_CLASS_OVERRIDE=event'

Hmm. I was taking a tip from firejail, but obviously it not necessarily 1 to 1.

Maybe it can be set in the .profile ?

https://man.archlinux.org/man/firejail-profile.5

But i frankly don’t know :slight_smile:

Thanks a lot! It worked!

I created a file /etc/sailjail/permissions/jolla-mediaplayer.profile with the following content:

env NEMO_RESOURCE_CLASS_OVERRIDE=event
2 Likes

Just a not that someone is using this profile file technique to set language for an app:

env LANG=de_DE.UTF8