PDA

View Full Version : Changing xterm colors/prompts?


Titanium Man
02-06-2002, 08:22 PM
Hi everyone, I was wanting to set my xterm window (in XDarwin/Window Maker) to the same lovely colors and prompt that I have in Terminal. I've changed the default Terminal settings by creating this file ~/Library/init/tcsh/rc.mine and putting "set prompt="%{\033[0;1;32m%}[%{\033[37m%}%t %n %{\033[32m%}%{\033[33m%}%c3%{\033[32m%}]%{\033[0m%}%#"". (All one line) My question is, how would I do the same for the xterm window in XDarwin/Window Maker, and how would I set the prompt for different shells that I use (in Terminal)? My tcsh prompt is like this

[7:00pm titaniumman ~/Library/init/tcsh]%

but when I switch to sh I get:

localhost%

My XDarwin version is 1.0.5 and I have XFree86 4.1.99.1 My versions of sh, csh, and zsh came with OSX and are in /bin/ and I got bash from fink, so it's in /sw/bin/bash. Sorry about too much info regarding version numbers and location of shells, but I want to make this as easy to answer as possible. Thanks,
TiMan

sao
02-07-2002, 08:20 AM
Hi there!


-bg -color- for background, and -fg -color- for font color.

So for example, to change the colors for only one run of xterm:

code:
------------------------------------------------------------------------

xterm -bg steelblue4 -fg grey88
------------------------------------------------------------------------

Replace the colors as desired. For a list of all color names X11 recognizes, type "showrgb".

To make the changes permanently:

create (if it doesn't already exist) a file ~/.Xdefaults and add the lines for example:

code:
------------------------------------------------------------------------

XTerm*background: steelblue4
XTerm*foreground: grey88
------------------------------------------------------------------------

To create an alias, and you haven't changed the shell you use (so it's still tcsh), you can run

code:
------------------------------------------------------------------------

alias myxterm "xterm -bg bgcolor -fg fgcolor"
------------------------------------------------------------------------

Where myxterm is the alias name (make it whatever you want). The problem with this is it only lasts until you close that particular xterm/Terminal window.

To make it permanent (and again, this is for the default tcsh), edit your ~/.tcshrc and add that alias line above to it. Now, when you login, it should pick up the alias automatically.

My invocation of xterm looks like this:

"xterm -j -rightbar -sb -sl 1000 -bg black -fg yellow -bd yellow &"


xterm doesn't support transparency, but you can get it if you install eterm or aterm.(pseudo-tranparency)

There are many more useful options take a look at:

man xterm

Also, I set my term prompt in ~/.tcshrc and I add at the end "source ~/.cshrc"


Cheers...

Titanium Man
02-08-2002, 01:27 AM
Hi sao, thanks for replying! I must admit I'm still confused, though. You see, I don't HAVE a /.tchsrc file. I've modified my terminal by putting this

set prompt="%{\033[0;1;32m%}[%{\033[37m%}%t %n %{033[32m%}%{\033[33m%}%c3%{\033[32m%}]%{\033[0m%}%# "

in ~/Library/init/tcsh/rc.mine

After reading some of the other posts (including that fink one you mentioned on newbies being able to properly combine .tcshrc and .cshrc files) I'm still in the dark about what to do. If I modify .tchsrc and fink or something else installs something in .cshrc, (if I understand what I've read), .cshrc wil take precedence since it's read sooner, so I've just stuck to modifying the rc.mine file. Anyway, bearing that in mind, can you offer any advice about modifying the xterm colors (and prompts for other shells such as bash or sh)? By the way, I was having partial success with your recommendations. I just was unable to keep the colors when I opened a new xterm. Thanks!

sao
02-08-2002, 02:10 AM
Hi Timan,

Sorry I can't be of help with bash prompts, I don't use it. But you can check at:

http://www.linuxdoc.org/HOWTO/Bash-Prompt-HOWTO/

or

http://linuxbrit.co.uk/bashprompt/

One way you can keep your colors in xterm is if you use windowmaker and your xterm is in the dock, then choose the colors you want when you open it, and then open workspace in you applications menu and click save session.

Then quit XFree, and when you came back and start the xterm from the dock you should have the colors you selected.

About the prompts, the way I told you works for me. By the way I was also concerned with creating a ~/.tcshrc file because of losing fink. Then I tried rusto post at:

http://forums.osxhints.com/showthread.php?s=&threadid=421

And, by advice of pmccann, wrote at the end "source ~/.cshrc" and it worked.

Now I get my terminal prompt and my eterm prompt same.


Cheers...

Titanium Man
02-08-2002, 11:31 PM
Hmm, still not working; I'll have to play around with this some. Thanks for replying!