Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ´title= ´ function from config file to allow dynamic titles #959

Open
heit0r opened this issue Oct 30, 2024 · 2 comments
Open

Remove ´title= ´ function from config file to allow dynamic titles #959

heit0r opened this issue Oct 30, 2024 · 2 comments

Comments

@heit0r
Copy link

heit0r commented Oct 30, 2024

Is your feature request related to a problem? Please describe.

The title= function on .config/terminator/config overrides the terminal title. Every time I make a change in the setup on terminator, this function pops up on my config file and I have to manually delete this line in order to my titles back again.

I have a function on my /etc/bash.bashrc to dynamically change the terminal title in XFCE for aliased commands:

title() {
    local title=$1
    shift
    local cmd=$1
    shift
    echo -ne "\033]0;$title\007"
    $cmd "$@"
    echo -ne "\033]0;${OLD_TITLE:-$USER@$HOSTNAME}\007"
}

And in case of commands who weren't aliased I have another function just to return the previous command:

set_title_preexec() {
    # Captures the command about to enter
    local cmd=$(history 1 | sed 's/^[ ]*[0-9]*[ ]*//;s/[;&|].*//')
    # Updates terminal title
    echo -ne "\033]0;${cmd}\007"
}

# Restore title after process ends
set_title_postexec() {
    # Restore title
    echo -ne "\033]0;Terminal\007"
}

# traps for preexec and postexec
trap 'set_title_preexec' DEBUG
PROMPT_COMMAND=set_title_postexec

The result (ignore the icon, i just changed it) :

2024-10-30_13-10_1
2024-10-30_13-10_2

Unaliased commands:
2024-10-30_13-46

Describe the solution you'd like
To this function be switchable or removed if no one cares about it. I believe many users may have similar functions to alter their terminal titles and probably are facing a similar issue. Who knows..

Describe alternatives you've considered
To manually delete the line every time? Not a big deal, actually. But altering this may improve every user experience.

Additional context
With the title= function on my config file the title is always the same:
<user>@<machine>:~

@heit0r
Copy link
Author

heit0r commented Oct 30, 2024

Also, it works by just leaving title = empty. No need to take the entire line from config file.

@mattrose
Copy link
Member

mattrose commented Nov 4, 2024

Looking at this now. This has always bugged me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants