Configuring XTerm

I've tried including xrdb ~/.Xresources both in my ~/.xinitrc and in /usr/local/etc/xdg/lxsession/LXDE/autostart but neither seems to work.

Is the line really "xrdb ~/.Xresource"? If so that may be the issue, I think you need either "xrdb -merge $HOME/.Xresources" or "xrdb -load $HOME/.Xresources" Some shells may not expand "~" to "$HOME"
 
schweikh, I'm trying to copy what you have but fully understand what you do....

Assuming I've copied your codeblock into a file, what do you have in .xinitrc?

Does the above codeblock exist on your system as ~/lib/app-defaults/XTerm?
 
schweikh, I'm trying to copy what you have but fully understand what you do....

Assuming I've copied your codeblock into a file, what do you have in .xinitrc?

Does the above codeblock exist on your system as ~/lib/app-defaults/XTerm?
Yes, it is in ~/lib/app-defaults/XTerm

I do not start X11 automatically (no xdm, gdm or similar). I log in on the console, my shell startup has export XAPPLRESDIR="$HOME/lib/app-defaults". Then I may run startx which inherits the XAPPLRESDIR variable. In .xinitrc I simply start a few xterms.
If you use a display manager and start X11 automatically, you should place export XAPPLRESDIR="$HOME/lib/app-defaults" in your .xinitrc prior to starting client programs.
 
Thanks for the explanation schweikh.

I'm trying figure out how to incorporate your XTerm configuration into my setup. Like you, I first log in on the console and run startx to start my Window Manager, LXDE. I start XTerm via /usr/local/etc/xdg/lxsession/LXDE/autostart :-

Code:
@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@xscreensaver -no-splash
xterm -e tmux

Here is my .xinitrc:-
Code:
xrdb .Xdefaults
ck-launch-session dbus-launch --exit-with-session startlxde

.Xdefaults:-
Code:
xterm*background:    black
xterm*foreground:    cyan
xterm*maximized: true
xterm*metaSendsEscape: true

! xterm*faceName: Liberation Mono:size=10:antialias=false
! xterm*font: 7x13

Assuming I have your ~/lib/app-defaults/XTerm as ~/xtermrc, is there a simple way to include it in my setup:

I did look at xterm(), but my eyes just glazed over after half an hour :)... I suspect there is a parameter I may be able add to my xterm invocation to have the desired effect but a lot of trial and error would probably be required. I'm sure a XTerm guru like yourself could suggest something.
 
Assuming I have your ~/lib/app-defaults/XTerm as ~/xtermrc, is there a simple way to include it in my setup:
No, you can't force xterm to treat an arbitrary file as an xterm-specific resource file not requiring class name prefixes.
You must set XAPPLRESDIR and you must name the resource file XTerm, because the X toolkit looks for a file matching the class name in XAPPLRESDIR.
If you want to go the XAPPLRESDIR way only for xterm and not for other clients, you may do that with a one-shot variable assignment in your autostart:
XAPPLRESDIR=$HOME xterm -e tmux # and make sure $HOME/XTerm exists.
This assumes LXDE runs the autostart commands in a shell and $HOME is set.
 
No, you can't force xterm to treat an arbitrary file as an xterm-specific resource file not requiring class name prefixes.
You must set XAPPLRESDIR and you must name the resource file XTerm, because the X toolkit looks for a file matching the class name in XAPPLRESDIR.
If you want to go the XAPPLRESDIR way only for xterm and not for other clients, you may do that with a one-shot variable assignment in your autostart:

This assumes LXDE runs the autostart commands in a shell and $HOME is set.
Many thanks for this. It works just as you sugested.

I think I will spend the next week studying this goldmine to see how it does what it does.

On thing I don't see is the menu on the top line of the screenshot in your post #15 of this thread. Should I expect to see it?
 
On thing I don't see is the menu on the top line of the screenshot in your post #15 of this thread. Should I expect to see it?
Does the "Toolbar" entry appear in the "Main Options" menu when you Control-LeftClick? If not, then xterm was not compiled with the TOOLBAR option set.
To do so for all your future xterm port compilations:
echo 'x11_xterm_SET = TOOLBAR SCRNDUMP' >> /etc/make.conf
cd /usr/ports/x11/xterm
make deinstall
make reinstall
 
I avoid the whole startup file and xrdb variance by exporting XAPPLRESDIR=$HOME/lib/app-defaults from within .xinitrc prior to launching xterm. Then in the indicated directory place the resource file $XAPPLRESDIR/XTerm (note capitalization) with just the xterm resources. This avoids the use of xrdb after changing XTerm.

Code:
! Values set here may be overridden by xrdb -load .Xresources or xterm command line options.
!
!
! Set TERM to this value (overridden by -tn option).
! Some applications (mutt) refuse to use 256 colors with plain "xterm".
*termName: xterm-256color
! Unlike keyboardtype vt220, sun allows to use shifted function keys.
! *keyboardType: sun breaks nvim function keys (all dead).
*keyboardType: tcap
*sunKeyboard: true
*metaSendsEscape: false
! Default line width (80 + margin for line number in vim).
!*geometry: 85
*geometry: 100
! A decent dark grey default background.
*background: rgb:1/1/1
! A soft beige as the default foreground.
*foreground: rgb:e/a/7
! Display the toolbar with the menu entries.
*toolBar: true
! No toolbar for the small console window started with "xterm -name Console".
Console*toolBar: false
! Increase the number of saved lines.
*saveLines: 1024
! Any shell run in xterm shall be a login shell
! (and thus read /etc/profile and ~/.profile).
*loginShell: true
! Do not copy trailing spaces when selecting.
*TrimSelection: true
*charClass: 33:48,37:48,43-47:48,64:48
! Unicode everywhere, please.
*locale: UTF-8
*vt100.utf8: 1
*utf8Title: true
! The pointer.
*pointerColorBackground: red
*pointerColor: yellow
! The cursor rectangle.
*cursorColor: red
! Distance to first character cell.
xterm.form.vt100.BorderWidth: 1
! Color around vt100 window.
*vt100.borderColor: brown
*allowWindowOps: true

! Fonts & colors for "Main Options", "VT Options", "VT Fonts", "Tek Options" buttons in menu bar.
*menubar.mainMenuButton.font:\
    -misc-fixed-bold-r-normal--18-120-*-*-c-70-iso10646-1
*menubar.mainMenuButton.foreground: rgb:80/80/f0
*menubar.vtMenuButton.font:\
    -misc-fixed-bold-r-normal--18-120-*-*-c-70-iso10646-1
*menubar.vtMenuButton.foreground:   rgb:c0/40/f0
*menubar.fontMenuButton.font:\
    -misc-fixed-bold-r-normal--18-120-*-*-c-70-iso10646-1
*menubar.fontMenuButton.foreground: rgb:f0/80/80
*menubar.tekMenuButton.font:\
    -misc-fixed-bold-r-normal--18-120-*-*-c-70-iso10646-1
*menubar.tekMenuButton.foreground:  rgb:f0/80/80
! Background for all menu bar buttons.
*menubar*background: gray30

! Menu bar background pixmap is a spectrum from blue to red.
*menubar.backgroundPixmap:\
    gradient:horizontal?dimension=250&start=blue3&end=red2
! No 3d look around the spectrum.
*menubar.displayList:

*printAttributes: 3
*printerCommand: cat > xterm.window.html; firefox xterm.window.html

! Give menu bar buttons a 3d look with a one pixel wide border.
*menubar*displayList:\
       fg gray60;\
       lines -1,+0,+0,+0,+0,-1;\
       fg gray10;\
       lines +1,-1,-1,-1,-1,+1

! The menu bar popup menus shall have a 1 pixel wide colored border.
*menubar*SimpleMenu.displayList:\
       fg magenta;\
       lines -1,+0,+0,+0,+0,-1;\
       fg red;\
       lines +1,-1,-1,-1,-1,+1

! Gray pixmap of area to the right of the spectrum.
*form.backgroundPixmap: gradient:vertical?dimension=30&start=gray60&end=gray10

! Switch 3d look when entering/leaving buttons.
*MenuButton.translations:\
 <Enter>: set-values(1, displayList, "fg gray60; lines 1,-1,-1,-1,-1,1;   fg gray10; lines -1,0,0,0,0,-1")\n\
 <Leave>: set-values(1, displayList, "fg gray60; lines -1,+0,+0,+0,+0,-1; fg gray10; lines +1,-1,-1,-1,-1,+1")\n\
 Any <BtnDown>: PopupMenu()
 ! Main menu heading font.
*mainMenu*menuLabel.font: -b&h-lucida-bold-i-*-*-34-*-*-*-*-*-*-15
*mainMenu*menuLabel.foreground: rgb:80/80/f0
! Main menu entries font.
!*mainMenu*font: -adobe-helvetica-medium-r-*-*-14-*-*-*-*-*-*-* !small screen
*mainMenu*font: -adobe-helvetica-medium-r-normal-*-20-*-*-*-*-*-*-15
*mainMenu*backgroundPixmap:\
    gradient:vertical?dimension=800&start=gray10&end=magenta4
*vtMenu*menuLabel.font: -b&h-lucida-bold-i-*-*-34-*-*-*-*-*-*-15
*vtMenu*menuLabel.foreground: rgb:c0/40/f0
*vtMenu*font: -adobe-helvetica-medium-r-normal-*-20-*-*-*-*-*-*-15
*vtMenu*backgroundPixmap:\
    gradient:vertical?dimension=720&start=rgb:10/10/30&end=rgb:0/7/7
*fontMenu*menuLabel.font: -b&h-lucida-bold-i-*-*-34-*-*-*-*-*-*-15
*fontMenu*menuLabel.foreground: rgb:f0/80/80
*fontMenu*font: -adobe-helvetica-medium-r-normal-*-20-*-*-*-*-*-*-15
*fontMenu*backgroundPixmap:\
    gradient:vertical?dimension=670&start=gray10&end=rgb:50/20/20
*tekMenu*menuLabel.font: -b&h-lucida-bold-i-*-*-34-*-*-*-*-*-*-15
*tekMenu*menuLabel.foreground: rgb:80/f0/80
*tekMenu*font: -adobe-helvetica-medium-r-*-*-14-*-*-*-*-*-*-*
*tekMenu*backgroundPixmap:\
    gradient:vertical?dimension=400&start=gray10&end=rgb:20/50/20
*VT100.utf8Fonts.font: -adobe-helvetica-medium-r-*-*-14-*-*-*-*-*-*-*
*SimpleMenu*menuLabel.vertSpace: 10
*SimpleMenu*HorizontalMargins: 32

! A scroll bar to the right, please, but not in "xterm -name Mutt -e mutt",
! or "-name Tin" where they are useless.
*scrollBar: true
Mutt*scrollBar: false
Tin*scrollBar: false
*VT100.rightScrollBar: true
*Scrollbar.thickness: 36
*Scrollbar.backgroundPixmap:\
    gradient:horizontal?dimension=36&start=red4&end=rgb:20/10/10
*VT100.Scrollbar.thumb: vlines2
*VT100.scrollbar.displayList:\
       fg gray30;\
       lines +1,-1,-1,-1,-1,+1;\
       fg gray50;\
       lines -1,+0,+0,+0,+0,-1
*VT100.Scrollbar.background: black
*VT100.Scrollbar.foreground: gray30

! Run 'fc-list :scalable=true:spacing=mono: family' to find the list of
! scalable mono spaced fonts available as the faceName.
! Setting faceName also sets the "TrueType Fonts" option.
!*faceName: Monaco
! Default faceSize
*faceSize: 10
*fontMenu*fontdefault*Label: Default 10pt
*fontMenu*font1*Label: Size 8pt
*fontMenu*font2*Label: Size 9pt
*fontMenu*font3*Label: Size 10pt
*fontMenu*font4*Label: Size 12pt
*fontMenu*font5*Label: Size 15pt
*fontMenu*font6*Label: Size 20pt
*faceSize1: 8
*faceSize2: 9
*faceSize3: 10
*faceSize4: 12
*faceSize5: 15
*faceSize6: 20

! Only highlight the selected text, not the whole line, just like vim does.
*highlightColorMode: true
*highlightColor: rgb:00/33/99
*highlightTextColor: rgb:66/ff/ff
*highlightReverse: false

*boldMode: true
! Text with the underline attribute shall be rendered in italic.
!!!*italicULMode: true
*colorAttrMode: false
!*VT100*colorMode: true  (true by default)
! Bold shall be rendered bold, not colored.
*VT100*colorBDMode: false
! Blink shall be blinking, not colored.
*VT100*colorBLMode: false
! Italic shall be italic, not colored.
*VT100*colorITMode: false
! Reverse shall be reverse, not colored.
*VT100*colorRVMode: false
! Underline shall be underline, not colored. But see italicULMode!
*VT100*colorULMode: false
! In case we do want color instead of actual attributes, e.g. for
! xterm +bdc -ulit -xrm '*VT100*colorULMode:true' -e man xterm
*VT100*colorBD: rgb:50/80/F0
*VT100*colorBL: red
*VT100*colorIT: blue
*VT100*colorRV: green
*VT100*colorUL: rgb:60/F0/F0

! Set to VT125, VT240, VT241, VT330 or VT340 for ReGIS graphics.
*decTerminalID: VT340

! If you use xaw3d you want these to avoid ugly stippled shadows.
*beNiceToColormap:  False
*shapeStyle:        Rectangle

View attachment 17620
I've been using the provided Xterm configuration for a few months, but daredn't change it in case I break something.I would however like to change a few things but not sure how...


When I first start Xterm and press C-left or C-right the menu comes up but is only around 10 chars wide.
Also I would like the default font to be Size 10 Pt. It appears to be set to this value, but whenever I start up I need to adjust the size. Also it doesn't come up in full screen automatically. Before adjusting the font, characters appear with a space between every letter. No really sure how to describe this but after pressing C-right and selecting Size 10 pt the characters appear normal.

It would be great to sort all this out.
 
The default font size is set with the *faceSize resource (try setting it to 15 to check if it changes), the default font with *faceName.

To avoid any aliases and scripts named xterm and envars setting different resources, run

env -i XAPPLRESDIR=$XAPPLRESDIR DISPLAY=$DISPLAY HOME=$HOME /usr/local/bin/xterm

No idea what's causing the narrow pop up menus. Don't be afraid to change and test variations. Save your original file and you can go back any time.
 
Back
Top