T
Termux3mo ago
kassius

[SOLVED] Setting env vars for termux:widget

My shell when starting via termux:widget is not loading something from the environment but I am unaware of what it is, like the alacritty running via termux shortcut (the same script) as in those screenshots
script i3-session used in both screenshots, it works when started via command line but not widget, how could I fix it?
#!/data/data/com.termux/files/usr/bin/zsh

source ~/.zshrc

export PATH=~/.cargo/bin:~/go/bin:~/bin/:~/.local/bin:$PATH
export TERMUX_X11_XSTARTUP="dbus-launch --exit-with-session i3"

am start -n com.termux.x11/.MainActivity
# am start --user 0 -n com.termux.x11/.MainActivity

termux-x11

am broadcast -a com.termux.x11.ACTION_STOP -p com.termux.x11
#!/data/data/com.termux/files/usr/bin/zsh

source ~/.zshrc

export PATH=~/.cargo/bin:~/go/bin:~/bin/:~/.local/bin:$PATH
export TERMUX_X11_XSTARTUP="dbus-launch --exit-with-session i3"

am start -n com.termux.x11/.MainActivity
# am start --user 0 -n com.termux.x11/.MainActivity

termux-x11

am broadcast -a com.termux.x11.ACTION_STOP -p com.termux.x11
Thanks in advance! EDIT: this is not proot/chroot, but vanilla Termux
No description
No description
Solution:
Thank you, but it didn't work... what worked was export SHELL to zsh binary in the script; here is the script i'm using ```bash #!/data/data/com.termux/files/usr/bin/zsh ...
Jump to solution
2 Replies
NoNameForIdea
NoNameForIdea3mo ago
~/.zshrc is sourced for interactive shell, in this case ~/.zshrc is not sourced, put these variables in ~/.zshenv.
Solution
kassius
kassius3mo ago
Thank you, but it didn't work... what worked was export SHELL to zsh binary in the script; here is the script i'm using
#!/data/data/com.termux/files/usr/bin/zsh

export TERMUX_X11_XSTARTUP="dbus-launch --exit-with-session i3"
export SHELL=/data/data/com.termux/files/usr/bin/zsh

am start -n com.termux.x11/.MainActivity &

termux-x11

am broadcast -a com.termux.x11.ACTION_STOP -p com.termux.x11
#!/data/data/com.termux/files/usr/bin/zsh

export TERMUX_X11_XSTARTUP="dbus-launch --exit-with-session i3"
export SHELL=/data/data/com.termux/files/usr/bin/zsh

am start -n com.termux.x11/.MainActivity &

termux-x11

am broadcast -a com.termux.x11.ACTION_STOP -p com.termux.x11

Did you find this page helpful?