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

Similar Messages

  • Dynamic browser window title

    Dear all
    In my Forms10g deployment, I have a unique browser window title for each separate form (i.e. one value of pagetitle per form in formsweb.cfg).
    If form A calls form B, and then control returns to form A, is it possible to dynamically alter the browser window title, perhaps by referring to the called form's entry in formsweb.cfg?
    Many thanks in advance.

    Check out webutil for this.
    Regards
    Grant Ronald
    Forms Product Management

  • 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

  • How to set the title of an urxvt window?

    Hello,
    I have read the manpage and FAQ on the urxvt website, but my problem persists:
    When I try to set the title of an urxvt window, for example:
    $ urxvt -title test
    then the new window shows for a second the title "test" and then switches  to "username@hostname:~".
    Yes, I have
    case $TERM in
    xterm*|*rxvt*|Eterm|eterm|rxvt-unicode|urxvt)
    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
    screen)
    PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
    esac
    in my .bashrc.
    But I think, the explicit command line option "-title" should break the .bashrc, right?
    The default setting by .bashrc is intentional, but in this specific case I would like to set the window title by hand.
    How can I do that?
    Last edited by indianahorst (2011-06-22 11:01:34)

    I would recommend that you not use the PROMPT_COMMAND to set your bash prompt at all.  Use the PS1 environment variable. By using PROMPT_COMMAND, you are invoking a subshell each time you hit return; which is most likely unnecessary.
    In fact, you are probably already setting PS1 in your .bashrc; and that is what is changing your window title.  You can set PS1 to a different value, and then it will not reset your window title with each command.
    Just set PS1 in your .bashrc to:
    PS1="[\u@\h \W]\$ "
    You can see a more complete list of the available \u, \H, etc. options here.
    If you do wish to reset the urxvt window title by setting PS1, do the following:
    PS1="[\u@\h \W]\$ "
    PS1="\[\e]2;\u \W\a\]$PS1"
    Edit:  As I look at this a little closer, I see that your PROMPT_COMMAND is indeed setting your window title.  You could change it to the following:
    PROMPT_COMMAND='echo -ne "${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}"'
    But I would still not use PROMPT_COMMAND and just set PS1 instead.
    Last edited by rockin turtle (2011-06-23 03:53:57)

  • The window title attribute for the page layout region has not been set

    Hi, I am a newbie to OA Framework extensions. Could you please advise me how to get rid of below error ?
    "The window title attribute for the page layout region has not been set. This attribute value will be used for the browser window title and should be set according to the UI standards. A default window title will be displayed for all such pages that violate the standards. Action: Set the window title or title attribute for the page layout region. The title attribute is used as a secondary source for the window title if the window title is missing."
    My requirement is to extend a VO and almost done with that but when i run the PG ( HomePG.xml ) file to ensure everything is fine , The target page is being displayed with above error. Just to let you know that i have already set the Titile and Window Title attributes for the HomePG.xml region i.e PageLayoutRN.
    One more thing i would like to share is that i was set the Window Title to 'Oracle Applications Home Page' , but target page name is being displayed as 'Oracle Applications'.
    Any suggestions ??
    Thanks.

    Hi all, I now getting below error when i click on notification from notification page ( AdvancWorklistPG.xml ) which should have taken me to the notification details page ( NotifDetailsPG ). Please note that i am running the page from Jdeveloper.
    Exception Details.
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT NtfEO.NOTIFICATION_ID,
    NtfEO.RECIPIENT_ROLE,
    NtfEO.BEGIN_DATE AS BEGIN_DATE_F,
    NtfEO.DUE_DATE AS DUE_DATE_F,
    DECODE(NtfEO.MORE_INFO_ROLE, NULL, NtfEO.SUBJECT, FND_MESSAGE.GET_STRING('FND','FND_MORE_INFO_REQUESTED')||' '||NtfEO.SUBJECT) AS SUBJECT,
    NtfEO.PRIORITY AS PRIORITY_F,
    NtfEO.STATUS,
    NtfEO.END_DATE AS END_DATE_F,
    NtfEO.USER_COMMENT,
    NtfEO.MORE_INFO_ROLE,
    NtfEO.FROM_USER,
    NtfEO.FROM_ROLE,
    NtfEO.TO_USER
    FROM WF_NOTIFICATIONS NtfEO
    WHERE NtfEO.NOTIFICATION_ID = ?
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:597)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.nav.OAPageButtonBarBean.processRequest(OAPageButtonBarBean.java:351)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:953)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1095)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2298)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1711)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    ## Detail 0 ##
    java.sql.SQLException: ORA-01008: not all variables bound

  • How to set window title using cfdocument format="FlashPaper" ?

    Does anyone know how to set the the browser window title when using:
    <cfdocument format="FlashPaper">
    #docContent#
    </cfdocument>
    The variable docContent is a fully formed html document, complete with <head> and <title> elements, yet <cfdocument> doesn't pick up the title I've specified. I'm wondering if anyone has done this before???
    Thanks!

    Yes, I tried that, but <cfdocument> replaces any content that I add. I cannot view the source for the page, but at least according to FireBug, when I view the page contents, I get:
    <html>
    <head>
    <title>print.cfm - print.cfm (application/x-shockwave-flash Object)</title>
    </head>
    <body marginwidth="0" marginheight="0">
    <embed width="100%" height="100%" type="plugin" src="http://127.0.0.1/tss/print.cfm?id=expeditions_staff&start=1" type="application/x-shockwave-flash">
    </body>
    </html>

  • Annoying font size in windows title

    First time I installed Arch 7.2 I had small fonts in Gnome windows title, so I had to set Font size of windows titles to 12 (10 its the default).
    After some upgrade, this was fixed, and I could set font size to 10.
    Tonight I did another upgrade, and window title fonts became small again, so I had to configure font size at 12 again.
    Any idea whats broken this? its not an important problem at all, but its kinda annoying...

    delphinen wrote:Tonight I did another upgrade, and window title fonts became small again, so I had to configure font size at 12 again.
    Any idea whats broken this? its not an important problem at all, but its kinda annoying...
    The obvious thing to look at is what did you upgrade?

  • How to set the WebDynpro application title (IE windows title)?

    Hello all,
    I would like to set the WebDynpro application title according to the current transaction ID. This title is the IE windows title that is shown on the upper left-corner of the IE browser.
    Rule: [Object Instance Information] u2013 [Application Title] u2013 [Browser Title]
    For example: Trans. <No.> - <My App> - Windows Internet Explorer
    I would like to set <No.> dynamically on run-time according to my current transaction number.
    I have this piece of code that gets a reference to the application info:
    data: lr_app_info TYPE REF TO if_wdr_rr_application.
    lr_app_info ?= wdr_task=>application->application_info.
    And there is lr_app_info->get_description() method to have the description of the application, but there is no set method.
    The application description can be hardcoded in:
    tx. SE80, opening the WebDynpro component, then accessing its WebDynpro application. In the properties tab, there is a description field. I need to append transaction ID to it.
    Do you know any way to implement this? This issue is for WebDynpro ABAP.  
    Best regards and thanks in advance,
    Fouad.

    Hello Satra,
    Thanks for your reply. I already had a look into that thread, but my question is not related to the windows title of the WebDynpro  component.
    My question is related to the title of the Internet Explorer that we all see on the top left-corner. For WebDynpro , this is the WebDynpro  application title. How can we change it?
    I hope my question is clear now, and I wish someone can help me soon.
    With kind regards,
    Fouad.

  • Displaying  Window Title Dynamically

    Hi Gurus,
    I have to display window title which is coming from T100 table. Based on the entered message number from t100 table i need to display the respective messagetext from  respective messageno from T100 table.Please let me know how to display window title dynamically from table T100.
    Points will be rewarded
    Thanks,
    Kishor

    Rather than reading from T001, you can just use the "message" verb to get the content and variable substitution done for you... so this may help:
    report zlocal_jc_sdn_titlebar1.
    data:
      g_title                 type sy-ucomm.
    parameter:
      p_gday                  type sy-datum.
    * Events:
    initialization.
      perform initialization.
    at selection-screen output.
      set titlebar 'MY_TITLE' with g_title. "MY_TITLE just contains &
    *&      Form  initialization
    form initialization.
      message e398(00) with 'Hello' sy-uname 'today is' sy-datum
        into g_title.
    endform.                    "initialization
    Jonathan

  • Question about Setting Window Title/the use of AVWindowSetTitle()

    Hi everyone,
    I have a question about setting the title of the window in which the Acrobat viewer normally opens a PDF file.  The documentation states that AVWindowSetTitle() cannot be used in this case.  However, using it has worked with versions of Acrobat/Reader up until and including version 8.
    Everything breaks down starting with Acrobat 9.
    According to the documentation I am supposed to do the following: "To set the title of a window in which the Acrobat viewer opens a PDF file, you must replace AVDocOpenFromASFileWithParams() and pass the window title in tempTitle."
    Unfortunately, there are 2 problems I have with this approach:
         I do need to be able to change the document title on document Save, not only on document Open
         I do not know what AVDocOpenFromASFileWithParams() implementation has to look like if I have to replace it using HFTReplaceEntry().
    Is there a sample customized implementation of AVDocOpenFromASFileWithParams() somewhere that I could take a look at?
    Is there a way to change a document Title inside Acrobat/Reader window after a Save operation?
    Thanks a million,
      Lana2010K

         I am sorry.  I don't know how you tested this and came to conclusion that this works correctly in Acrobat X.
         I just tested our Acrobat plug-in with a trial version of Acrobat X and this did not work.
         When we open a file in Acrobat (doing it ourselves in the plug-in by adding another specialized open) we set the window title to something different from the default file name.  Then if a file gets edited and saved (File->Save), the window title gets reset to the file name. In the PDDocDidSave callback we call AVWindowSetTitle() to set it back to a more descriptive window title we need.  This has worked up until and including Acrobat 8, but does not work in either version 9.0 or 10.0.
         Also, I just modified the plug-in code to always change the Window Title of every document (even if opened through native File->Open) on document Save.  It does not work.
         Please help,
              Lana2010K

  • Dynamically updating the window title?

    Is there a way to dynamically update the JFrame window title of my program?

    The "substring" method allows you to get any subpart
    of a String (and thus, in effect, "subtract" characters
    from a String).
    Please take a closer look at
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html
    Please don't ask every little question.

  • How can set window title programmatically

    how to set the window title programmatically
    for example the main vi i have a combo box  which stores some names
    exp: abc
            bcd
            cde
    then it will pass the data to another vi all the names use the same vi to display the data
    i want the window title to be the name of particular name user selected.
     can anyone help me?

    Hi jeyanthi,
    attached you will find an example.
    Hope it helps.
    Mike
    Attachments:
    Unbenannt 2_LV80.vi ‏13 KB

  • Setting the color of the window title in Forms 6i

    How does one control or set the color of the title of the MDI and module windows
    gordon
    [email protected]

    Gordon, I'm pretty sure this is actually outside the realms of Forms since the Window Manager is controlled by the O/S and so the only way you can set this is via the PC desktop (there is nothing exposed in Set_Window_Property that can do this).
    Hope this helps.
    Regards
    Grant Ronald
    Forms Product Management

  • How to set browser window title from FPM ?

    How do I set brwoser window title at runtime in FPM ?
    Using IDR area objetc I can set only apllication are(ident area) title, not the browser window title. Browser window title is set statically from iView name of in portal, and PFCG contect if in NWBC client.
    But in my case, I want to set it at runtime, for eg. in case of Purchase Order window, I want to set it as 'Purchase Order:<PO number>
    Is there any API to set this?
    Thanks again,
    Hari
    Edited by: Hari Krishnan P on Jun 9, 2010 10:22 AM

    When you call it as external window you may pass the title. other than that i am afraid you are left with no choice.

  • Set browser window title in template page

    Hi,
    How I can set the window title in template page ?
    I know how to do it in regular page:
    <af:document id="d1" title="Dashboard">
    But in template I don't have a document tag.
    so I added this before the <af:form> :
    <html>
    <head>
    <title> My title </title>
    </head>
    </html>
    But the problem is that I want to insert in the title something like that:
    title="#{generalPage.serverName}"
    Any ideas how can i do it ?
    Thanks

    You don't set the title in the template, you set the title in the page that is based on the template.
    There you will have the af:document tag.

Maybe you are looking for

  • How can I set the different boolean text in the button array?

    I created the OK boolean button array. How can I change the boolean text of each button to be different at run-time? I changed one, but the others are changed also.

  • How to see multiple levels of photo folders?

    Using my Apple TV2 and home sharing with iTunes on a Windows xp pro pc, my folder tree for ohotos has 4 levels  - my pictures, year, events, sub events; apple tv shows only the year level and groups together alll the photos in the sub folders. Is the

  • I was excited to take my new Ipad mini on a trip...but...

    My pictures look GREAT for the most part on the ipad but when I had them (many of them) processed, they are terrible. The colors are off and they are grainy.  Does anyone else have this problem?  There were some beautiful photos, taken in Portugal, b

  • REPORT-TOTAL GR VALUE MONTHWISE

    Dear Experts, Please tell me the t-codes for 1.viewing the total GR VALUE with respect to particular doc types for a month..

  • Planning level bps

    Hi all, I need to have a layout planning with possibility to choose value for some characteristic in the initial popup and for others characteristics only into the layout. I have the key figures in the lead column, the 0CALMONTH  in data column and t