14

I use guake very heavily, and ssh into more than 3 computers at any point in time. I also have daemons running on some tabs (terminals). What I want to know, Is it possible to have the name of the current command as the name of the Terminal? Rightclikcing a tab, and changing its name causes this: (Look at the tab after Terminal 5)

Look at the tab after Terminal 5

Thanks.

theTuxRacer
  • 16,533

6 Answers6

4

I am not sure this works for guake, it works for most terminal emulators. You can include an echo on your scripts to change the terminal title:

echo -ne "\033]0;your_title_here\007"
João Pinto
  • 17,323
4

This is a guake (0.4.1) bug. I just see and solve this problem via this bug report though the author say this is not the best method: https://github.com/Guake/guake/issues/205

i've found out that moving the dialog destruction code (guake.py line 983) down after the code that sets the tab label (line 986) actually solves the problem. so the the code that works for me look like this:

    response = dialog.run()
    # dialog.destroy() 

    if response == gtk.RESPONSE_ACCEPT:
        self.selected_tab.set_label(entry.get_text())

    dialog.destroy()

maybe there is some problem with gtk and dialogs, but i haven't found any code changes connected with gtk in the version 0.4.1 diff.

EDIT: guake 0.4.2 can change the tab name correctly

pabloab
  • 47
3

Bit of a hack, but this will rename the current terminal to whatever you ssh'ed for.

function ssh() {
    guake -r "$@";
    /usr/bin/ssh $@
}

Also if you update your PROMPT_COMMAND, you can have a function to update the terminal name each time. Although this will not work for your ssh problem as it only changes the name after the command has run.

e.g.

export PROMPT_COMMAND=renameTerminal

function renameTerminal() {
    guake -r "$SOMENAME";
}
Eric Carvalho
  • 55,453
2

When I want to change the tab name in guake, I just right-click the tab name and left-click rename. A pop-up box opens to type the new name into.

charlie-tca
  • 1,269
2

You can simply change the tabname with

guake -r newtabname

If you want to get the latest running command, use for example

echo "!!" | cut -f 1 -d " "

!! is expanded by bash when you type it. It's not expanded by alias substitution. So you have to use the history built-in to do the expansion to put it in an alias:

alias setguaketitle='guake -r $(echo "$(history -p !! )"| cut -f 1 -d " ")'

when your last command was

echo this is a test

then calling

setguaketitle

will set the title to "echo".

rubo77
  • 34,024
  • 52
  • 172
  • 299
0

If you change your shell to zsh, you can add this to your ~/.zshrc:

preexec() {
    echo -n '\e]0;'
    echo -nE "$1"
    print -nP '  (%~)'
    echo -n '\a'
}

and it will show the current command and the current working directory. This works for all terminal emulators, not just guake.

To install zsh:

sudo apt-get install zsh

to try it out just say

zsh

to make it your default for new terminals:

chsh -s /bin/zsh 
poolie
  • 9,358