[openbox] openbox focus wish list

Brett Campbell brett at custom-tech.net
Tue Oct 7 12:25:01 EDT 2003


> While this is good, is there a way to make the terminal title dynamic? 

I make my aterms dynamic by including this in my .zshrc:

# set titlebar and icon_name text if we're in X11
chpwd() {
    [[ -t 1 ]] || return
	[ -n "$DISPLAY" ] && print -Pn "\e]0;%~\a"
}
chpwd

Now, everytime i change directories or source my ~/.zshrc, the titlebar
is updated with the CWD.  I'm no guru, only a work-aroundist, and so
i've written several scripts as wrappers for commonly used applications
that change the titlebar text as needed. Here's an interesting one i use
when i login to my mail server:

#!/usr/bin/perl -w

$|++;   # piping-hot, bitch.

chomp ($host = `hostname`);
chomp ($user = `whoami`);

while (1) {
        open (LOAD, "/proc/loadavg") || die "Couldn't open " .
											"/proc/loadavg: $!\n";
        @load = split (/ /, <LOAD>);
        close LOAD;

        print "\e]0;$user\@$host  -  LoadAvg: $load[0] $load[1] $load[2] at  ";
        print scalar(localtime), "\a";

        sleep 2;
}

Many may find this silly, but it keeps the loadavg updating every two
seconds in the titlebar *shrug*

> AAhh, this is what PROMPT_COMMAND is for.   never mind.
Hmmm... never heard of this :-)  Interesting.

Have fun!
-- 
[ Brett R. Campbell ]
 -> Configuration Management / Systems Administration
 -> Collaborative Agent Design Research Center
 -> California Polytechnic State University, SLO, CA
 http://www.cadrc.calpoly.edu/frameset_content/content_about_us.html



More information about the openbox mailing list