configuratinde de xterm et rxvt

Mise à jour: 26/09/2023
Version: 1.0
Author: Jean-Louis Bicquelet-Salaün
Location: http://jlbicquelet.free.fr
Copyright: (c) 2023 Jean-Louis BICQUELET-SALAÜN

console xterm et urxvt

présentation de xterm et urxvt

Les consoles urxvt et xterm sont peu jolies par défaut.

xterm est l'émulateur de terminal standard pour l'environnement graphique X Window System. Un utilisateur peut disposer de plusieurs instances de xterm simultanément dans le même écran, chacune d'entre elles offrant des entrées/sorties indépendantes pour les processus qui s'y exécutent (habituellement des shells).

urxvt, est l'abréviation de rxvt-unicode? C'est lui aussi un émulateur de terminal pour l'environnement graphique X Window System. Ce terminal virtuel est un clone de rxvt, dont l'objectif est le support d'Unicode.

rxvt-unicode se veut très léger et facilement configurable, mais il se configure à l'aide des ressources X11.

Il permet l'affichage de différentes polices en même temps, la transparence, ou encore l'utilisation d'extensions perl.

Vous l'aurez compris, la configuration se fait avec les fichiers de configuration de X11 (.Xdefaults et .Xressources), ce qui nous ramène à plus de vingt ans. Je donnais un cours de dévellopement X11 en école d'ingénieur en 1994. xwininfo

xwininfo: Please select the window about which you would like information by clicking the mouse in that window.

-geometry 79x18+0+0

Pour ceux qui seraient intéressés, une partie de mes informations proviennent de ce livre, Xwindow programmation :

xwindows

rendu des terminaux

La configuration est fortement liée aux dimensions de la fenêtre et aux fontes de caractères utilisées (et uin peu à l'écran).

Les écrans qui suivent vont vous dopnnzer une idée du résultat.

xterm

Pour le terminal et son shell, avec une police assez grosse.

xterm

Midnight commander est utilisable en mode semi-graphique et de taille raisonnable.

xterm_mc

urxvt

urxvt est configuré avec un système de tab. La couleur verte me semble la plus appropriée

urxvt

On peut utilise xwininfo pour receuillir des information sur la fenêtre:

xwininfo

xwininfo: Please select the window about which you
          would like information by clicking the
          mouse in that window.

xwininfo: Window id: 0x5400009 "jlb@mignon: ~"

  Absolute upper-left X:  6
  Absolute upper-left Y:  29
  Relative upper-left X:  6
  Relative upper-left Y:  29
  Width: 959
  Height: 422
  Depth: 24
  Visual: 0x21
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x20 (installed)
  Bit Gravity State: ForgetGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +6+29  -401+29  -401-317  +6-317
  -geometry 79x18+0+0

fichier de configuration

J'ai choisi de tout mettre dans le fichier .Xdefaults qui se trouve à la racine de mon compte $HOME.

Ce fichier est le résultat de mes essais et de ressources que j'ai pu trouver sur le net.

!##################################
!  Urxvt Section
!##################################
URxvt.geometry:              80x20
URxvt.inheritPixmap:         true
URxvt.reverseVideo:          false
URxvt.tintColor:             #ffffff
URxvt.shading:               20             !trans######100, 0opaque
URxvt.fading:                10             !term unfocus
!URxvt*font:                  xft:Monospace-16:antialias=true
!URxvt*font:           -misc-fixed-medium-r-semicondensed-*-10-90-100-*-c-60-iso8859-1
!URxvt.boldFont:              xft:Monospace-16:bold
URxvt.scrollBar:             true
URxvt.scrollBar_floating:  !##################################  true
URxvt.scrollBar_right:       true
URxvt.scrollColor:           green
URxvt.scrollstyle:           plain
!URxvt.scrollstyle:           xterm
URxvt.saveLines:             5500
URxvt.cursorColor:           #00ff00
URxvt.cursorBlink:           true
!URxvt*font: 
URxvt.font: \
            xft:DejaVu Sans Mono:regular:size=13
URxvt.boldFont: \
            xfUrxvt Sectiont:DejaVu Sans Mono:Bold:size=13
URxvt.perl-ext:              tabbed
URxvt.tabbed.tabbar-fg:      0
URxvt.tabbed.tabbar-bg:      2
URxvt.tabbed.tab-fg:         7
URxvt.tabbed.tab-bg:         0

URxvt.termName: rxvt-unicode-256color
URxvt.clipboard.autocopy: true
!URxvt.keysum.M-c: perl:clipboard:copy
!Urxvt.keysum.M-v: perl:clipboard:paste
URxvt.keysym.Shift-Control-V: perl:clipboard:paste
URxvt.keysym.Shift-Control-C: perl:clipboard:copy
URxvt.iso14755: False

! Pour ne pas avoir de bordures
!URxvt*borderLess:            true

! Pour avoir le marquage des urls et les ouvrir avec FF
!URxvt.perl-ext-common: default,digital-clock,matcher
URxvt.perl-lib: /usr/lib/x86_64-linux-gnu/urxvt/perl/ 
URxvt.perl-ext-common:       default,matcher,clipboard
URxvt.urlLauncher:           firefox
!couleur des urls
URxvt.colorBD:              3

! Couleurs psychédéliquoblankoïques
URxvt.background:            #000000
URxvt.foreground:            #00ff00
!URxvt*color0: #101010
!URxvt*colorUrxvt Section1: #f13a21
!URxvt*color2: #93f91d
!URxvt*color3: #ffd00a
URxvt*color4: #3465a4
URxvt*color5: #75507b
URxvt*color6: #06989a
!URxvt*color7: #f2f2f2
!URxvt*color8: #1d202f
URxvt*color9: #ef2929
URxvt*color10: #8ae234
URxvt*color11: #fce94f
URxvt*color12: #729eca
URxvt*color13: #ad7fa8
!URxvt*color14: #4bb8fd
URxvt*color15: #eeeeec
Urxvt Section
!##################################
! XTerm Section
! fontes (plus taille) francisé dans le menu:
! XTerm resources
!
! Remember to run `xrdb < .Xresources` after changing anything.
!
! Tavis Ormandy 
!##################################

! Set the default UI font (menus, toolbar, etc)
XTerm*XftFont:                  Segoe UI:size=10:antialias=true:style=Regular

! Color of UI Components
XTerm*.SimpleMenu.background:   #ffffff
XTerm*.SimpleMenu.foreground:   #000000

! Tone down the Xaw3D effect.
XTerm*shapeStyle:               Rectangle
XTerm*beNiceToColormap:         false
XTerm*relief:                   None
XTerm*highlightThickness:       0

! Dont automatically jump to the bottom on output, but do on keypress.
XTerm*scrollTtyOutput:          false
XTerm*scrollKey:                true
XTerm*scrollBar:                false
XTerm*eightBitInput:            false
XTerm*cursorBlink:              true

! Dont allow mouse ops - it can be enabled in the view Menu at runtime.
! The reason is it breaks copy/paste if an application requests mouse events,
! because the application gets the event instead of XTerm.
XTerm*allowMouseOps:            false

! Dont change my title by default, this can be re-enabled from the menu.
XTerm*allowTitleOps:            false
XTerm*allowFontOps:             false

! Mouse cursor configuration, I prefer to keep it simple.
XTerm*pointerColor:             white
XTerm*pointerColorBackground:   black
XTerm*pointerShape:             left_ptr

! Only select text, not empty space around it.
XTerm*highlightSelection:       true

! The distance between the edge of the screen and the characters.
XTerm*vt100.internalBorder:     6

! The border around elements.
XTerm*.BorderColor:             #ffffff
XTerm*vt100.BorderColor:        #d0d0d0
XTerm*BorderWidth:              3

! Menu Names, I dont like the default verbose names.
XTerm*.mainMenu.label:          File
XTerm*.vtMenu.label:            Options
XTerm*.fontMenu.label:          View

! You can rename menu entries, like this, I dont know why the menubar
! is called a "toolbar", probably historical reasons.
XTerm*.mainMenu.toolbar.label:  Menubar

! Adjust how the active menu item looks
XTerm*.SimpleMenu.*.shadowWidth: 3
XTerm*.SimpleMenu.*.topShadowPixel: SkyBlue
XTerm*.SimpleMenu.*.bottomShadowPixel: LightSkyBlue

! Try to hide the useless title displayed at the top of menus, I know what
! menu it is because I just clicked it.
XTerm*.*.menuLabel.vertSpace:   0
XTerm*.*.menuLabel.foreground:  #ffffff
XTerm*.*.menuLabel.XftFont:     Courier:size=0

! Space around menu entries.
XTerm*.SimpleMenu.*.topMargin:  0
XTerm*.SimpleMenu.*.bottomMargin: 0
XTerm*.SimpleMenu.*.leftMargin: 32
XTerm*.SimpleMenu.*.rightMargin: 64
! The height of each menu entry, the default calculates it from font size.
! XTerm*.SimpleMenu.*.rowHeight: 16

! Space around the checkmark in the menus.
XTerm*.SimpleMenu.*.leftWhitespace: 16
!XTerm*.SimpleMenu.*.rightWhitespace: 8

! Trim vertical padding around the toolbar, all elements have a form.
XTerm*Form.menubar.vSpace:      0
XTerm*Form.menubar.vertDistance: 0
!XTerm*Form.menubar.foreground: #000000
!XTerm*Form.menubar.background: #ffffff
!XTerm*Form.menubar.Thickness:  0

! Fonts
XTerm*vt100.faceName:           xft:Consolas:size=14:antialias=true:style=Regular
XTerm*vt100.boldFont:           xft:Consolas:size=14:antialias=true:style=Bold

! Size and Title
XTerm*vt100.geometry:           100x30
XTerm*title:                    Terminal
XTerm*iconHint:                 /home/taviso/.icons/computer_x11.xpm

! Terminal Colors
XTerm*vt100.background:     #212121
XTerm*vt100.foreground:     #80FF80
XTerm*cursorColor:          #ffffff

! I like bold items to be in bright white.
XTerm*veryBoldColors:       4
XTerm*colorBDMode:          true
XTerm*colorBD:              #ffffff
XTerm*colorRV:              #ffffff

! I can see a small line between box characters, this fixes it.
XTerm*forceBoxChars:        true
XTerm*vt100.scaleHeight:    1.04

! This (or similar id) is required for Sixel support.
XTerm*decTerminalID:        vt382

! Color Scheme
! 0-7:  Black, Red, Green, Yellow, Blue, Purple, Cyan, White
! 8-15: Bright Black, Bright Red, ...
XTerm*color0:               #212121
XTerm*color8:               #7f7f7f
XTerm*color1:               #A00000
XTerm*color9:               #FF0000
XTerm*color2:               #00A000
XTerm*color10:              #00FF00
XTerm*color3:               #A0A000
XTerm*colorUrxvt Section11:              #FFFF00
XTerm*color4:               #0000A0
XTerm*color12:              #5C5CFF
XTerm*color5:               #A000A0
XTerm*color13:              #FF00FF
XTerm*color6:               #00A0A0
XTerm*color14:              #00FFFF
XTerm*color7:               #C0C0C0
XTerm*color15:              #ffffff

!  XTerm Translations, i.e. keyboard remapping.
!
! Notes:
!   ~       means that that modifier must not be asserted.
!   !       means that the listed modifiers must be in the correct state and
!               no other modifiers can be asserted.
!   None    means no modifiers can be asserted.
!   :       directs the Intrinsics to apply any standard modifiers in the event.
!   ^       is an abbreviation for the Control modifier.
!   $       is an abbreviation for Meta
!
! Example:
!   No modifiers:                          None  detail
!   Any modifiers:                               detail
!   Only these modifiers:           ! mod1 mod2  detail
!   These modifiers and any others:   mod1 mod2  detail

! Below:
!
! - I have some old apps that use Alt-F4, but thats sometimes difficult to
!       press so Ctrl-Shift-F4 does the same thing.
! - Ctrl-MouseWheel can be used to increase and descrease font size.
! - Ctrl-I is totally useless, because it is literally impossible for
!       applications to differentiate it from Tab. You can remap it to some
!       other harder-to-press keybinding here, I use it for Italics in
!       wordperfect.

XTerm*vt100.translations:   #override           \n\
    Ctrl Shift F4:     string("\033[1;3S") \n\
  ! Ctrl :          larger-vt-font()    \n\
  ! Ctrl :          smaller-vt-font()   \n\
    ^I:                string("\014")      \n\

XTerm*fontMenu*fontdefault*Label: Tres grand
XTerm*VT100*font: 9x15
XTerm*fontMenu*font1*Label: Illisible
XTerm*VT100*font1: nil2
XTerm*fontMenu*font2*Label: Minuscule
XTerm*VT100*font2: 5x7
XTerm*fontMenu*font3*Label: Petit
XTerm*VT100*font3: 6x10
XTerm*fontMenu*font4*Label: Normal
XTerm*VT100*font4: fixed
XTerm*fontMenu*font5*Label: Moyen
XTerm*VT100*font5: 7x13
XTerm*fontMenu*font6*Label: Tres grand
XTerm*VT100*font6: 10x20

XTerm*saveLines: 1000
XTerm*AllowIconInput: on
XTerm*Background: black
XTerm*Border: gray
XTerm*Font: 8x14
XTerm*Foreground: white
~XTerm*Foreground: rgb:00/A0/D0
XTerm*InternalBorder: 1
XTerm*Mouse: yellow
XTerm*charClass: 33:48,37:48,45-47:48,64:48
XTerm*cutNewline: off
XTerm*jumpScroll: on
XTerm*multiClickTime: 500
XTerm*multiScroll: on
XTerm*reverseWrap: off
XTerm*scrollBar: on
XTerm*scrollbar*thickness: 5

explications

Comme vous pouvez le constater, il y a deux sections, une pour la configuration de urxvt et l'autre pour celle de xterm.