Open relausen opened 1 month ago
I see this has already been acknowledged, but I'm just jumping in here because by coincidence this is my first day using wezterm, and I already ran into this bug.
I was following along with this tutorial to get it set up: https://alexplescan.com/posts/2024/08/10/wezterm/
In that post it uses config to add the hostname to the top-right of the window with wezterm.hostname()
. It works great except that wezterm.hostname()
doesn't change to reflect remote hosts during SSH, for example (in my opinion it should, but that's a different issue).
I did some digging and the only way I could figure out to have different SSH windows display their corresponding hostname was to set a user var in my remote host's bashrc/zshrc. Doing so works perfectly (!) except:
wezterm connect
opens its own new window anyways)This is less an issue for me than relausen I think, because it's not a workflow thing, just a quality of life thing.. but it appears to be the same issue.
This may not be the place for it but since I'm here I'll also ask -- I'm curious if anyone has better ideas for an SSH-sensitive hostname display configuration than using user vars?
What Operating System(s) are you seeing this problem on?
macOS
Which Wayland compositor or X11 Window manager(s) are you using?
No response
WezTerm version
20240719-081740-643d85f8
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
Yes, and I updated the version box above to show the version of the nightly that I tried
Describe the bug
Context
IS_NVIM
(set/unset by Neovim on entry/exit) to control if a key should be relayed to Neovimwezterm-move
plugin in Neovim with a simplified version of the suggested WezTerm Lua code in my WezTerm setup, using a user var instead of the process name to determine if a key should be relayed to Neovim instead of being consumed by WezTermThe problem
Using the IS_NVIM user var in my WezTerm Lua code to control if keys should be interpreted by WezTerm or relayed to the terminal (and by extension to Neovim) generally works like a charm. But if I have Neovim running when detaching from the multiplexer (or just quit WezTerm), and subsequently attach again, the IS_NVIM user var is no longer set, meaning that the keystrokes I want to pass through to the shell/Neovim are not passed through.
I have tried using the
WEZTERM_PROG
user var set by shell integration, and that exposes the same problem, confirmed by logging the value from my WezTerm Lua code.This indicates - as suggested by @wez in this comment - that user vars are not synchronized on attach after a detach.
To Reproduce
IS_NVIM
user var totrue
:__wezterm_set_user_var IS_NVIM "true"
cat
and type^H
and^K
and see that these are sent to the shell/cat
. Do not exitcat
.cat
process. Type^H
and^K
again and observe that they are no longer sent to the shellConfiguration
The smallest relevant subset of my config:
Expected Behavior
I expect the user vars to be retained between detach/attach, making the UX consistent between newly started sessions and re-attached sessions.
Logs
No response
Anything else?
No response