View Full Version : To make xterm behave more like Terminal.app...
If you want to make xterm behave more like Terminal.app you can create a file called .Xdefaults in your home directory or just add the following if it already exists:
####START
## TERMINAL KEY SETTINGS
## Adjust to OSX Terminal.app behaviour
*VT100.translations: #override\
<Key>Prior: scroll-back(1,pages) \n\
<Key>Next: scroll-forw(1,pages)\n\
**** <KeyPress> K: clear-saved-lines() \n\
**** <KeyUp> K: send-signal(int) \n\
**** <KeyPress> P: print() \n\
**** <KeyPress> minus: smaller-vt-font() \n\
**** <KeyPress> KP_Subtract: smaller-vt-font() \n\
**** <KeyPress> plus: larger-vt-font() \n\
**** <KeyPress> KP_Add: larger-vt-font() \n\
**** <KeyPress> C: select-cursor-start() \
select-cursor-end(PRIMARY, CUT_BUFFER0) \n\
**** <KeyPress> V: insert-selection(PRIMARY, CUT_BUFFER0) \n\
**** <KeyPress> M: iconify() \n\
###END
You can also add a scrollbar, the cursor Color, bold and highlight color,
and the background and foreground color.
####START
*XTerm*deleteIsDEL: true
xterm*saveLines: 10000
xterm*scrollBar: true
xterm*rightScrollBar: false
xterm*jumpScroll: true
xterm*cursorColor: red
xterm*colorBD: darkblue
xterm*colorBDMode: true
xterm*highlightColor: yellow
xterm*Background: DarkSlateBlue
xterm*Foreground: black
###END
Then, I write the xterm startup command in my ~/.xinitrc file like this:
xterm -geometry 80x50+494+51 &
If Apple X11 don't read your .Xdefaults file by default (it does in my case), try by writing in your ~/.xinitrc file:
xrdb ~/.Xdefaults
Check man xterm for more, or look the html version with:
open /usr/X11R6/lib/X11/doc/html/xterm.1.html
or
launch -l /usr/X11R6/lib/X11/doc/html/xterm.1.html
Cheers...
Glanz
01-11-2003, 09:58 AM
Are you are missing a ")" after
select-cursor-end(PRIMARY)
Anyway, there's a problem in that line somewhere.
rusto
01-11-2003, 10:38 AM
The ) is at the end of the next line...unfortunately, the forums software wraps extra long lines that SHOULD appear on ONE line when you copy them to pico (or whatever you are editing with in Terminal).
Without the indentation that Sao showed above it would look like this:
select-cursor-end(PRIMARY, CUT_BUFFER0) \n\
Glanz
01-11-2003, 10:51 AM
Originally posted by rusto
Without the indentation that Sao showed above it would look like this:
select-cursor-end(PRIMARY, CUT_BUFFER0) \n\
DuH!!!!!!:D That's what I get for posting BEFORE my morning coffee. I put it in Nirvanna (Nedit) and the color codes highlighted the "error" of my copy/paste.
Thank you.
re-duh!
That makes Xterm look pretty spiffy!
Now it looks better. Thanks, guys. :)
Cheers...
rusto
01-11-2003, 11:10 AM
Very nice...also, after some fiddling I figgered out that you need to press the <option> key to be able to grab the scollbar.
:)
thatch
01-11-2003, 03:42 PM
Hmm, for me, it's the , <command> key.
Usually, in the scrollbar when I press the <command> key I would jump-scroll.
I would use the <option> key to grab the scrollbar.
And, when I pressed the <control> key I would get xterm 'Main Options' menu.
Cheers...
thatch
01-11-2003, 04:07 PM
sao, when I press the <control> key, I get the Main Options Menu. I am using the default setup with windowmaker though, no aqua wm here yet. I think in XDarwin prefs is where you can change those modifier keys. Also, I am on the Apple Pro Optical mouse, one button click only.
thatch,
Yes, it was the <control> key. I already edited my post, thanks. I guess I call it a night. It's already late in Singapore and I'm very sleepy.
Cheers...
thatch
01-11-2003, 04:24 PM
No problem sao. Sleep well my friend.
aisikl
01-13-2003, 05:46 AM
thanks for this great tip! would you have any idea how to change:
* the font and size
* make the window transparent
thanks a lot -- peter
aisikl wrote:
how to change: * the font and size
Try to run the command 'xfontsel &' and choose a font.
Then, call the xterm in your ~/.xinitrc file, for example like this:
xterm -fn "-adobe-new century schoolbook-medium-r-normal--25-180-100-100-p-136-iso8859-4" &
What's more difficult is to find a font that really looks good.
I don't think you can get transparency or pseudo-transparency with xterm. Apple's Terminal transparency is convenient because it's actually live and displays whatever is beneath it. But others like Eterm or Aterm, because of the limitations of X11, only read the root window's contents and use it to produce their own pixmap background.
Cheers...
bluehz
01-13-2003, 09:04 AM
Are you supposed to put ALL between a single set of START / END or as shown in two sections?
bluehz,
As you like it. It doesn't really matter.
Cheers...
Glanz
01-13-2003, 11:09 AM
Originally posted by aisikl
* make the window transparent
Eterm is, I believe, the only free term app that offers transparency. The command is 'eterm --trans', which may be added to any menu system, including Apple X11's menu with '/sw/bin/eterm --trans'
Glanz,
Eterm, as I posted above, offers no real transparency. Only pseudo-transparency. From man Eterm:
--trans
This gives a pseudo-transparent Eterm. The image is taken directly from the root
window, so any requests for changing the pixmap are ignored. If you do not use
Enlightenment (http://www.enlightenment.org/) as your window manager (or another com-
pliant window manager...I have been told that WindowMaker works also), you will need
to use the Esetroot program (found in the utils/ directory) to set your root back-
ground image.
Besides, I never got it to work in rootless.
Cheers...
aisikl
01-13-2003, 11:46 AM
thanks for the eterm tip -- i just installed it but god, are those backgrounds ugly -- thanks anyway, i'll stick to terminal and xterm for the moment -- :-)
Thanks to Mathias Meyer <mathmeye@users.sourceforge.net> (the xterm wizard), I now revise my previous post to make xterm behave more like terminal.app:
####START
## TERMINAL KEY SETTINGS
## Adjust to OSX Terminal.app behaviour
*VT100.translations: #override\
<Key>Prior: scroll-back(1,pages) \n\
<Key>Next: scroll-forw(1,pages)\n\
**** <Key> K: send-signal(int) clear-saved-lines() \n\
**** <KeyPress> P: print() \n\
**** <KeyPress> minus: smaller-vt-font() \n\
**** <KeyPress> KP_Subtract: smaller-vt-font() \n\
**** <KeyPress> plus: larger-vt-font() \n\
**** <KeyPress> KP_Add: larger-vt-font() \n\
**** <KeyPress> M: iconify() \n\
Alt <KeyPress> V: insert-selection(PRIMARY, CUT_BUFFER0) \n\
###END
You can also add a scrollbar, the cursor Color, bold and highlight color,
and the background and foreground color.
####START
*XTerm*deleteIsDEL: true
xterm*saveLines: 10000
xterm*scrollBar: true
xterm*rightScrollBar: false
xterm*jumpScroll: true
xterm*cursorColor: red
xterm*colorBD: darkblue
xterm*colorBDMode: true
xterm*highlightColor: yellow
xterm*Background: DarkSlateBlue
xterm*Foreground: black
###END
To scroll the xterm scrollbar continuously (without modifier key)
with a one button mouse (this just swaps button 1 and 2):
####START
*Scrollbar.translations: #override\
<Btn2Down>: StartScroll(Forward) \n\
<Btn1Down>: StartScroll(Continuous) MoveThumb() NotifyThumb() \n\
<Btn3Down>: StartScroll(Backward) \n\
<Btn1Motion>: MoveThumb() NotifyThumb() \n\
<BtnUp>: NotifyScroll(Proportional) EndScroll()
###END
To make the xterm scrollbar look more like the terminal.app scrollbar:
####START
## EXTRA SETTINGS FOR XAW SCROLLBAR
## see /usr/X11R6/include/X11/Xaw/Scrollbar.h
*Scrollbar.foreground: gray50
*Scrollbar.borderWidth: 0
*Scrollbar.shadowWidth: 0
*Scrollbar.thickness: 14
*Scrollbar.minimumThumb: 20
*Scrollbar.backgroundPixmap: gradient:horizontal?dimension=14&start=gray80&end=white
*Scrollbar.borderPixmap: gradient:horizontal?dimension=14&start=white&end=grey80
###END
thatch
01-23-2003, 07:31 PM
I had a problem with this today although I don't know for certain why. I updated my ~/.Xdefaults to the latest one and all seemed well at first. But later on in the day, when I tried to do some small copy and paste into an xterm, I would get the spinning rainbow cursor, and then eventually it would show just the letter 'v'.
I use PTHPasteboard and thought maybe something with the buffers was getting confused somehow. Then I noticed that my 'page up' and 'page down' buttons were doing the history dance instead of paging up or down. So, I went back to the original file and edited the first part for copy and paste. Now everything is working well again.
I've never had a problem with PTHPasteboard before and always found it to be an excellent program. But I went ahead and cleared my pasteboard buffer just to be certain it wasn't anything to do with that.
I haven't had enough time to fully troubleshoot all the possibilities here though. So, maybe I've overlooked something. I'll spend some more time with it when I get a chance.
thatch,
Yes, I changed it again too, but I followed this time a post to Apple's x11-users lists by Marc Lacas:
<<<<<<<<<<<<<<
For everyone who responded and everyone who wants to get X11, emacs and xterm working as it does in Terminal.app. . .
Here is what I finally had to do to get it all working properly:
First of all, here is my .xinitrc file:
(I took out all of the blank lines for compactness)
______________________________
#!/bin/sh
# $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $
# . /sw/bin/init.sh - I removed Fink for the time being. . .
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f $userresources ]; then
xrdb -merge $userresources
fi
if [ -f $usermodmap ]; then
xmodmap $usermodmap
fi
xterm -bg black -fg white -geometry 140x40+1+26 -ls -sb -rightbar -sl 10000 &
exec quartz-wm
______________________________
My .Xmodmap file:
______________________________
clear mod1
clear mod2
keycode 66 = ****_L
keycode 63 = Alt_L
add mod1 = Alt_L Alt_R
add mod2 = ****_L
keycode 59 = Delete
______________________________
My .Xresources file:
(the last line is really important. . .)
______________________________
XTerm*DeleteIsDEL: true
XTerm*BackarrowKey: false
XTerm*TtyModes: erase ^?
XTerm*VT100.metaSendsEscape: True
## TERMINAL KEY SETTINGS
## Adjust to OSX Terminal.app behaviour
*VT100.translations: #override\
<Key>Prior: scroll-back(1,pages) \n\
<Key>Next: scroll-forw(1,pages)\n\
**** <KeyPress> K: clear-saved-lines() \n\
**** <KeyUp> K: send-signal(int) \n\
**** <KeyPress> P: print() \n\
**** <KeyPress> minus: smaller-vt-font() \n\
**** <KeyPress> KP_Subtract: smaller-vt-font() \n\
**** <KeyPress> plus: larger-vt-font() \n\
**** <KeyPress> KP_Add: larger-vt-font() \n\
**** <KeyPress> M: iconify() \n\
Alt <KeyPress> V: insert-selection(PRIMARY, CUT_BUFFER0) \n\
______________________________
Had to add this to my .emacs file:
______________________________
(setq mac-command-key-is-**** nil)
______________________________
Finally, I had to do this:
______________________________
1) open /Applications/X11.app/Contents/Resources/English.lproj/main.nib in interface builder.
2) select the main menu instance and from there the edit menu. in the inspector remove the key equivalent 'v' for 'paste' so that there is no more key assigned to 'paste'
3) save the .nib
______________________________
>>>>>>>>>>>>>>
I joined to some of the things I wrote in my previous post.
thatch,
Mathias Meyer graciously shared his .Xdefaults file with us, try this new settings to see if they work for you:
## XTERM SETTINGS
## see /usr/X11R6/lib/X11/doc/html/xterm.1.html
## or man xterm
*XTerm*deleteIsDEL: true
xterm*saveLines: 10000
xterm*scrollBar: true
xterm*rightScrollBar: true
xterm*jumpScroll: true
xterm*cursorColor: grey30
xterm*colorBD: darkblue
xterm*colorBDMode: true
xterm*highlightColor: grey70
xterm*activeIcon: false
xterm*awaitInput: true
xterm*scrollTtyOutput: false
xterm*scrollKey: true
## TERMINAL KEY SETTINGS
## Adjust to OSX Terminal.app behaviour
*VT100.translations: #override\
<Key>Prior: scroll-back(1,pages) \n\
<Key>Next: scroll-forw(1,pages)\n\
**** <Key> K: send-signal(int) clear-saved-lines() \n\
**** <Key> P: print() \n\
**** <Key> minus: smaller-vt-font() \n\
**** <Key> KP_Subtract: smaller-vt-font() \n\
**** <Key> plus: larger-vt-font() \n\
**** <Key> KP_Add: larger-vt-font() \n\
**** <Key> C: select-cursor-start() \
select-cursor-end(PRIMARY, CUT_BUFFER0) \n\
**** <Key> V: insert-selection(PRIMARY, CUT_BUFFER0) \n\
**** <Key> M: iconify() \n\
## EXTRA SETTINGS FOR XAW SCROLLBAR
## see /usr/X11R6/include/X11/Xaw/Scrollbar.h
## for full reference of available recources
*Scrollbar.background: gray50
*Scrollbar.foreground: gray50
*Scrollbar.borderWidth: 0
*Scrollbar.shadowWidth: 0
*Scrollbar.thickness: 14
*Scrollbar.minimumThumb: 20
*Scrollbar.backgroundPixmap: gradient:horizontal?dimension=14&start=gray80&end=white
*Scrollbar.borderPixmap: gradient:horizontal?dimension=14&start=white&end=grey80
*Scrollbar.translations: #override\
<Btn2Down>: StartScroll(Forward) \n\
<Btn1Down>: StartScroll(Continuous) MoveThumb() NotifyThumb() \n\
<Btn3Down>: StartScroll(Backward) \n\
<Btn1Motion>: MoveThumb() NotifyThumb() \n\
<BtnUp>: NotifyScroll(Proportional) EndScroll()
This settings work great in my machine.
thatch
01-25-2003, 03:45 PM
Hi sao,
Thanks for the new file. I'm having some odd problems with it. I have two xterm windows that come up side by side upon start. The left one is exhibiting the old behavior from the prior Xdefaults file even though I renamed the original file to Xdefaults.bak, while the right one appears to be the new file settings. Maybe I should have also moved Xdefaults.bak to another location? Hmmm. I'm sure I'll figure it out eventually and get them the way I want. It's just a matter of some minor editing here and there.
Best,
thatch
thatch
01-26-2003, 03:21 AM
Follow up from last post...
I got rid of the Xdefaults.bak and tweaked the setting for the way I like. But a login window doesn't get the setting for highlightColor while the second window does. I also couldn't get the rightScrollBar to work in a login window, only in the other window. Weird huh?
almage
01-07-2005, 01:58 PM
Thanks for all the details in this thread.
I've been a part-time Unix admin and full time Mac user for almost 15 years, and we are finally working on porting our Unix-only work to Mac OS X machines, now that OS X has gotten some of the 'birthing-bumps' out of the way.
Most of my Unix experience has been with Motif-based systems, and I'm unaccustomed to the AW scroll bars and window attributes. I've been hoping for a Terminal.app-like X Window terminal application - and the info in this post has helped me overcome many of the things I dislike about AW scrollbars (still ugly in my opinion - but functionally much better!).
After copying the last version of Mathias Meyer's .Xdefaults file to mine (thank you kind sir!) and restarting X11, the xterm window functioned much nicer.
However, after displaying the contents of a file (using 'cat') whose display caused the window to scroll, I intended to select the displayed text by holding down the mouse button and moving the cursor upwards past the top of the window. I expected the window automagically scroll and continue to select the text, as it does in Terminal.app and my Unix-only machine dtterm. :confused:
Any ideas about how to enable this functionality?
There are workarounds, such as copying the file to another, and opening the new file in an editor (either command line or Aqua). However, I've become accustomed to the select and copy method and would like to 'allow' it, if I can figure out how to configure the xterm settings.
regards,
almage
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.