wezterm
wezterm copied to clipboard
Wezterm does not show User/Host for ZSH when using SSH
What Operating System(s) are you seeing this problem on?
Linux X11, Linux Wayland, macOS, FreeBSD X11, FreeBSD Wayland
Which Wayland compositor or X11 Window manager(s) are you using?
Gnome/mutter/x11
WezTerm version
20240203-110809-5046fc22
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
No, and I'll explain why below
Describe the bug
Tabs running bash are able to show their username and hostname in the tab and windowname.
This does not happen when running zsh
This is true when running bash/zsh locally as well as on other hosts using ssh.
I did not try the latest nightly because no functionality like this is mentioned in the changelogs.
To Reproduce
Open wezterm and open bash if it is not your default. Note the username and hostname included in th tab title and the window title
Now open zsh - note how username and hostname are now absent.
You can repeat this while ssh'd into various clients and the hostname and username are correct.
I have tried ssh into freebsd, ubuntu latest(24.04), arch latest, and macos latest (sonoma) and the behavior is the same with each.
Configuration
-- Pull in the
wezterm API
local wezterm = require 'wezterm'
local act = wezterm.action
local hostname = wezterm.hostname()
local config = wezterm.config_builder()
-- This will hold the configuration.
-- This is where you actually apply your config choices
-- For example, changing the color scheme:
config.color_scheme = 'Monokai (terminal.sexy)'
config.font = wezterm.font 'JetBrains Mono'
config.keys = {
{ key = 'Tab', mods = 'CTRL', action = act.ActivateTabRelative(1) },
{ key = 'Tab', mods = 'SHIFT|CTRL', action = act.ActivateTabRelative(-1) },
{ key = 'Enter', mods = 'ALT', action = act.ToggleFullScreen },
{ key = '!', mods = 'CTRL', action = act.ActivateTab(0) },
{ key = '!', mods = 'SHIFT|CTRL', action = act.ActivateTab(0) },
{ key = '\"', mods = 'ALT|CTRL', action = act.SplitVertical{ domain = 'CurrentPaneDomain' } },
{ key = '\"', mods = 'SHIFT|ALT|CTRL', action = act.SplitVertical{ domain = 'CurrentPaneDomain' } },
{ key = '#', mods = 'CTRL', action = act.ActivateTab(2) },
{ key = '#', mods = 'SHIFT|CTRL', action = act.ActivateTab(2) },
{ key = '$', mods = 'CTRL', action = act.ActivateTab(3) },
{ key = '$', mods = 'SHIFT|CTRL', action = act.ActivateTab(3) },
{ key = '%', mods = 'CTRL', action = act.ActivateTab(4) },
{ key = '%', mods = 'SHIFT|CTRL', action = act.ActivateTab(4) },
{ key = '%', mods = 'ALT|CTRL', action = act.SplitHorizontal{ domain = 'CurrentPaneDomain' } },
{ key = '%', mods = 'SHIFT|ALT|CTRL', action = act.SplitHorizontal{ domain = 'CurrentPaneDomain' } },
{ key = '&', mods = 'CTRL', action = act.ActivateTab(6) },
{ key = '&', mods = 'SHIFT|CTRL', action = act.ActivateTab(6) },
{ key = '\'', mods = 'SHIFT|ALT|CTRL', action = act.SplitVertical{ domain = 'CurrentPaneDomain' } },
{ key = '(', mods = 'CTRL', action = act.ActivateTab(-1) },
{ key = '(', mods = 'SHIFT|CTRL', action = act.ActivateTab(-1) },
{ key = ')', mods = 'CTRL', action = act.ResetFontSize },
{ key = ')', mods = 'SHIFT|CTRL', action = act.ResetFontSize },
{ key = '*', mods = 'CTRL', action = act.ActivateTab(7) },
{ key = '*', mods = 'SHIFT|CTRL', action = act.ActivateTab(7) },
{ key = '+', mods = 'CTRL', action = act.IncreaseFontSize },
{ key = '+', mods = 'SHIFT|CTRL', action = act.IncreaseFontSize },
{ key = '-', mods = 'CTRL', action = act.DecreaseFontSize },
{ key = '-', mods = 'SHIFT|CTRL', action = act.DecreaseFontSize },
{ key = '-', mods = 'SUPER', action = act.DecreaseFontSize },
{ key = '0', mods = 'CTRL', action = act.ResetFontSize },
{ key = '0', mods = 'SHIFT|CTRL', action = act.ResetFontSize },
{ key = '0', mods = 'SUPER', action = act.ResetFontSize },
{ key = '1', mods = 'SHIFT|CTRL', action = act.ActivateTab(0) },
{ key = '1', mods = 'OPT', action = act.ActivateTab(0) },
{ key = '2', mods = 'SHIFT|CTRL', action = act.ActivateTab(1) },
{ key = '2', mods = 'OPT', action = act.ActivateTab(1) },
{ key = '3', mods = 'SHIFT|CTRL', action = act.ActivateTab(2) },
{ key = '3', mods = 'OPT', action = act.ActivateTab(2) },
{ key = '4', mods = 'SHIFT|CTRL', action = act.ActivateTab(3) },
{ key = '4', mods = 'OPT', action = act.ActivateTab(3) },
{ key = '5', mods = 'SHIFT|CTRL', action = act.ActivateTab(4) },
{ key = '5', mods = 'SHIFT|ALT|CTRL', action = act.SplitHorizontal{ domain = 'CurrentPaneDomain' } },
{ key = '5', mods = 'OPT', action = act.ActivateTab(4) },
{ key = '6', mods = 'SHIFT|CTRL', action = act.ActivateTab(5) },
{ key = '6', mods = 'OPT', action = act.ActivateTab(5) },
{ key = '7', mods = 'SHIFT|CTRL', action = act.ActivateTab(6) },
{ key = '7', mods = 'OPT', action = act.ActivateTab(6) },
{ key = '8', mods = 'SHIFT|CTRL', action = act.ActivateTab(7) },
{ key = '8', mods = 'OPT', action = act.ActivateTab(7) },
{ key = '9', mods = 'SHIFT|CTRL', action = act.ActivateTab(-1) },
{ key = '9', mods = 'OPT', action = act.ActivateTab(-1) },
{ key = '=', mods = 'CTRL', action = act.IncreaseFontSize },
{ key = '=', mods = 'SHIFT|CTRL', action = act.IncreaseFontSize },
{ key = '=', mods = 'SUPER', action = act.IncreaseFontSize },
{ key = '@', mods = 'OPT', action = act.ActivateTab(1) },
{ key = '@', mods = 'SHIFT|CTRL', action = act.ActivateTab(1) },
{ key = 'C', mods = 'OPT', action = act.CopyTo 'Clipboard' },
{ key = 'C', mods = 'SHIFT|CTRL', action = act.CopyTo 'Clipboard' },
{ key = 'F', mods = 'OPT', action = act.Search 'CurrentSelectionOrEmptyString' },
{ key = 'F', mods = 'SHIFT|CTRL', action = act.Search 'CurrentSelectionOrEmptyString' },
{ key = 'K', mods = 'OPT', action = act.ClearScrollback 'ScrollbackOnly' },
{ key = 'K', mods = 'SHIFT|CTRL', action = act.ClearScrollback 'ScrollbackOnly' },
{ key = 'L', mods = 'SUPER', action = act.ShowDebugOverlay },
{ key = 'L', mods = 'SHIFT|CTRL', action = act.ShowDebugOverlay },
{ key = 'M', mods = 'OPT', action = act.Hide },
{ key = 'M', mods = 'SHIFT|CTRL', action = act.Hide },
{ key = 'N', mods = 'OPT', action = act.SpawnWindow },
{ key = 'N', mods = 'SHIFT|CTRL', action = act.SpawnWindow },
{ key = 'P', mods = 'OPT', action = act.ActivateCommandPalette },
{ key = 'P', mods = 'SHIFT|CTRL', action = act.ActivateCommandPalette },
{ key = 'R', mods = 'OPT', action = act.ReloadConfiguration },
{ key = 'R', mods = 'SHIFT|CTRL', action = act.ReloadConfiguration },
{ key = 'T', mods = 'OPT', action = act.SpawnTab 'CurrentPaneDomain' },
{ key = 'T', mods = 'SHIFT|CTRL', action = act.SpawnTab 'CurrentPaneDomain' },
{ key = 'U', mods = 'OPT', action = act.CharSelect{ copy_on_select = true, copy_to = 'ClipboardAndPrimarySelection' } },
{ key = 'U', mods = 'SHIFT|CTRL', action = act.CharSelect{ copy_on_select = true, copy_to = 'ClipboardAndPrimarySelection' } },
{ key = 'V', mods = 'OPT', action = act.PasteFrom 'Clipboard' },
{ key = 'V', mods = 'SHIFT|CTRL', action = act.PasteFrom 'Clipboard' },
{ key = 'W', mods = 'OPT', action = act.CloseCurrentTab{ confirm = true } },
{ key = 'W', mods = 'SHIFT|CTRL', action = act.CloseCurrentTab{ confirm = true } },
{ key = 'X', mods = 'OPT', action = act.ActivateCopyMode },
{ key = 'X', mods = 'SHIFT|CTRL', action = act.ActivateCopyMode },
{ key = 'Z', mods = 'OPT', action = act.TogglePaneZoomState },
{ key = 'Z', mods = 'SHIFT|CTRL', action = act.TogglePaneZoomState },
{ key = '[', mods = 'SHIFT|SUPER', action = act.ActivateTabRelative(-1) },
{ key = ']', mods = 'SHIFT|SUPER', action = act.ActivateTabRelative(1) },
{ key = '^', mods = 'OPT', action = act.ActivateTab(5) },
{ key = '^', mods = 'SHIFT|CTRL', action = act.ActivateTab(5) },
{ key = '_', mods = 'OPT', action = act.DecreaseFontSize },
{ key = '_', mods = 'SHIFT|CTRL', action = act.DecreaseFontSize },
{ key = 'c', mods = 'SHIFT|CTRL', action = act.CopyTo 'Clipboard' },
{ key = 'c', mods = 'OPT', action = act.CopyTo 'Clipboard' },
{ key = 'f', mods = 'SHIFT|CTRL', action = act.Search 'CurrentSelectionOrEmptyString' },
{ key = 'f', mods = 'OPT', action = act.Search 'CurrentSelectionOrEmptyString' },
{ key = 'k', mods = 'SHIFT|CTRL', action = act.ClearScrollback 'ScrollbackOnly' },
{ key = 'k', mods = 'OPT', action = act.ClearScrollback 'ScrollbackOnly' },
{ key = 'l', mods = 'SHIFT|CTRL', action = act.ShowDebugOverlay },
{ key = 'm', mods = 'SHIFT|CTRL', action = act.Hide },
{ key = 'm', mods = 'OPT', action = act.Hide },
{ key = 'n', mods = 'SHIFT|CTRL', action = act.SpawnWindow },
{ key = 'n', mods = 'OPT', action = act.SpawnWindow },
{ key = 'p', mods = 'SHIFT|CTRL', action = act.ActivateCommandPalette },
{ key = 'r', mods = 'SHIFT|CTRL', action = act.ReloadConfiguration },
{ key = 'r', mods = 'OPT', action = act.ReloadConfiguration },
{ key = 't', mods = 'SHIFT|CTRL', action = act.SpawnTab 'CurrentPaneDomain' },
{ key = 't', mods = 'OPT', action = act.SpawnTab 'CurrentPaneDomain' },
{ key = 'u', mods = 'SHIFT|CTRL', action = act.CharSelect{ copy_on_select = true, copy_to = 'ClipboardAndPrimarySelection' } },
{ key = 'v', mods = 'SHIFT|CTRL', action = act.PasteFrom 'Clipboard' },
{ key = 'v', mods = 'OPT', action = act.PasteFrom 'Clipboard' },
{ key = 'w', mods = 'SHIFT|CTRL', action = act.CloseCurrentTab{ confirm = true } },
{ key = 'w', mods = 'OPT', action = act.CloseCurrentTab{ confirm = true } },
{ key = 'x', mods = 'SHIFT|CTRL', action = act.ActivateCopyMode },
{ key = 'z', mods = 'SHIFT|CTRL', action = act.TogglePaneZoomState },
{ key = '{', mods = 'OPT', action = act.ActivateTabRelative(-1) },
{ key = '{', mods = 'SHIFT|SUPER', action = act.ActivateTabRelative(-1) },
{ key = '}', mods = 'OPT', action = act.ActivateTabRelative(1) },
{ key = '}', mods = 'SHIFT|SUPER', action = act.ActivateTabRelative(1) },
{ key = 'phys:Space', mods = 'SHIFT|CTRL', action = act.QuickSelect },
{ key = 'PageUp', mods = 'SHIFT', action = act.ScrollByPage(-1) },
{ key = 'PageUp', mods = 'OPT', action = act.ActivateTabRelative(-1) },
{ key = 'PageUp', mods = 'SHIFT|CTRL', action = act.MoveTabRelative(-1) },
{ key = 'PageDown', mods = 'SHIFT', action = act.ScrollByPage(1) },
{ key = 'PageDown', mods = 'OPT', action = act.ActivateTabRelative(1) },
{ key = 'PageDown', mods = 'SHIFT|CTRL', action = act.MoveTabRelative(1) },
{ key = 'LeftArrow', mods = 'SHIFT|CTRL', action = act.ActivatePaneDirection 'Left' },
{ key = 'LeftArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Left', 1 } },
{ key = 'RightArrow', mods = 'SHIFT|CTRL', action = act.ActivatePaneDirection 'Right' },
{ key = 'RightArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Right', 1 } },
{ key = 'UpArrow', mods = 'SHIFT|CTRL', action = act.ActivatePaneDirection 'Up' },
{ key = 'UpArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Up', 1 } },
{ key = 'DownArrow', mods = 'SHIFT|CTRL', action = act.ActivatePaneDirection 'Down' },
{ key = 'DownArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Down', 1 } },
{ key = 'Insert', mods = 'SHIFT', action = act.PasteFrom 'PrimarySelection' },
{ key = 'Insert', mods = 'OPT', action = act.CopyTo 'PrimarySelection' },
{ key = 'Copy', mods = 'NONE', action = act.CopyTo 'Clipboard' },
{ key = 'Paste', mods = 'NONE', action = act.PasteFrom 'Clipboard' },
}
config.window_background_gradient = {
colors = { '#1e657d', 'black' },
orientation = {
Radial = {
-- Specifies the x coordinate of the center of the circle,
-- in the range 0.0 through 1.0. The default is 0.5 which
-- is centered in the X dimension.
cx = 1.0,
-- Specifies the y coordinate of the center of the circle,
-- in the range 0.0 through 1.0. The default is 0.5 which
-- is centered in the Y dimension.
cy = 0.0,
-- Specifies the radius of the notional circle.
-- The default is 0.5, which combined with the default cx
-- and cy values places the circle in the center of the
-- window, with the edges touching the window edges.
-- Values larger than 1 are possible.
radius = 1.25,
},
},
}
config.window_padding = {
left = 0,
right = 0,
top = 0,
bottom = 0,
}
config.mouse_bindings = {
{
event = { Down = { streak = 1, button = "Right" } },
mods = "NONE",
action = wezterm.action_callback(function(window, pane)
local has_selection = window:get_selection_text_for_pane(pane) ~= ""
if has_selection then
window:perform_action(act.CopyTo("ClipboardAndPrimarySelection"), pane)
window:perform_action(act.ClearSelection, pane)
else
window:perform_action(act({ PasteFrom = "Clipboard" }), pane)
end
end),
},
}
function tab_title(tab_info)
local title = tab_info.tab_title
-- if the tab title is explicitly set, take that
if title and #title > 0 then
return title
end
-- Otherwise, use the title from the active pane
-- in that tab
return tab_info.active_pane.title
end
-- config.window_background_gradient = 'CubeHelixDefault'
config.initial_rows = 32
config.initial_cols = 130
config.enable_scroll_bar = true
local font_size
if hostname == 'archaos' then
font_size = 10
else
font_size = 12.0
end
config.font_size = font_size
window_decorations = "RESIZE"
config.window_frame = {
-- inactive_titlebar_bg = '#030303',
}
config.window_background_opacity = 0.9
-- and finally, return the configuration to wezterm
return config
Expected Behavior
Tabs using zsh should show the username and hostname in the tab title, same as on bash.
Logs
No response
Anything else?
Id ideally love to have these as variables exposed inside of the wezterm configuration so that we can add or subtract the hostname from the tab name as part of wezterm configuration instead of having them be tied to zsh/bash
The only other callout I have is that this functionality works correctly on other terminal emulators such as gnome terminal, gnome console, and ITerm2. All three of those have the same tab naming on bash and zsh so im not sure what makes it different for wezterm.
Most likely cause is that one of those environments is not consistently using OSC 0, 1 or 2 (https://wezfurlong.org/wezterm/escape-sequences.html#operating-system-command-sequences) to set the title.
The default behavior in wezterm is to try to determine the current process by querying the local system. However, as soon as the title is changed for a pane, wezterm will no longer try to query the system and will instead trust that the title set by the escape sequence is correct and is maintained by the program you are running in the pane.
I would suggest debugging your shell startup to see what is happening. It can be helpful to set -x
to see what they are up to.
Another factor to consider is that wezterm always starts your local shell as a login shell, which can also affect which of your shell startup files are processed.
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.