From owner-freebsd-questions Fri Dec 11 10:24:38 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA07753 for freebsd-questions-outgoing; Fri, 11 Dec 1998 10:24:38 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from pau-amma.whistle.com (s205m64.whistle.com [207.76.205.64]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA07747 for ; Fri, 11 Dec 1998 10:24:34 -0800 (PST) (envelope-from dhw@whistle.com) Received: (from dhw@localhost) by pau-amma.whistle.com (8.9.1/8.9.1) id KAA19076; Fri, 11 Dec 1998 10:23:32 -0800 (PST) (envelope-from dhw) Date: Fri, 11 Dec 1998 10:23:32 -0800 (PST) From: David Wolfskill Message-Id: <199812111823.KAA19076@pau-amma.whistle.com> To: freebsd-questions@FreeBSD.ORG, robert@namodn.com Subject: Re: xterm title/name In-Reply-To: Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >Date: Thu, 3 Dec 1998 19:07:34 +0000 (GMT) >From: Robert >Is there a way to change the title and name of a running xterm from the >commandline? Sure. >( I don't know a whole lot about how X programs are managed, but I want a >way to change the titlebar and iconified name of an xterm when certain >events happen; it would also be useful to change the iconified graphic ) >Even if I have to learn some wacky scripting language, that's ok too if >someone can point me in the right direction ) Below my .sig is a shar of a script I cobbled up for one of my colleagues to do it.... david -- David Wolfskill UNIX System Administrator dhw@whistle.com voice: (650) 577-7158 pager: (650) 371-4621 # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # xtt # echo x - xtt sed 's/^X//' >xtt << 'END-of-xtt' X#!/usr/local/bin/perl X X# Set window and/or icon title for xterms X X# David Wolfskill; Whistle Communications X# $Id: xtt,v 1.2 1998-10-07 12:48:09-07 dhw Exp $ X X# This script is arguably rather braindead; it uses the table X# of xterm "escape sequences" from the O'Reilly _X Window System X# User's Guide_, X11R5 version, p. 764. X Xuse File::Basename; Xuse Getopt::Long; X X$Getopt::Long::ignorecase = 0; X Xmy(%optctl) = ( both => \$b_text, X help => \$help_req, X name => \$n_text, X title => \$t_text, X Test => \$test_mode ); X Xmy($result) = &GetOptions(\%optctl, "both:s", "help", "name:s", X "title:s", "Test"); X# Command-line options: X# both: Text is for both title & name X# help: if specified, a usage message is issued & the script exits. X# name: Text is for name only X# title: Text is for title only X# Test: if specified, only mention what would have been done (test mode) X Xif (!($b_text || $n_text || $t_text)) { X $b_text = join(' ', @ARGV); X $help_req = 1 if (!$b_text); X} X Xif ($help_req) { X my($me) = basename("$0"); X print "Usage:\t$me [-both \"Title and name text\"] [-name \"Name text\"]\n"; X print "\t\t[-title \"Title text\"] [-help] [-Test]\n"; X print " or\n\t$me \"Title and name text\"\n"; X print "\nThe option names may be abbreviated; they are case-sensitive.\n"; X print "As shown, if you want to change both the name and the title,\n"; X print " you don't need to specify an option name.\n"; X print "Please note that some window managers may not actually use both values.\n"; X exit 0; X} X Xmy($string) = ""; X X$string .= &append("0", "$b_text") if ("$b_text"); X$string .= &append("1", "$n_text") if ("$n_text"); X$string .= &append("2", "$t_text") if ("$t_text"); X Xif ($test_mode) { X $string =~ s/\e//g; X $string =~ s/\a//g; X $string .= "\n"; X} X Xprint "$string"; X Xexit 0; X Xsub append { X# Given the cryptic xterm code & the text, return an appropriate xterm X# escape sequence. X X my($code) = shift; X my($text) = shift; X warn "Using the BEL character within the text is hazardous\n" X if ($text =~ /\a/); X return("\e]${code};${text}\a"); X} END-of-xtt exit To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message