-
What Operating System(s) are you running on?macOS Which Wayland compositor or X11 Window manager(s) are you using?No response WezTerm versionwezterm 20240701-070926-69686f45 Ask your question!I want to set the tab title to the active pane's current_working_dir, as per mentioned in #915 (comment) So I have this which is not workin: wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width)
local pane = tab.active_pane
local cwd = pane.current_working_dir
return {
-- { Text = " " .. " hello " .. " " }, -- this works
{ Text = " " .. cwd .. " " }, -- this doesn't work
}
end) Any suggestion on how to make this work? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Same question. Nothing, I tried, seems to work on MacOS. |
Beta Was this translation helpful? Give feedback.
-
to fix try |
Beta Was this translation helpful? Give feedback.
-
Actually, I have resolved this for me using the shell integration instead, that is, setting the window title via the shell. In my case, using fish, I accomplished what I wanted (and more, e.g., adding the git branch as well), with the following: function fish_title
# Get shortened path without the full home path
# basename (prompt_pwd)
# Get current working directory
set -l wd (prompt_pwd)
# Try to get git branch
set -l git_branch (command git rev-parse --abbrev-ref HEAD 2>/dev/null)
if test -n "$git_branch"
echo "$wd ($git_branch)"
else
echo $wd
end
end |
Beta Was this translation helpful? Give feedback.
Actually, I have resolved this for me using the shell integration instead, that is, setting the window title via the shell. In my case, using fish, I accomplished what I wanted (and more, e.g., adding the git branch as well), with the following: