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.

  • See my answer to a related question to show an abbreviated representation of the current directory as tab title. – krlmlr May 15 '13 at 8:22
  • What do you mean with "current command"? is there always a command running in each terminal? what should the title be when there is nothing running? – rubo77 Jun 15 '16 at 7:00
up vote 4 down vote accepted

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

  • 1
    this doesnt answer the question – Blauhirn Dec 25 '16 at 16:51

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"
  • that didnt work, when I typed it in the terminal. – theTuxRacer Dec 27 '10 at 11:25
  • 1
    That's because your shell's prompt will usually set it to the current working directory. Check the PS1 variable. – ak2 Dec 27 '10 at 13:12
  • It doesn't work on my Ubuntu 15.10 either. I checked echo $PS1 which shows something like \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$ what does this help me solve this? – rubo77 Jun 15 '16 at 6:57

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.

  • sure, but how can you add this to a script? – rubo77 Jun 15 '16 at 6:58

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";
}

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".

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 
  • 1
    zsh doesnt work at all with guake :( – theTuxRacer Jan 11 '11 at 4:14
  • Oh, right, I remember hitting that problem before. But at least some of the bugs relating to it now seem to be fixed, eg <guake.org/ticket/49>. – poolie Jan 11 '11 at 15:14

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.