NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Tweeking xterm -title



At Mon, 23 Dec 2024 18:39:41 -0500, Todd Gruhn <tgruhn2%gmail.com@localhost> wrote:
Subject: Tweeking xterm -title
>
> (/usr/pkg/bin/xterm    -geometry 80x46+0+0    -title  "$(date "+%A
> ----- %d - %B - %Y")"  )  &
>
>
> Print todays-name and date.

Note that, as I think others may have mentioned before, that'll just set
the title to the date time you start the xterm.  It won't keep it
updated.

I've long put the current time in my shell prompt, but never in a window
title.  I run an xclock (or actually two, one with a dial, one digital)
to see the current date and time.

Note you can very easily update the title of your xterm from within by
generating output using the appropriate shell function.

I have my shell environment set up such that I wrap some commands, most
especially "cd" with an alias and/or a function (depending on the shell
type) such that the wrapper can call a function to change the window
title every time I change directories in the shell session.

The guts of that shell function boil down to a "printf" command
(nominally, or an "echo" command if the host system has no printf(1))
that sets the title to the value of a shell variable:

	printf "\033]0;%s\007" "${TBANNER}"

As I may have mentioned before, all the gory details to my login setup
can be found here:

	https://github.com/robohack/dotfiles

If you have any questions, let me know!


> How do I print it as black-text in the xterm-frame??

I think that'll depend on which window manager you use.  In X11 the
window manager is in charge of the window decorations (frame border,
title, etc.).  For ctwm(1) the "TitleForeground" and "TitleBackground"
lists are used to set the colours of the window titles.


> AND why can I only do this on the first xterm ??

I'm not sure what you mean.  Are you not starting all xterms with the
same "-title" argument every time?


> startx -- --   fails for some reason.

Why specify the '--' option when you have no other options?

Why specify the '--' option twice?

The output from startx should directly show any obvious errors on the
terminal shell session where you run it from.  (There may/will also be
logs generated by the Xserver program itself.)

"startx" is just a shell script, so you can run it with "sh -x" to see
what it is doing and how far it gets.

--
					Greg A. Woods <gwoods%acm.org@localhost>

Kelowna, BC     +1 250 762-7675           RoboHack <woods%robohack.ca@localhost>
Planix, Inc. <woods%planix.com@localhost>     Avoncote Farms <woods%avoncote.ca@localhost>

Attachment: pgpYATkmCLZ57.pgp
Description: OpenPGP Digital Signature



Home | Main Index | Thread Index | Old Index