====== XTerm customization ======
xterm is an underrated terminal emulator for the X Window System. It's powerful, customizable and lightweight. It supports 256 colors and UTF-8. It does not support tabs, but that's something which is actually not really useful, I prefer multiple xterm windows and I also use workspaces extensively because I use the [[https://i3wm.org/|i3]] window manager.
Once xterm is started it looks awful, has a tiny font and lacks some features. To enable all of that simply create file ''.Xresources'' in your home directory and paste the following content (change USERNAME on line 8 to your username). The "!" at the beginning of a line marks a comment.
! info: pressing Alt+Enter toggles fullscreen,
! pressing Shift+Insert pastes X11 selection (also middle mouse button)
*customization: -color
xterm*termName: xterm-256color
xterm*utf8: 1
#include "/home/USERNAME/.local/share/colorthemes/numix.xres"
! truetype fonts are supported, you can also disable antialias
xterm*faceName: DejaVu Sans Mono:antialias=true
!xterm*faceName: DejaVu Sans Mono
xterm*faceSize: 10
xterm*renderFont: true
! adjust line spacing, 0.9 .. 1.5, default 1.0
!XTerm.vt100.scaleHeight: 1.05
! VT Font Menu: Unreadable
xterm*faceSize1: 6
! VT font menu: Tiny
xterm*faceSize2: 8
! VT font menu: Medium
xterm*faceSize3: 10
! VT font menu: Large
xterm*faceSize4: 12
! VT font menu: Huge
xterm*faceSize5: 14
! bitmap fonts are set like this, iso10646 is an alias for Unicode
!xterm*font: -xos4-terminus-medium-*-*-*-18-*-*-*-*-*-iso10646-1
! see also output of command "xterm -report-fonts"
! do not scroll when there is new input e.g. tail -f /var/syslog
xterm*scrollTtyOutput: false
! zoom in/out/reset, works on main keyboard (not on numpad)
! + handy keyboard shortcuts to jump to the beginning/end of buffer
! + Shift+mousebutton on selected text to open in default app
xterm*vt100.Translations: #override \
Ctrl minus: smaller-vt-font() \n\
Ctrl plus: larger-vt-font() \n\
Ctrl 0: set-vt-font(d) \n\
Ctrl Home: scroll-to(begin) \n\
Ctrl End: scroll-to(end) \n\
Shift : exec-formatted("xdg-open '%t'", PRIMARY) select-start() select-end()
xterm*highlightSelection: true
! Remove trailing spaces
xterm*trimSelection: true
! Lines of output that you can scroll back over
xterm*saveLines: 4096
!XTerm.vt100.scrollBar: true
!XTerm.vt100.scrollbar.width: 8
!xterm.vt100.rightScrollBar: true
! XTerm uses the primary X11 selection buffer, which is different to the modern
! "ctrl+v" clipboard. With this setting enabled all selected text gets copied
! to the modern clipboard, so it can then be pasted with ctrl+v.
! You can also enable it temporarily with Ctrl+middle mouse button,
! check "selectToClipboard" there.
! Alternatively you could run `xsel -op | xsel -ib` to copy it manually.
!xterm*selectToClipboard: true
! Mouse pointer
XTerm*pointerColor: lime
XTerm*pointerColorBackground: black
!XTerm*cursorColor: #bab527
XTerm*cursorBlink: true
! make the bell character notify the window manager of urgency
xterm*bellIsUrgent: true
! do not send 8 bit input characters with Alt+ combinations, use normal Alt
xterm*vt100.metaSendsEscape: true
And this is the content of ''~/.local/share/colorthemes/numix.xres''
! THEME: Numix darkest
! special
xterm*foreground: #a2a2a2
xterm*background: #282828
xterm*cursorColor: #a2a2a2
! black
xterm*color0: #555555
xterm*color8: #888888
! red
xterm*color1: #9c3528
xterm*color9: #d64937
! green
xterm*color2: #61bc3b
xterm*color10: #86df5d
! yellow
xterm*color3: #f3b43a
xterm*color11: #fdd75a
! blue
xterm*color4: #0d68a8
xterm*color12: #0f75bd
! magenta
xterm*color5: #744560
xterm*color13: #9e5e83
! cyan
xterm*color6: #288e9c
xterm*color14: #37c3d6
! white
xterm*color7: #a2a2a2
xterm*color15: #f9f9f9
After you have saved both files, run this command (as normal user, not root)
''xrdb -load .Xresources''
and that's it! Now every new xterm will look nice and have some useful features enabled. Look at the content of ''.Xresources'', it is self-explanatory. Remember xterm has also 3 pop-up menus which can be accessed by Ctrl+mouse button (left/middle/right). Settings in those menus can be persistently enabled/disabled in the Xresources file.
If you would like to use another color theme I recommend having a look at [[https://terminal.sexy/|Terminal Sexy]], which is a well done web app with support for Xresources color format. You can even make xterm transparent with a composite manager.