This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Having a session save environment variables per application

Tags: None
(comma "," separated)
User avatar
psychonaut
Registered Member
Posts
27
Karma
1
OS
I sometimes launch applications using different language environment variables, either because I prefer to use that application in a different language from my global defaults, or because I am trying to work around KDE/Qt's lack of support for custom date formats (see the much-hated Bug 340982). For example, I always launch Thunderbird via the following script in $HOME/bin so that it shows me YYYY-MM-DD dates in my message list:
Code: Select all
#!/bin/bash
LC_TIME=en_DK exec /usr/bin/thunderbird "$@" >&/dev/null &

Unfortunately, KDE's ksmserver doesn't seem to remember the language environment for these applications when I save the session. That is, in System Settings, I have enabled Startup and Shutdown->Desktop Session->On Login->Restore manually saved session. I launch Thunderbird using the above shell script, and then manually save the session using the Application Lanucher (Leave->Save Session). When I log out of KDE and log back in again, Thunderbird gets restored, but it formats the dates according to the system default locale rather than en_DK.

Is there any way of getting KDE to remember the environment variables used to launch the applications when saving a session?
airdrik
Registered Member
Posts
1854
Karma
5
OS
An idea you could try (not knowing off-hand how it determines how to launch the different applications) is to create custom application shortcuts (in ~/.local/share/applications/) for those applications and either set them up to run your custom launch script, or you can set up the environment variables in the Exec line using the env command:
Exec=env LC_TIME=en_DK /usr/bin/thunderbird

However, I suspect this will give you the same result. On the other hand, you might find such application shortcuts to be more convenient than running the scripts in ~/bin. Shortcuts in ~/.local/share/applications/ show up automatically in app launchers (including krunner) and can be easily added to the desktop or panel. Going with manual launching, you should be able to exclude those applications from the session in the Session Management page in System Settings.


airdrik, proud to be a member of KDE forums since 2008-Dec.
User avatar
psychonaut
Registered Member
Posts
27
Karma
1
OS
airdrik wrote:An idea you could try (not knowing off-hand how it determines how to launch the different applications) is to create custom application shortcuts (in ~/.local/share/applications/) for those applications and either set them up to run your custom launch script, or you can set up the environment variables in the Exec line using the env command:
Exec=env LC_TIME=en_DK /usr/bin/thunderbird

I'm afraid this doesn't work; when the session is restored it still uses the default language settings.

If no one else has any ideas, then perhaps I'll open a bug/feature request on the KDE Bugzilla.
User avatar
psychonaut
Registered Member
Posts
27
Karma
1
OS
psychonaut wrote:If no one else has any ideas, then perhaps I'll open a bug/feature request on the KDE Bugzilla.

Done: Bug 382764


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]