Search code examples
titleworking-directorykonsole

How can I automatically set the window title in konsole (kde) to be my $pwd string?


Here's what I would do to set the title interactively via shell:

echo -ne "\033]30;$PWD\007"

How can I make the above happen automatically each time I change my working directory?


Solution

  • Set konsole's window title to be some string as defined below:

    export PROMPT_COMMAND='echo -ne "\033]0;$(basename ${PWD})\007"'
    

    or

    export PROMPT_COMMAND='echo -ne "\033]30;$PWD\007"'
    

    The title of konsole should change immediately when you run either command.

    Found the answer here:

    http://www.thegeekstuff.com/2008/09/bash-shell-take-control-of-ps1-ps2-ps3-ps4-and-prompt_command/