Zsh/urxvt terminal title? [SOLVED!]

I'm using urxvt(c) as my terminal emulator, and my shell is zsh.
What do I need to add to my .zshrc to set the title to the current command (plus arguments) when a command is run, and back to 'urxvt' when it finishes? The solution in this thread didn't work.
My current .zshrc:
# Lines configured by zsh-newuser-install
HISTFILE=~/.bash_history
HISTSIZE=8192
SAVEHIST=8192
setopt appendhistory notify
unsetopt beep
setopt autocd
bindkey -e
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/james/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
autoload -U colors && colors
PS1="%{$fg[cyan]%}%n%{$reset_color%}@%{$fg[green]%}%m%{$reset_color%} [%{$fg_bold[white]%}%~%{$reset_color%}]%# "
export EDITOR=nano
# Key Bindings #
#urxvt
bindkey "\e[2~" quoted-insert
bindkey "\e[7~" beginning-of-line
bindkey "\e[3~" delete-char
bindkey "\e[8~" end-of-line
#Screen, ConnectBot, etc.
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
bindkey "\e[5~" up-line-or-history
bindkey "\e[6~" down-line-or-history
export PATH=$PATH:~/.local/bin
alias userctl='systemctl --user'
Last edited by ThePacman (2014-05-06 23:23:30)

qinohe wrote:
ThePacman wrote:What do I need to add to my .zshrc to set the title to the current command (plus arguments) when a command is run, and back to 'urxvt' when it finishes? The solution in this thread didn't work.
This is how I set my title at the moment, the script is not mine.
Variables found here:#Prompt_variables
This one shows  'date@tty/nr' so today '14-05-06@pts/4'
When I run xcalc from cli, the title shows: [qinohe@dryad]  @ (xcalc)
Thanks! It'll take a bit of fiddling to get it to be right for me, but this provides exactly the starting point I needed!
If anyone wants it, here's my completion:
case $TERM in
termite|*xterm*|rxvt|rxvt-unicode|rxvt-256color|rxvt-unicode-256color|(dt|k|E)term)
precmd () { print -Pn "\e]0;Terminal\a" }
preexec () { print -Pn "\e]0;$1\a" }
screen|screen-256color)
precmd () {
print -Pn "\e]83;title \"$1\"\a"
print -Pn "\e]0;$TERM\a"
preexec () {
print -Pn "\e]83;title \"$1\"\a"
print -Pn "\e]0;$TERM - $1\a"
esac
Last edited by ThePacman (2014-05-07 11:54:09)

Similar Messages

  • Urxvt terminal title set -- dynamic possibly?[solved]

    Does anyone know how I could set urxvt's title set to say my $PS1, I tried declaring it in my .XDefaults but it literally says echo $PS1 in the title when I do that....
    Or also I remember when I used xfce4-terminal I think it showed dynamically what was going on in the term title, is this achievable somehow?
    I'm bash btw.
    Thanks,
    bladdo
    Last edited by bladdo (2008-05-11 00:42:27)

    tami wrote:
    I have in my .bashrc:
    # Change the window title of X terminals
    if [[ $TERM =~ "xterm|*rxvt*" ]]; then
    # set -o functrace
    trap 'set_title' DEBUG
    fi
    I 'm sorry - I do not remember from where I grabbed it... Anyway - my urxvt window titles are changing dynamically. Don't forget to source your .bashrc after editing it though...
    I hope it will help you,
    tami
    At first I settled for it just showing my username/host/pwd in the titlebar. Then I really wanted dynamic, I looked and everywhere I saw online it said it was only achievable through zsh. Tami, your code error'd my term for some reason.
    Eventually I found out how to do it
    # urxvt title
    case $TERM in
    rxvt-256color)
    trap 'echo -ne "\e]0;$USER@$HOSTNAME: $BASH_COMMAND\007"' DEBUG
    esac
    Will display as :
    user@host: command
    PWD and TTY can be added in but it looks to stuffed then in my opinion. Just change the rxvt-256color to any term and it should work for you too
    -bladdo

  • Gnome-terminal title

    Hi guys,
    Sorry is this has been posted before but I searched and could not find anything. My Gnome-terminal title does not update as it should. I work on many remote servers daily and when I exit a server the title still says root@server when infact I'm working on my home directory. Is there a way to fix this?

    hussam wrote:in gnome-terminal. Open Edit > Current Profile > Title and Command.
    Check that 'Dynamically-set title' is set to 'Replace initial title' and not 'Isn't displayed'.
    I had that already, it should be like that by default afaik?

  • [SOLVED] Setting terminal title from within python

    I know the following commands can set the title of the terminal window:
    unset PROMPT_COMMAND
    echo -en "\033]2;[b]$1[/b]\007"
    However they do nothing if I call them from python using the commands module.
    Is there a way to enable my console python scripts to change the title of the terminal they are running in?
    Last edited by spupy (2009-11-25 19:44:30)

    Procyon wrote:>>> import sys
    >>> sys.stdout.write("\x1b]2;test\x07")
    Thank you very much!

  • [solved] urxvt terminal: Bitmap fonts not working

    Hello
    I can't get bitmap fonts to work with urxtv (aka rxvt-unicode).
    Here's output of fc-list : file -command
    $ fc-list : file
    Fontconfig warning: "/etc/fonts/conf.d/53-monospace-lcd-filter.conf", line 10: Having multiple values in <test> isn't supported and may not work as expected
    /usr/share/fonts/TTF/DejaVuSerif-BoldItalic.ttf:
    /usr/share/fonts/Type1/a010015l.pfb:
    /usr/share/fonts/TTF/comic.ttf:
    /usr/share/fonts/Type1/n019043l.pfb:
    /usr/share/fonts/TTF/DejaVuSans-ExtraLight.ttf:
    /usr/share/fonts/Type1/n019044l.pfb:
    /usr/share/fonts/TTF/DroidSansArmenian.ttf:
    /usr/share/fonts/TTF/times.ttf:
    /usr/share/fonts/TTF/DroidSansEthiopic-Regular.ttf:
    /usr/share/fonts/TTF/DejaVuSerif-Bold.ttf:
    /usr/share/fonts/Type1/n022003l.pfb:
    /usr/share/fonts/Type1/n022004l.pfb:
    /usr/share/fonts/TTF/arial.ttf:
    /usr/share/fonts/TTF/DroidSansHebrew-Regular.ttf:
    /usr/share/fonts/Type1/n021023l.pfb:
    /usr/share/fonts/Type1/n021024l.pfb:
    /usr/share/fonts/TTF/ariblk.ttf:
    /usr/share/fonts/Type1/n019023l.pfb:
    /usr/share/fonts/TTF/DroidSansFallbackLegacy.ttf:
    /usr/share/fonts/Type1/n022023l.pfb:
    /usr/share/fonts/TTF/verdana.ttf:
    /usr/share/fonts/Type1/n022024l.pfb:
    /usr/share/fonts/Type1/n019024l.pfb:
    /usr/share/fonts/TTF/TerminusBold.ttf:
    /usr/share/fonts/cantarell/Cantarell-Bold.otf:
    /usr/share/fonts/TTF/DejaVuSansCondensed.ttf:
    /usr/share/fonts/TTF/timesi.ttf:
    /usr/share/fonts/TTF/DroidKufi-Bold.ttf:
    /usr/share/fonts/TTF/VeraMoBI.ttf:
    /usr/share/fonts/TTF/DejaVuSansMono-BoldOblique.ttf:
    /usr/share/fonts/TTF/DroidKufi-Regular.ttf:
    /usr/share/fonts/Type1/n021003l.pfb:
    /usr/share/fonts/Type1/n021004l.pfb:
    /usr/share/fonts/TTF/andalemo.ttf:
    /usr/share/fonts/TTF/DroidSansHebrew-Bold.ttf:
    /usr/share/fonts/TTF/Ubuntu-B.ttf:
    /usr/share/fonts/TTF/Ubuntu-R.ttf:
    /usr/share/fonts/Type1/n019003l.pfb:
    /usr/share/fonts/TTF/Ubuntu-C.ttf:
    /usr/share/fonts/TTF/VeraMoBd.ttf:
    /usr/share/fonts/TTF/TerminusMediumItalic.ttf:
    /usr/share/fonts/TTF/DejaVuSerifCondensed-BoldItalic.ttf:
    /usr/share/fonts/TTF/DejaVuSerif-Italic.ttf:
    /usr/share/fonts/Type1/n019004l.pfb:
    /usr/share/fonts/TTF/VeraMoIt.ttf:
    /usr/share/fonts/TTF/DejaVuSansMono.ttf:
    /usr/share/fonts/TTF/DroidSansGeorgian.ttf:
    /usr/share/fonts/TTF/DroidSansEthiopic-Bold.ttf:
    /usr/share/fonts/TTF/Ubuntu-L.ttf:
    /usr/share/fonts/TTF/DroidSansJapanese.ttf:
    /usr/share/fonts/TTF/TerminusMedium.ttf:
    /usr/share/fonts/TTF/DejaVuSans-BoldOblique.ttf:
    /usr/share/fonts/TTF/VeraMono.ttf:
    /usr/share/fonts/TTF/DejaVuSansCondensed-Oblique.ttf:
    /usr/share/fonts/TTF/DroidNaskh-Regular.ttf:
    /usr/share/fonts/TTF/DejaVuSans.ttf:
    /usr/share/fonts/TTF/cour.ttf:
    /usr/share/fonts/TTF/georgia.ttf:
    /usr/share/fonts/TTF/DejaVuSansCondensed-Bold.ttf:
    /usr/share/fonts/TTF/VeraSe.ttf:
    /usr/share/fonts/TTF/UbuntuMono-BI.ttf:
    /usr/share/fonts/TTF/DroidSerif-BoldItalic.ttf:
    /usr/share/fonts/Type1/c059036l.pfb:
    /usr/share/fonts/TTF/VeraSeBd.ttf:
    /usr/share/fonts/TTF/DroidSans-Bold.ttf:
    /usr/share/fonts/Type1/c059033l.pfb:
    /usr/share/fonts/TTF/Ubuntu-RI.ttf:
    /usr/share/fonts/TTF/DejaVuSansMono-Oblique.ttf:
    /usr/share/fonts/cantarell/Cantarell-Regular.otf:
    /usr/share/fonts/TTF/VeraBI.ttf:
    /usr/share/fonts/TTF/DroidSansTamil-Regular.ttf:
    /usr/share/fonts/TTF/VeraIt.ttf:
    /usr/share/fonts/TTF/DroidSerif-Regular.ttf:
    /usr/share/fonts/TTF/DroidNaskh-Regular-SystemUI.ttf:
    /usr/share/fonts/Type1/d050000l.pfb:
    /usr/share/fonts/TTF/VeraBd.ttf:
    /usr/share/fonts/TTF/DroidSans.ttf:
    /usr/share/fonts/TTF/UbuntuMono-RI.ttf:
    /usr/share/fonts/Type1/c059016l.pfb:
    /usr/share/fonts/Type1/s050000l.pfb:
    /usr/share/fonts/TTF/verdanai.ttf:
    /usr/share/fonts/TTF/verdanaz.ttf:
    /usr/share/fonts/Type1/c059013l.pfb:
    /usr/share/fonts/TTF/Ubuntu-BI.ttf:
    /usr/share/fonts/TTF/verdanab.ttf:
    /usr/share/fonts/TTF/trebucit.ttf:
    /usr/share/fonts/TTF/DejaVuSerifCondensed-Italic.ttf:
    /usr/share/fonts/TTF/Ubuntu-LI.ttf:
    /usr/share/fonts/TTF/DejaVuSans-Bold.ttf:
    /usr/share/fonts/TTF/DejaVuSerif.ttf:
    /usr/share/fonts/TTF/georgiai.ttf:
    /usr/share/fonts/TTF/DejaVuSansMono-Bold.ttf:
    /usr/share/fonts/TTF/DroidSansThai.ttf:
    /usr/share/fonts/TTF/trebucbd.ttf:
    /usr/share/fonts/TTF/DejaVuSerifCondensed.ttf:
    /usr/share/fonts/TTF/couri.ttf:
    /usr/share/fonts/TTF/georgiab.ttf:
    /usr/share/fonts/Type1/b018032l.pfb:
    /usr/share/fonts/TTF/DroidNaskh-Bold.ttf:
    /usr/share/fonts/TTF/georgiaz.ttf:
    /usr/share/fonts/TTF/timesbi.ttf:
    /usr/share/fonts/TTF/arialbd.ttf:
    /usr/share/fonts/Type1/b018035l.pfb:
    /usr/share/fonts/TTF/UbuntuMono-B.ttf:
    /usr/share/fonts/TTF/trebucbi.ttf:
    /usr/share/fonts/TTF/UbuntuMono-R.ttf:
    /usr/share/fonts/TTF/arialbi.ttf:
    /usr/share/fonts/TTF/DroidSansArabic.ttf:
    /usr/share/fonts/TTF/timesbd.ttf:
    /usr/share/fonts/TTF/DroidSerif-Bold.ttf:
    /usr/share/fonts/TTF/DroidSansDevanagari-Regular.ttf:
    /usr/share/fonts/TTF/DejaVuSansCondensed-BoldOblique.ttf:
    /usr/share/fonts/Type1/z003034l.pfb:
    /usr/share/fonts/TTF/DroidSansFallback.ttf:
    /usr/share/fonts/TTF/courbi.ttf:
    /usr/share/fonts/TTF/comicbd.ttf:
    /usr/share/fonts/Type1/b018012l.pfb:
    /usr/share/fonts/Type1/p052004l.pfb:
    /usr/share/fonts/TTF/DroidSerif-Italic.ttf:
    /usr/share/fonts/TTF/webdings.ttf:
    /usr/share/fonts/Type1/b018015l.pfb:
    /usr/share/fonts/Type1/a010033l.pfb:
    /usr/share/fonts/TTF/DroidSansTamil-Bold.ttf:
    /usr/share/fonts/Type1/p052003l.pfb:
    /usr/share/fonts/Type1/a010035l.pfb:
    /usr/share/fonts/TTF/DejaVuSerifCondensed-Bold.ttf:
    /usr/share/fonts/Type1/n019063l.pfb:
    /usr/share/fonts/TTF/trebuc.ttf:
    /usr/share/fonts/TTF/courbd.ttf:
    /usr/share/fonts/Type1/n019064l.pfb:
    /usr/share/fonts/TTF/Vera.ttf:
    /usr/share/fonts/TTF/DroidSansMono.ttf:
    /usr/share/fonts/Type1/p052024l.pfb:
    /usr/share/fonts/TTF/impact.ttf:
    /usr/share/fonts/TTF/ariali.ttf:
    /usr/share/fonts/TTF/DejaVuSans-Oblique.ttf:
    /usr/share/fonts/Type1/a010013l.pfb:
    /usr/share/fonts/TTF/DroidSansFallbackFull.ttf:
    /usr/share/fonts/Type1/p052023l.pfb:
    What I've read, there should be /usr/share/fonts/local/* too in that list.
    I run my window manager, dwm with startx and ~/.xinitrc has these lines before dwm:
    xset +fp /usr/share/fonts/local
    xset fp rehash
    I have also tried to include those with xorg.conf:
    $ cat /etc/X11/xorg.conf
    Section "Files"
    FontPath "/usr/share/fonts/local/"
    EndSection
    I'm using Ubuntu's patched versions of freetype, fontconfig and cairo if that has anything to do with my problem:
    freetype2-ubuntu fontconfig-ubuntu cairo-ubuntu
    Xft fonts work fine with urxvt, but bitmaps don't. What am I missing?
    Last edited by NAND (2013-01-29 16:13:00)

    There isn't a "tamsynu" family in the tamsyn-font package.  You're trying to use a font that doesn't exist on your machine.
    $ xlsfonts -fn "-*-tamsynu-*"
    xlsfonts: pattern "-*-tamsynu-*" unmatched
    $ xlsfonts -fn "-*-tamsyn-*"
    -misc-tamsyn-bold-r-normal--0-0-100-100-c-0-iso8859-1
    -misc-tamsyn-bold-r-normal--12-87-100-100-c-60-iso8859-1
    << And more >>
    The syntax for the resource is fine, but it is case-sensitive.  The class is 'URxvt', an instance would be 'urxvt'.
    This should be good for a first attempt at the proper size:
    urxvt.font: -misc-tamsyn-medium-r-normal--14-101-100-100-c-70-iso8859-1
    urxvt.boldFont: -misc-tamsyn-bold-r-normal--14-101-100-100-c-70-iso8859-1
    That's about equal to DejaVu Sans Mono at 8 points.
    If you have rebuilt your font cache, either by restarting X or running 'fc-cache -f', and you want to use Xft, then this is equivalent (Tamsyn does not use anti-aliasing):
    urxvt.font: xft:Tamsyn:style=Regular:size=10.1
    urxvt.boldFont: xft:Tamsyn:style=Bold:size=10.1

  • Displaying bash-3.2$ in terminal [NOT-SOLVED after last upgrade]

    hello, I have this same problem: http://bbs.archlinux.org/viewtopic.php?id=39192 but the "solution" posted there does not help me at all, I wish I could reuse the old thread but the 'SOLVED' keyword in the title may be confusing so I'm starting a new one.
    the problem is that the prompt of my terminals (konsole, yakuake, xterm) is PS1='\s-\v\$ ' in all users; this started to happen after the last upgrade when the profile mechanism was changed somehow, I have no PS1 in my .bashrc and the PS1 in profile.bash is PS1='[\u@\h:\w]\n\$ '.
    an interesting thing to know is that the virtual consoles (the ones accessed with Ctrl+Alt+F[1-6]) have the right prompt, and sourcing /etc/profile also fixes the problem on the others so I'm guessing that some other configuration file (possibly KDE or X related) is overwriting my prompt but I can't find it! fgrep -R 'PS1' /etc/profile* only shows the one I set not the wrong one.
    /etc/profile and /etc/profile.bash are being loaded since the other declarations are present as well when running `set` only PS1 has changed it's value.
    any help is appreciated.

    still searching, first of all some tests I've made with the help of the guys at #bash
    [11:33] <`Samus_> guys is it possible that starting X somehow erases my prompt?
    [11:33] <`Samus_> I know that's is not purely bash and maybe OS-specific sorry
    [11:33] <`Samus_> but it's geting me nuts
    [11:33] <{xmb}> cant find it
    [11:34] * Vadi ([email protected]) has joined #bash
    [11:34] * Vadi ([email protected]) has left #bash
    [11:34] <pgas> `Samus_: where do you define your prompt?
    [11:34] * albech ([email protected]) has joined #bash
    [11:35] * Agiofws has quit (Remote closed the connection)
    [11:35] <`Samus_> is bieng defined in /etc/profile (/etc/profile.bash really but it-s sourced from there) there-s no PS1 in .bashrc and the rest of the variables are set
    [11:35] <`Samus_> the most weird part is that in the virtual consoles (Ctrl+Alt+[1-6]) is ok
    [11:36] <{xmb}> smells likke a code fault
    [11:36] <`Samus_> but everything under X not
    [11:36] <pgas> what if you do bash --login in xterm?
    [11:36] * Oper_ ([email protected]) has joined #bash
    [11:36] <`Samus_> let's see
    [11:37] <`Samus_> bash --login shows it ok
    [11:37] <`Samus_> in fact resourcing /etc/profile fixes it too
    [11:38] <{xmb}> code fault something where
    [11:38] <pgas> ok, so one of the script starting X sets PS!
    [11:38] <pgas> you are on debian? have you checked /etc/bash.bashrc ?
    [11:38] <`Samus_> that's what I think but I can't find it
    [11:39] <`Samus_> no I'm on archlinux
    [11:39] <pgas> what if you type just "bash" in a terminal?
    [11:39] <`Samus_> and it might be some mistake because it started to happen after the last upgrade
    [11:39] * floyd_n_milan ([email protected]) has joined #bash
    [11:39] * hark ([email protected]) has joined #bash
    [11:40] <`Samus_> 'bash' shows the wrong prompt, 'bash --login' the right one
    [11:40] <pgas> in a terminal with the correct PS1 that is
    [11:40] * osfulgore ([email protected]) has joined #bash
    [11:40] <`Samus_> oh, in a terminal with the right prompt it stays ok
    [11:40] * `Samus_ fells kinda lost...
    [11:41] <pgas> ok, so the problem seems to be in one of the script used to start X
    [11:42] * prince_jammys has quit ("Konversation terminated!")
    [11:42] * Oper_ has quit ("Íå çíàåòå Äàíèëà Áåðåíöåâà? Îí ñêîðî âñòðåòèòñÿ âàì! Íå ñëûøàëè òàêîãî àâòîðà? Äîñòàíüòå ïðÿìî çàâòðà!!!")
    [11:42] * Oper_ ([email protected]) has joined #bash
    [11:42] <`Samus_> grepping 'PS1' in /etc/X11 didn't showed anything
    [11:42] <`Samus_> some clue of what should I look for (or where)?
    [11:43] <pgas> startx? ask #archlinux?
    [11:43] <`Samus_> going...
    I've also tried different WMs (KDE, xmonad) and they have this same problem but then, "fgrep 'PS1' /usr/bin/startx" and "fgrep -R 'PS1' /etc/X11/" showed nothing!! now what?
    truly wtf...

  • How can I customize my terminal?[SOLVED]

    I'm using xterm and /bin/zsh, but it looks ugly. It's a white background with a black text. On debian, I use to right click and hit preferences and went from there. But when I right click it just highlights the shell. How can I customize background color, change font, etc?
    http://dwv91.deviantart.com/art/Twily-L … -426541695 How can I get my terminal to look like this? I know the color codes, but I don't know how to actually get there!
    Last edited by BabbyUser (2014-08-28 18:14:20)

    He/she lists everything they are using right under the screenshot:
    Much of the same from my other submission...
    Arch Linux with Awesome WM and custom tile layout. Also using Compton for composition.
    Firefox Nightly (Australis) [v31.0a1] and 4-Chan with my CSS. Using Vimperator for navigation.
    (Firefox CSS can also place an url-bar on top (below the tabs or merged with the tabs on the left) or at the bottom of the browser)
    Terminals (URxvt-256color) showing from left: screenfetch and ncmpcpp + mpd.
    My files can be found at twily.info (files updated for this theme May 17th, 2014)
    The Lemon font and my vol/bat widgets belong to github.com/phallus.
    Wallpaper: http://wallbase.cc/wallpaper/2…
    If I was you, I would go through each thing listed and figure out each one.  Understanding each element is essential.

  • Setting a dynamic urxvt window title

    Hi,
    I'm using urxvt windows for alot of apps and I don't like to have 6 windows in the taskbar that all say "urxvt [Number]").
    That's why I would like to have either the name of the last app started in urxvt or at least a tail output of what's currently in there.
    I understood that with
    printf '\33]2;%s\007' "foo"
    I can set the window title to foo but that was it.
    Does anyone know if/how I can put something dynamic to the console title bar?
    Doesn't have to be urxvt, but would be cool.
    Thanks in advance.
    Last edited by Zoranthus (2007-02-04 14:34:39)

    Following skymt suggestion, I found this script which should make the preexec() and precmd() work in bash too, but I'm too newbie to figure out how the whole works
    #!/bin/bash
    # preexec.bash -- Bash support for ZSH-like 'preexec' and 'precmd' functions.
    # The 'preexec' function is executed before each interactive command is
    # executed, with the interactive command as its argument. The 'precmd'
    # function is executed before each prompt is displayed.
    # To use, in order:
    # 1. source this file
    # 2. define 'preexec' and/or 'precmd' functions (AFTER sourcing this file),
    # 3. as near as possible to the end of your shell setup, run 'preexec_install'
    # to kick everything off.
    # Note: this module requires 2 bash features which you must not otherwise be
    # using: the "DEBUG" trap, and the "PROMPT_COMMAND" variable. preexec_install
    # will override these and if you override one or the other this _will_ break.
    # This is known to support bash3, as well as *mostly* support bash2.05b. It
    # has been tested with the default shells on MacOS X 10.4 "Tiger", Ubuntu 5.10
    # "Breezy Badger", Ubuntu 6.06 "Dapper Drake", and Ubuntu 6.10 "Edgy Eft".
    # This variable describes whether we are currently in "interactive mode";
    # i.e. whether this shell has just executed a prompt and is waiting for user
    # input. It documents whether the current command invoked by the trace hook is
    # run interactively by the user; it's set immediately after the prompt hook,
    # and unset as soon as the trace hook is run.
    preexec_interactive_mode=""
    # Default do-nothing implementation of preexec.
    function preexec () {
    true
    # Default do-nothing implementation of precmd.
    function precmd () {
    true
    # This function is installed as the PROMPT_COMMAND; it is invoked before each
    # interactive prompt display. It sets a variable to indicate that the prompt
    # was just displayed, to allow the DEBUG trap, below, to know that the next
    # command is likely interactive.
    function preexec_invoke_cmd () {
    precmd
    preexec_interactive_mode="yes"
    # This function is installed as the DEBUG trap. It is invoked before each
    # interactive prompt display. Its purpose is to inspect the current
    # environment to attempt to detect if the current command is being invoked
    # interactively, and invoke 'preexec' if so.
    function preexec_invoke_exec () {
    if [[ -n "$COMP_LINE" ]]
    then
    # We're in the middle of a completer. This obviously can't be
    # an interactively issued command.
    return
    fi
    if [[ -z "$preexec_interactive_mode" ]]
    then
    # We're doing something related to displaying the prompt. Let the
    # prompt set the title instead of me.
    return
    else
    # If we're in a subshell, then the prompt won't be re-displayed to put
    # us back into interactive mode, so let's not set the variable back.
    # In other words, if you have a subshell like
    # (sleep 1; sleep 2)
    # You want to see the 'sleep 2' as a set_command_title as well.
    if [[ 0 -eq "$BASH_SUBSHELL" ]]
    then
    preexec_interactive_mode=""
    fi
    fi
    if [[ "preexec_invoke_cmd" == "$BASH_COMMAND" ]]
    then
    # Sadly, there's no cleaner way to detect two prompts being displayed
    # one after another. This makes it important that PROMPT_COMMAND
    # remain set _exactly_ as below in preexec_install. Let's switch back
    # out of interactive mode and not trace any of the commands run in
    # precmd.
    # Given their buggy interaction between BASH_COMMAND and debug traps,
    # versions of bash prior to 3.1 can't detect this at all.
    preexec_interactive_mode=""
    return
    fi
    # In more recent versions of bash, this could be set via the "BASH_COMMAND"
    # variable, but using history here is better in some ways: for example, "ps
    # auxf | less" will show up with both sides of the pipe if we use history,
    # but only as "ps auxf" if not.
    local this_command=`history 1 | sed -e "s/^[ ]*[0-9]*[ ]*//g"`;
    # If none of the previous checks have earlied out of this function, then
    # the command is in fact interactive and we should invoke the user's
    # preexec hook with the running command as an argument.
    preexec "$this_command"
    # Execute this to set up preexec and precmd execution.
    function preexec_install () {
    # *BOTH* of these options need to be set for the DEBUG trap to be invoked
    # in ( ) subshells. This smells like a bug in bash to me. The null stderr
    # redirections are to quiet errors on bash2.05 (i.e. OSX's default shell)
    # where the options can't be set, and it's impossible to inherit the trap
    # into subshells.
    set -o functrace > /dev/null 2>&1
    shopt -s extdebug > /dev/null 2>&1
    # Finally, install the actual traps.
    PROMPT_COMMAND=preexec_invoke_cmd
    trap 'preexec_invoke_exec' DEBUG

  • Terminal unresponsive [solved]

    My terminal (xterm, urxvt, gnome-terminal and virtual terminal) doesn't respond to commands anymore. When I enter any command, for example "ls", it simply hangs and returns no output. When I try Ctrl + c to interrupt it, it prints "^C" and continues hanging.
    This started today, in a work meeting, after someone passed me a usb key with a .pptx document on it that I opened with OpenOffice. Restarting has no effect. I thought this might be my window manager (evilwm), so I reverted to Gnome, and eventually virtual terminals and the Fallback kernel. This makes no difference. I have made no updates to my system recently, and my computer worked fine until now.
    And here is where it gets really weird: everything that doesn't rely on the terminal works fine. I can login with evilwm or gnome and use any gui program like nothing was wrong (obviously gnome works better). I can manage wireless connections, edit text files, use the file manager, etc.
    Normally I am run a fairly bare system, with evilwm, wicd, mpd, hal, icrond and crond as daemons. I'd post logs and outputs, but frankly I'm completely at a loss as to what might be useful and not, and also, I'm just not sure how to go about it without the terminal to pipe output around.
    Any ideas or advice would be appreciated. Seeing as nautilus works I could just back up on a usb drive and nuke the whole thing, but I don't want to do just yet because 1) why did this happen, and what do I do if it happens again?, and 2) what if this was caused by a virus on the usb stick (from a windows machine) and will infect my usb drive?
    Last edited by gunnihinn (2011-04-28 07:44:48)

    Yes! .bashrc was the problem. I exchanged mine for one doing... well, nothing, and that solved the problem. Thanks for that.
    This still leaves a couple of questions open, most notably What is this i don't even. I'll check the lines in the old one by hand, maybe one of them is buggy and it only just showed up now.

  • [urxvt] Icon missing [solved]

    Hi there,
    I think it came with the latest Perl update that my urxvt no longer displays the icon properly.
    Screenshot: http://i.imgur.com/Q9HAhO3.png
    It just displays a generic icon for terminal windows.
    I have nothing changed in my ~/.Xresources:
    URxvt*iconFile: /usr/share/icons/elementary-xfce/apps/128/terminal.svg
    And I made sure that the icon still exists:
    ~ l /usr/share/icons/elementary-xfce/apps/128/terminal.svg
    lrwxrwxrwx 1 root root 22 2014-06-07 11:56:31.000000000 +0200 /usr/share/icons/elementary-xfce/apps/128/terminal.svg -> utilities-terminal.svg
    Can someone reproduce this issue?
    Installed packages:
    ~ pacman -Q | grep rxvt
    rxvt-unicode-patched 9.20-2
    rxvt-unicode-terminfo 9.20-2
    urxvt-perls 2.1-1
    Last edited by orschiro (2014-06-10 19:50:30)

    The issue with the missing icon is related to the bugs #FS36113, #FS35329 and #FS34862.
    Luckily there is a patched package called rxvt-unicode-pixbuf.
    Last edited by orschiro (2014-06-10 19:50:15)

  • Terminal Title

    hello
    i have this nasty problem with terminal emulators; which is the title bar. for example; i have 6 aterms and in  task-bar or alt+tab all say aterm; how could the title-bar be change to current command running or the current directory it is i; for example if i use aria2 it says aria2c .. and if i and in ~/.config the tiltebar say ~/.config ?

    To change the title to the current working directory, you could use something like this in your ~/.bashrc
    export PROMPT_COMMAND='echo -ne "\033]0;$PWD\007"'
    More information: http://tldp.org/HOWTO/Xterm-Title-4.html.

  • Set Terminal title via shell command

    Hi
    From xTerm under linux I know that it is possible to set the window title to the output of a special command with setttitle (e.g. to display the hostname of the machine I am on). Is there any possibility in Terminal.app? I'd be grateful for a workaround too. E.g. using apple-script to set the title.
    Thank you
    Bernhard
      Mac OS X (10.4.9)  

    Try using the following AppleScript:
    tell application "Terminal"
    set name of window 1 to "name"
    end tell
    To call it from the shell:
    osascript -e 'tell application "Terminal" to set name of window 1 to "name"'
    (21097)

  • IRSSI and Terminal Window [SOLVED]

    Hello,
    I recently installed Arch with Fluxbox in order to try it and I'm wondering if there is a way to start a terminal window then automatically have it run a command.
    For example, I'm currently working on editing my fluxbox menu and want to be able to open irssi automatically from the menu rather than having to open a terminal window to start it.  At first I tried just setting the command as "irssi" but this doesn't do anything.  Is there some way I can open a terminal window then have it execute irssi automatically?
    Thanks in advance!
    Last edited by celestialorb (2009-07-31 03:51:44)

    Yes you can do this, but the method is semi-dependent upon which terminal you're using. Urxvt looks like this:
    urxvt -e sh -c irssi
    where sh is the shell you want to launch the command under.
    EDIT: Beaten to the punch. You can use smurnjiff's method, if it works for you - but I've found that unless you specify a shell, urxvt fails to keep a window around long enough to do anything with the command. Works fine with one shot deals though - such as 'mpc prev' or similar.
    Last edited by synorgy (2009-07-31 03:44:45)

  • Terminal help [SOLVED]

    Hi,
    I'm (relatively) new here, been using Arch for about 6 months and I have found "my" ditsro!  One quick and probably stupid question:  In screenshots I see a cool arch logo in the terminal.  How do you get this?
    Thanks,
    Jim
    Last edited by Divingstar (2008-03-26 01:51:15)

    Do you mean the screenshot info grabber?
    edit: wow, beat by 7 seconds. sdfjhaklf.
    Last edited by tm8992 (2008-03-26 00:56:48)

  • Multiple "Open in Terminal" entries [Solved]

    Recently I upgraded from Gnome 3.8 to 3.10. After upgrade, whenever I right click on a folder I see "Open in Terminal" multiple times. Does any one know how to fix it?
    https://dl.dropboxusercontent.com/u/286 … enshot.png
    -- mod edit: read the Forum Etiquette and only post thumbnails http://wiki.archlinux.org/index.php/For … s_and_Code [jwr] --
    Last edited by nik (2013-10-21 22:54:40)

    gnome-terminal now includes this, but it might be that you have also the outdated nautilus extension installed. Try uninstalling nautilus-open-terminal.

Maybe you are looking for

  • EJB3 & Patterns: Transfer Objects

    EJB3 Entities look really nice, but I have a couple of slightly related questions... Now that our entities are also POJOs, do we need the TO pattern all that much? With EJB2 I would have the heavy entity/session beans create light POJO TOs to pass tr

  • Transport the sender and Receiver Structures of Retraction

    Hi, I would like to transport the sender structure which has been created in UPB_STRUCT and UPB_RULE. COuld some one tell me how to transport these objects.Points will be assigned. Thanks, Subha

  • ICloud Keychain verification code never arrives

    I erased all content and settings from my iPad and I was using iCloud Keychain for saving passwords. I have a dumb cell phone that works fine and receives SMS messages. I have tried at least 4 times to Restore Passwords Stored in iCloud Keychain with

  • Matrix object in matrix report

    hi friends I am designing a simple matrix report, data model - "select deptno , job , sum(sal) from emp group by deptno , job" now in the layout model i see that report builder has created a frame in which there is an object called "MATRIX verti rpea

  • Simple tab problem

    hi, in a JTextArea, if there's a tab in a line of text, if I get the text for this line (using getText() function of JTextArea, why does the tab disappears? -- the tab didn't even become whitespaces...