Configuring XTerm

The program is the same but due to other settings your FreeBSD box might react differently.

Edit your ~/.Xresources and add some configuration lines. Below some I use, and see what happens.

Code:
xterm*dynamicColors:    true
xterm*background:    black
xterm*foreground:    grey
xterm*saveLines:    35000

On my box just 'xterm' works better. The 'vt100' part should be skipped. It has something to do with terminals. The '*' acts as a wildcard to make interpretation broader.

Other settings can be used from Eg. the Arch site, as long as you use undercast and the use of capitals for the final part of the commands.

Finally you need to update the settings with xrdb ~/.Xresources before they get effective.

Generally a Handbook or descriptive sites are better for tweaking your configs than promotional video's like the one you posted.

Finally, develop the habit of only using a keyboard for working in a terminal. It is a non-graphical environment and text only. Selecting text might work, but lots of things in terminals don't work if you try to use it as a graphical editor. When you want to do things clickin' around, there are probably terminal programs that can handle that, but XTerm isn't one of them.
 
"nothing works" is not actionable.
From the video it was simply suggested to

Edit or make a file called .Xresources and enter these commands:
Code:
*.font: xft:monospace:style=Bold:size=15
XTerm.vt100.reverseVideo: true
Edit or make a file called .xinitrc and enter this command: xrdb .Xresources

'nothing works'
 
There can be some confusion amongst programs whether the newer standard .Xresources is used or the good old .Xdefaults.

A simple solution is to have both, where .Xresources hard links to the other. The first file name should be the one with content, the second one is made with the ln command. As a user of the account:

ln .Xresources .Xdefaults

You also have to update the .Xdefaults with xrdb ~/.Xdefaults.
 
The program is the same but due to other settings your FreeBSD box might react differently.

Edit your ~/.Xresources and add some configuration lines. Below some I use, and see what happens.

Code:
xterm*dynamicColors:    true
xterm*background:    black
xterm*foreground:    grey
xterm*saveLines:    35000

On my box just 'xterm' works better. The 'vt100' part should be skipped. It has something to do with terminals. The '*' acts as a wildcard to make interpretation broader.

Other settings can be used from Eg. the Arch site, as long as you use undercast and the use of capitals for the final part of the commands.

Finally you need to update the settings with xrdb ~/.Xresources before they get effective.

Generally a Handbook or descriptive sites are better for tweaking your configs than promotional video's like the one you posted.

Finally, develop the habit of only using a keyboard for working in a terminal. It is a non-graphical environment and text only. Selecting text might work, but lots of things in terminals don't work if you try to use it as a graphical editor. When you want to do things clickin' around, there are probably terminal programs that can handle that, but XTerm isn't one of them.

I have this sorted now but would like to do something with fonts. On my ThinkPad X61 I have quite a small font which is acceptable, but on ThinkPad X1C the font is too big. I tried changing a few things using the Arch Wiki as a guide, but no success so far.
 
I have a single file for x11/rxvt-unicode and x11/xterm (.config/X11/Xresources) and both works great.
e.g xterm part:
Code:
! XTERM NAME
! !------------------------------------------------

  XTerm.termName: xterm-256color

! XTERM Window size

  XTerm.vt100.geometry: 130x50 

! XTERM COLORS & FONTS
! !-----------------------------------------------
  XTerm.vt100.foreground: white
  XTerm.vt100.background: rgb:14/14/14
  XTerm.vt100.color0: rgb:28/28/28
  XTerm.vt100.faceName: Source Code Pro
  XTerm.vt100.faceSize: 8,5
! XTerm.vt100.font: 7x13
  XTerm.utf8: 1
! XTerm*font: -*-Monospace-medium-*-*-*-18-*-*-*-*-*-iso10646-1
  XTerm.vt100.locale: true

! XTERM COPY/PASTE
! !----------------------------------------------

  XTerm.selectToClipboard: true
  XTerm.vt100.TiteInhibit: True
  XTerm.highlightSelection: true
  XTerm.trimSelection: true

! XTERM SCROLLBAR, CURSOR STYLE, BORDER, KEYBINDINGS
! !------------------------------------------------

  XTerm.pointerColor: white
  XTerm.pointerColorBackground: black
  XTerm.cursorColor: yellow
  XTerm.cursorBlink: true
  XTerm.vt100.scrollBar: false
  XTerm.scrollTtyOutput: false
  XTerm.saveLines: 30000
  XTerm.vt100.translations: #override \n\
  Ctrl <Key>-: smaller-vt-font() \n\
  Ctrl <Key>+: larger-vt-font() \n\
  Ctrl <Key>0: set-vt-font(d) \n\
  Ctrl Alt <Key>c: copy-selection(CLIPBOARD) \n\
  Ctrl Alt <Key>v: insert-selection(CLIPBOARD)

The result:
xterm.png

Any modification of Xresources can be manually loaded via xrdb -merge ~/.config/X11/Xresources or at every X11/xorg start by adding an entry to .xinitrc.
Code:
xrdb -load $HOME/.config/X11/Xresources
 
Code:
*.font: xft:monospace:style=Bold:size=15
Should be:

Code:
xterm*faceName:   monospace:style=Bold:size=15

Providing that you have a font called 'monospace' and the Bold type installed.

When code doesn't work as intended, strip it to the bare bone and see if it works. When it does you can add components. Keep your original idea as a commented line (with '!' beginning). It's the most reliable way of working.
 
~/.Xdefaults are read every time you start an X application,
but when using ~/.Xresources in xrdb (if there is output with xprop -root|grep RESOURCE_MANAGER), it's not functional.
x11/xprop

I have this sorted now but would like to do something with fonts.
If you hold down Ctrl key and click right, left, or middle button on the xterm, a menu will appear.
You can also change the font size by pressing Shift+'+'(Numpad) or Shift+'-'(Numpad) (If the font specification is valid).
 
You can also change the font size by pressing Shift+'+'(Numpad) or Shift+'-'(Numpad) (If the font specification is valid).

I was not aware of this but just tried t on my ThinkPad X61 once I figured out how to use the Numpad.

I'm still struggling to find out if I even have a Numpad on my X1...
 
As for usable monospaced rendered fonts (as opposed to pixel fonts), you can list the available fonts with fc-list :scalable=true:spacing=mono: family

To start an xterm with one of the fonts, run xterm -fa "The Font You Want"; you may also supply a font size with xterm -fa "Ubuntu Mono:size=14". The -fa argument matches the "*faceName" resource option.
 
I want to autostart xterm when my WM LXDE starts up, and I can do this by using

/usr/local/etc/xdg/lxsession/LXDE/autostart

and including xterm except it does not use ~/.Xresources even if I include

xrdb ~/.Xresources beforehand.

How should I go about doing this? Is there a 'global' Xresources file I could use?
 
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

xterm.png
 
Wild guess, did you install the gui with the sysutils/desktop-installer? In that case do a re-install with pkg install -f xterm
This overwrites some sort of config deep hidden in the X11 directories that has been installed with the desktop-installer. After the re-install xterm reads .Xresources or .Xdefaults in your $HOME folder.
 
schweikh thanks, good stuff.

Anyway, I use startx, which source .xinitrc (I think most DMs use .xsession) has the following:
userresources=$HOME/.Xresources usermodmap=$HOME/.Xmodmap sysresources=/usr/local/etc/X11/xinit/.Xresources sysmodmap=/usr/local/etc/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
to load resources and keymaps. I think the xrdb command needs either -merge or -load as the command/option.
 
schweikh thanks, good stuff.

Anyway, I use startx, which source .xinitrc (I think most DMs use .xsession) has the following:
sysresources=/usr/local/etc/X11/xinit/.Xresources sysmodmap=/usr/local/etc/X11/xinit/.Xmodmap

I don't have these two files. Do you need to create them yourself?

The code you've shown looks like /usr/local/etc/X11/xinit/xinitrc on my system.h
 
My ~/.xinitrc:-

Code:
ck-launch-session dbus-launch --exit-with-session startlxde

My /usr/local/etc/xdg/lxsession/LXDE/autostart:-

Code:
@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@xscreensaver -no-splash
@xrdb -I$HOME ~/.Xresources
@xterm

My ~/.Xresources:

Code:
xterm*background:    black
xterm*foreground:    cyan
xterm*maximized: true

When I run startx I'm expecting xterm to start up maximised using cyan letters on black background, but what I get are black letters on a white background in a small window.

What am I doing wrong?

Is I start xterm after LXDE has started it comes up maximised with cyan on black
 
I copied that code from /usr/local/etc/X11/xinit/xinitrc; I'm not sure if the system xinitrc gets run if I have a local .xinitrc for my user.

I would put the xrdb command into the .xinitrc before the startlxde command.
I'm not sure what should go into lxde autostart
 
What am I doing wrong?
xrdb must be run.
I'm not sure if the system xinitrc gets run if I have a local .xinitrc for my user.
Not executed.

/usr/local/bin/startx
Code:
userclientrc=$HOME/.xinitrc
sysclientrc=/usr/local/etc/X11/xinit/xinitrc

        if [ -f "$userclientrc" ]; then
            client=$userclientrc
        elif [ -f "$sysclientrc" ]; then
            client=$sysclientrc
        fi

xinit "$client" $clientargs -- "$server" $display $serverargs
 
Finally you need to update the settings with xrdb ~/.Xresources before they get effective.
I can't understand when this needs to be run to be effective. Also is this a permanent change or does it have to be done every time you startup X?

If I run this once LXDE is up, my XTerm has the properties I want. If I log out and log back in, XTerm reverts to its' default values.

I've tried including xrdb ~/.Xresources both in my ~/.xinitrc and in /usr/local/etc/xdg/lxsession/LXDE/autostart but neither seems to work.
 
Did you try .Xdefaults as well?

 
I can't understand when this needs to be run to be effective. Also is this a permanent change or does it have to be done every time you startup X?
I've already given you the answer on post above but you chose not to read it. Add xrdb -load $HOME/.Xresources to .xinitrc . Now, every time Xorg is started your Xresource is loaded independently of your DE/WM you have chosen to use.
e.g.: .xinitrc

Code:
xrdb -load $HOME/.Xresources
ck-launch-session dbus-launch --exit-with-session startlxde

Even if Xresources is automatically loaded at every Xorg start, when you modify it, is necessary to manually reload Xresources. ( xrdb -merge ~/.Xresources)
 
Back
Top