2

I am trying to change my xterm theme using a hack in Xresources which i found in this website. i have created a Xresources in my home dirctory and entered the below code.

XTerm*faceName: Bitstream Vera Serif Mono
xterm*faceSize: 11
xterm*vt100*geometry: 80x60
xterm*saveLines: 16384
xterm*loginShell: true
xterm*charClass: 33:48,35:48,37:48,43:48,45-47:48,64:48,95:48,126:48
xterm*termName: xterm-color
xterm*eightBitInput: false

!BLK Cursor
#define _color0        #000d18
#define _color8        #000d18
!RED Tag
#define _color1        #e89393
#define _color9        #e89393
!GRN SpecialKey
#define _color2        #9ece9e
#define _color10       #9ece9e
!YEL Keyword
#define _color3        #f0dfaf
#define _color11       #f0dfaf
!BLU Number
#define _color4        #8cd0d3
#define _color12       #8cd0d3
!MAG Precondit
#define _color5        #c0bed1
#define _color13       #c0bed1
!CYN Float
#define _color6        #dfaf8f
#define _color14       #dfaf8f
!WHT Search
#define _color7        #efefef
#define _color15       #efefef
!FMT Include, StatusLine, ErrorMsg
#define _colorBD       #ffcfaf
#define _colorUL       #ccdc90
#define _colorIT       #80d4aa
!TXT Normal, Normal, Cursor
#define _foreground    #dcdccc
#define _background    #1f1f1f
#define _cursorColor   #8faf9f
URxvt*color0         : _color0
URxvt*color1         : _color1
URxvt*color2         : _color2
URxvt*color3         : _color3
URxvt*color4         : _color4
URxvt*color5         : _color5
URxvt*color6         : _color6
URxvt*color7         : _color7
URxvt*color8         : _color8
URxvt*color9         : _color9
URxvt*color10        : _color10
URxvt*color11        : _color11
URxvt*color12        : _color12
URxvt*color13        : _color13
URxvt*color14        : _color14
URxvt*color15        : _color15
URxvt*colorBD        : _colorBD
URxvt*colorIT        : _colorIT
URxvt*colorUL        : _colorUL
URxvt*foreground     : _foreground
URxvt*background     : _background
URxvt*cursorColor    : _cursorColor
XTerm*color0         : _color0
XTerm*color1         : _color1
XTerm*color2         : _color2
XTerm*color3         : _color3
XTerm*color4         : _color4
XTerm*color5         : _color5
XTerm*color6         : _color6
XTerm*color7         : _color7
XTerm*color8         : _color8
XTerm*color9         : _color9
XTerm*color10        : _color10
XTerm*color11        : _color11
XTerm*color12        : _color12
XTerm*color13        : _color13
XTerm*color14        : _color14
XTerm*color15        : _color15
XTerm*colorBD        : _colorBD
XTerm*colorIT        : _colorIT
XTerm*colorUL        : _colorUL
XTerm*foreground     : _foreground
XTerm*background     : _background
XTerm*cursorColor    : _cursorColor

to merge i used this code

 xrdb -merge ~/.Xresources

This worked and my xterm font and background size and color changed

enter image description here

But the problem starts when i restart my system. After restart when i open my Xterm i get below result with change in background and font color (with out any change in dimension or font size)

enter image description here

To load again Xresources file i have to use this command everytime when i restart the system.

xrdb ~/.Xresources

can you tell what is happening in the above scripts which prevents the smooth execution of Xresources

Eka
  • 2,967
  • 12
  • 38
  • 60

1 Answers1

2

I think that the name of this file should be a different one (at least on Ubuntu). Try(1) the following:

  1. find your hostname:

    % hostname
    pern
    

    (type hostname in your preferred shell --- in the same xterm if you like. You'll have the hostname printed --- in my case it is "pern").

  2. you should use .Xdefaults-hostname as a file name for your default resource file. For example, supposing your is .Xresource, you can create a symbolic link:

    cd ~; ln -s .Xresources .Xdefaults-$(hostname) 
    

    (more simply put: the resources file should be called after your hostname; so if for example your hostname is alfabeta, your resource file should be named .Xdefaults-alfabeta. The above command, typed as is in a shell, will take care of creating an alias, aka symbolic link, for your existing .Xresources file(2))

...and now it should load it at startup (logout and login to check, no need to reboot).

As a last resort, you can try to put the xrdb command in an executable script named .xprofile (works for me in Xubuntu) or .xsessionrc in your home directory, or add it to your session startup programs.


Footnotes:

(1) all the X11 resource mechanism, although not officialy obsoleted, is basically used only by programs from the 90ies and before (XJed, xterm, xfig and so on). Which I still use, together with a couple more dinosaurs. Probably the status of the maintenance of the scripts loading them is, well, lagging. Given that you are a new user, why not going with a more powerful terminal emulator like, for example, terminator? It has profiles, configurability, split screen, status line, and a lot fancier stuff than ole good xterm.

(2) that, by the way, I do not know why it is not working. It should be loaded by /etc/X11/Xsession.d/30x11-common_xresources, which is sourced by /etc/X11/Xsession. Anyone?

Rmano
  • 31,947
  • 1
    I am an average joe, can you explain it a little bit simpler.. how to find host name? [romano:~/etc] % hostname pern where to put this code? – Eka Apr 15 '15 at 10:52
  • still its not working cd ~; ln -s .Xresources .Xdefaults-$(hostname) created a hidden file in my home directory .Xdefaults-oc when i opened this file i can see the xterm theme codes – Eka Apr 15 '15 at 23:32
  • is there a way to go back to my previous state, after performing the modifications mentioned in your answer i am not even able to load xresources using xrdb ~/.Xresources – Eka Apr 16 '15 at 04:26
  • 1
    Simply remove the link - the new file .Xdefaults-oc. Shouldn't have affected in any way tough. What is the error from xrdb? – Rmano Apr 16 '15 at 05:24
  • xrdb shows no error but i am unable to change the theme from white background to black as i previously did using xrdb ~/.Xresources – Eka Apr 16 '15 at 08:42
  • As you told i have deleted .Xdefaults-oc and able to go back to my previous state but still my initial problem exists – Eka Apr 16 '15 at 08:49