Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] Change default xterm background color to black (Read 2939 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

[SOLVED] Change default xterm background color to black

I want to change default xterm background color to black for all system.

I uncommented corresponding lines in
/usr/share/X11/app-defaults/XTerm-color
Quote
#include "XTerm"

*VT100*colorMode: on
*VT100*boldColors: on
*VT100*dynamicColors: on

! Uncomment this for "white" text on a dark background.
*VT100*foreground: gray90
*VT100*background: black


But background in xterm is still white.

Re: Change default xterm background color to black

Reply #1
Have you tried setting this up into Xresources?

Re: Change default xterm background color to black

Reply #2
Case is important.
Code: [Select]
man xterm
then /^ +VT100 Widget Resources and press Enter.
Quote
The following resources are specified as part of the vt100 widget (class VT100).  They are specified by patterns such as
       “XTerm.vt100.NAME”.
[...]
background (class Background)
               Specifies the color to use for the background of the window.  The default is “XtDefaultBackground”
So, ($HOME/.Xresources)
Code: [Select]
XTerm.vt100.background: black
XTerm.vt100.foreground: grey
Code: [Select]
xrdb -merge ~/.Xresources
xterm

Re: Change default xterm background color to black

Reply #3
By default settings I mean global changes for all users.
Xresources file makes changes for current user and requires autostart because changes dissapear after reboot.

Re: Change default xterm background color to black

Reply #4
By default settings I mean global changes for all users.
Xresources file makes changes for current user and requires autostart because changes dissapear after reboot.
It's just a text file which is passed to xrdb. Where it is located is of no consequence (provided the user has permissions to read the file).

That said, the default system-wide xinitrc sources /etc/X11/xinit/.Xresources. Keep in mind that system-wide xinitrc will be overridden by user-defined $HOME/.xinitrc.

Also keep in mind that if you are using a DM, your $HOME/.xinitrc might be overridden as well. See the documentation of a particular DM.

More information:
Code: [Select]
less /etc/X11/xinit/xinitrc
https://wiki.archlinux.org/title/Xinit

Re: Change default xterm background color to black

Reply #5
Code: [Select]
xrdb -merge ~/.Xresources
Color changes are kept untill reboot and only for current user.
After reboot xterm has wite background and cyan ps1.

I don't see any marged setting in /etc/X11/xinit/anyfile
 $HOME/.xinitrc is commented so emty

xterm from tty is also with white background.
So it is not because WM overwrites .xinitrc


Re: Change default xterm background color to black

Reply #6
I don't see any marged setting in /etc/X11/xinit/anyfile
If you have world/xorg-xinit installed, that package provides the file /etc/X11/xinit/xinitrc. It starts with:
Code: [Select]
#!/bin/sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

So it is not because WM overrites .xinitrc
I said that a DM (display manager, for example: lightdm, sddm...), not WM (window manager) can override (not overwrite, those are two different things!) your $HOME/.xinitrc.

If you are using a DM, use instead the file $HOME/.xprofile.

Read the wiki:
https://wiki.archlinux.org/title/Xinit
https://wiki.archlinux.org/title/Xprofile

 

Re: Change default xterm background color to black

Reply #7
Finally solved this quest for me.  :D
I expected system to remember settings after xrdb -merge ~/.Xresources and reboot.

but normaly resourses are loaded every time at boot by:
1  line in .xinitrc when user logins by startx:
Quote
[[ -f ~/.Xresources ]] && xrdb -merge -I$HOME ~/.Xresources

https://wiki.archlinux.org/title/X_resources#xinitrc
2 Login manager


I use tbsm  login manager so .xinitrc is not executed , and tbsm does not loads xresources by itself.
So I have to add to autostart:
Quote
xrdb ~/.Xresources &