Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export ENV var before launch thunderbird #313

Closed
asarubbo opened this issue Apr 17, 2020 · 10 comments
Closed

export ENV var before launch thunderbird #313

asarubbo opened this issue Apr 17, 2020 · 10 comments
Labels
enhancement New feature or request

Comments

@asarubbo
Copy link

asarubbo commented Apr 17, 2020

Description

Would be great if there will be something that let you export some env variables.
The need comes from the fact that if you are using a dark theme, thunderbird will be unreadable, so I'm exporting GTK_THEME before launch thunderbird
Thanks

@asarubbo asarubbo added the enhancement New feature or request label Apr 17, 2020
@Abestanis
Copy link
Collaborator

I don't know if that is worth doing in Birdtray. Couldn't you use a wrapper shell script to archive that?

@asarubbo
Copy link
Author

Hi, sure I can use a wrapper and this is something I'm already doing. But if this is something done by a lot of people it may worth..

@gyunaev
Copy link
Owner

gyunaev commented Apr 18, 2020

You don't even need a wrapper, just export those variables before starting birdtray. It should inherit the environment and pass it to children processes.

@gyunaev gyunaev closed this as completed May 4, 2020
@gudvinr
Copy link

gudvinr commented May 23, 2020

This is really useful though. You can just use env GTK_THEME=theme thunderbird from .desktop file (or application menu entry) but you can't do that from birdtray so you should introduce different launch script or make copy of .desktop file to use custom script which sounds just like workaround but not a handy solution.

So only necessary thing to solve this issue is to correctly handle launch string because it seems like right now birdtray treats it like whole path to thunderbird executable rather than command.

@Abestanis
Copy link
Collaborator

So only necessary thing to solve this issue is to correctly handle launch string because it seems like right now birdtray treats it like whole path to thunderbird executable rather than command.

@gudvinr That doesn't sound right, did you actually test that? The last time I checked, we did support entering a full command in the advanced tab.

@gudvinr
Copy link

gudvinr commented Jun 2, 2020

@Abestanis how would I know that otherwise?

Yes, I did test that and it didn't work. I get an error:

Error starting Thunderbird as '/home/{username}/env GDK_DPI_SCALE=0.5 /usr/bin/thunderbird':

execvp: No such file or directory

If I use launch command as env GDK_DPI_SCALE=0.5 /usr/bin/thunderbird.

But it works if I run /usr/bin/env GDK_DPI_SCALE=0.5 /usr/bin/thunderbird though it is neither convenient nor obvious.

@Abestanis
Copy link
Collaborator

how would I know that otherwise?

Sorry, I'm not a native speaker, do you mean how you could verify that it works or not? You seem to have figured it out.

If I use launch command as env GDK_DPI_SCALE=0.5 /usr/bin/thunderbird

This doesn't work, because we don't search for the program on the PATH. You need to specify the full path to the program.

But it works if I run /usr/bin/env GDK_DPI_SCALE=0.5 /usr/bin/thunderbird

Exactly like this. 😄👍

though it is neither convenient nor obvious.

That might be true, but it is a working workaround. We could either document it in the README so it is more obvious, or we could add an extra field to the settings page, which would make it more convenient. If you wan't to take a stab at it, go for it. Pull requests are always welcome.

@gyunaev
Copy link
Owner

gyunaev commented Jun 2, 2020

But it works if I run /usr/bin/env GDK_DPI_SCALE=0.5 /usr/bin/thunderbird though it is neither convenient nor obvious.

Why isn't it obvious? This is a standard way to launch binaries with changed environment. Another standard way is a wrapper script.

@gyunaev gyunaev reopened this Jun 2, 2020
@gudvinr
Copy link

gudvinr commented Jun 2, 2020

Why isn't it obvious

Because every other place in the system knows about PATH variable. I meant /usr/bin/ part. Using env is ok.

We could either document it in the README so it is more obvious

That will be more than enough

@gyunaev
Copy link
Owner

gyunaev commented Oct 8, 2020

Because every other place in the system knows about PATH variable.

Actually only your shell knows about PATH variable, and PATH evaluation is shell-specific thing. However since we do not use shell when starting Thunderbird, you have to specify the absolute path. Normally you'd use a shell script there, such as:

#!/bin/sh

export GDK_DPI_SCALE=0.5
exec /usr/bin/thunderbird

and invoke it directly as "/path/to/your/shell/script".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants