How can I add the current directory path to the title bar when a process is running #7568
-
Imagine you run I wonder if there's a way to update the Kitty title bar template to include the current directory (e.g. One hack I use is to run programs with a comment like: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Could achieve that by disabling the title integration in kitty ( DISABLE_AUTO_TITLE="true"
# Function to set terminal title
function set_terminal_title() {
if [[ -n "$1" ]]; then
# When a process is running, show the command and the current directory
print -Pn "\e]0;$PWD | $1\a"
else
# Default title showing only the current directory
print -Pn "\e]0;$PWD\a"
fi
}
# Pre-command hook to update the terminal title before each command
function preexec() {
# Update the terminal title with the running command and the current directory
set_terminal_title "$1"
}
# Post-command hook to reset the terminal title after each command
function precmd() {
# Reset the terminal title to the current directory
set_terminal_title
}
# Call the function to set the initial title when the shell starts
set_terminal_title |
Beta Was this translation helpful? Give feedback.
Could achieve that by disabling the title integration in kitty (
shell_integration enabled no-title
in the config) adding the following to my.zshrc
: