You are not logged in.

#1 2024-02-17 06:35:49

gehenna14
Member
Registered: 2024-02-08
Posts: 42

[Solved] urxvt -e will not apply environment variables to tui programs

I want to add mutt to my fluxbox menu, I add mutt to ~/.fluxbox/menu using the command

urxvt -e neomutt

I have an environment variable set in my .bashrc that exports $EDITOR as "nvim" so that when programs ask for this variable it opens neovim. I have

set editor=`echo \$EDITOR`

set in my muttrc.
I would normally expect it to apply the environment variable nvim so that when I wish to edit my emails it edits them in neovim. but running urxvt -e does not seem to apply. them, as I get a an error:

~/.config/neomutt/neomuttrc:1: Option editor may not be empty

I am still able to open the program normally by simply executing it in the terminal.
Is there a way to apply environment variables through executing programs this way? I searched google and i haven't found any good results, rxvt-unicode's man pages seems to only refer to environment variables when it comes to the shell (or at least thats how i interpreted it, didn't really read too in detail)
Thanks.

Last edited by gehenna14 (2024-02-19 02:50:14)

Offline

#2 2024-02-17 08:53:32

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,551

Re: [Solved] urxvt -e will not apply environment variables to tui programs

urxvt -e bash -c 'exec neomutt'
urxvt -e env EDITOR=nvim neomutt

"-e" runs the given process directly, it'll inherit the environment of the parenting shell (fluxbox) but not some random interactive shell.

Offline

#3 2024-02-19 02:51:15

gehenna14
Member
Registered: 2024-02-08
Posts: 42

Re: [Solved] urxvt -e will not apply environment variables to tui programs

seth wrote:
urxvt -e bash -c 'exec neomutt'
urxvt -e env EDITOR=nvim neomutt

"-e" runs the given process directly, it'll inherit the environment of the parenting shell (fluxbox) but not some random interactive shell.

Ah okay. I will probably just stick to opening it with the env variable set in the command. tried opening it via bash with that and it didn't seem to work.

Offline

#4 2024-02-19 08:13:33

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,551

Re: [Solved] urxvt -e will not apply environment variables to tui programs

"bash -ic" might be required instead of just "bash", depending on where to source the variable from.
But OC just controlling the environment directly w/o invoking a complete interactive shell setup is preferable.

Offline

Board footer

Powered by FluxBB