GDM doesn't load included files from .Xresources in Arch Linux
I installed Arch Linux along with GNOME 3 yesterday. I have a git repository to keep all my settings the same across all devices.
This is how my .Xresources
looks like:
#include "Xresources.d/xterm"
#include "Xresources.d/Xft"
I use different files for each application settings and #include
them into the main .Xresources
file. That’s works
just fine.
However, it seems that GDM ignores all #include
-s in .Xresources
file. I didn’t have such issues in Fedora, so I
assume this is Arch Linux specific thing.
After some investigation I found that /etc/gdm/Xsession
has the following code:
if [ -f "$userresources" ]; then
xrdb -nocpp -merge "$userresources"
fi
According to man xrdb
:
-nocpp This option indicates that xrdb should not run the input file through a preprocessor before loading it into properties.
It means, that cpp
preprocessor doesn’t get called and that’s why included files were not loaded.
The fix is simple: just edit the /etc/gdm/Xsession
file and remove -nocpp
option from the command that loads
.Xresources
:
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
Maintainers decided to use -nocpp
flag because of performance. It seems that calling the cpp
preprocessor is quite
expensive operation. Most of users don’t use #include
, #define
, etc. in their .Xresources
file. By using -nocpp
you can decrease startup time of your graphic environment.