Loading of xinitrc,xserverrc,xresources,xdefaults,xprofile,xsession,xmodmap - Desktop Customization & Workflow
Users browsing this thread: 2 Guest(s)
|
|||
Hello nixers,
In a previous forums thread there was a discussion about certain X configuration files and their roles. Namely: xinitrc,xserverrc,xresources,xdefaults,xprofile,xsession,xmodmap. So let's try to clear up this mumbo jumbo of words. There's roughly two ways to start your X environment, one is via xinit and the other is via a display manager (fancy login screen). Depending on which one you use, different configuration files will be loaded. If starting via xinit, or startx which is a wrapper over xinit, then the ~/.xinitrc will be loaded, and if not present will load the global /etc/X11/xinit/xinitrc. This will run all the lines found in it, interpreted by /bin/sh and will stop at the last one. The X session will stop when that last program terminates. If using the globally available xinitrc it will include in an alphabetical order sub-xinitrc found in the /etc/X11/xinit/xinitrc.d/. That globally available xinitrc loads two more configurations:
xinit/startx will finally start the X server, it does it by executing a script found in ~/.xserverrc or globally /etc/X11/xinit/xserverrc. This consists of simply: Code: exec /usr/bin/X -nolisten tcp "$@" What about initiating a graphical session from the display manager. Instead of xinitrc the file loaded at login will be the Xsession file. So similar to xinitrc we have globally a default located at /etc/X11/Xsession.options along with a directory of sub-xsessions to be loaded in /etc/X11/Xsession.d. Also similar to xinit the default Xsession will load the Xresources. As for local configs there are many of them depending on what the type of session, I quote: Quote:If the user has a ~/.xsessionrc file, read it. (used by all sessions types) Some specific display manager include in their default Xsession an extra configuration called Xprofile. For example:
Otherwise, if you want the Xprofile, you have to source the file manually from startx/xinit or XDM or any other display manager. Now for something unrelated, Xdefaults is the old version of Xresources. The way it was done in the old days is that Xdefaults was read every single time a client program (Xlib) was started, unlike Xresources which have properties stored in the root window/resource manager (think xrdb). So that means the old method, Xdefaults, couldn't be used over the network because you needed direct access to the file. Now that gets a bit complicated because there could be multiple Xdefaults files found in different ways other than ~/.Xdefaults. I quote: Quote:There also is the $XENVIRONMENT variable, which defaults to ~/.Xdefaults-hostname ($XENVIRONMENT/.Xdefaults) if not set. This is used in the same way as .Xdefaults, but is always read regardless of whether RESOURCE_MANAGER is present. You can use .Xdefaults-hostname files to keep some settings machine-specific while using xrdb for the global ones Quote:The fourth location is the directory pointed to by the $XAPPLRESDIR environment variable. (Oddly, if the variable is not set, $HOME is used as the default.) When a program is started, it looks if any of the following files exist (the file name being the same as the program's class name): Quote:The fifth location is the system-wide "app-defaults" directories. Again, the app-defaults directories are checked on program startup if they have a file named after the program. For example, XTerm (on Arch Linux) uses: I hope that helps clear things up. References: https://wiki.archlinux.org/index.php/Xinit https://wiki.archlinux.org/index.php/X_resources https://wiki.debian.org/Xsession https://wiki.archlinux.org/index.php/Xprofile https://superuser.com/questions/243914/w...lts#243916 |
|||
|
|||
Well done on the writeup, venam. I use a pretty simple .xinitrc these days, and have generally stayed away from display managers as they seemed unnecessary vs a simple script.
I remember the old days, back when I first started to use Debian... wrapping my head around early 2000's X configuration was real difficult for a complete newbie with no internet access at home. I basically had to fiddle with it until I got stuck, then use the computers at school to lookup information. I was also lucky that the local library had an excellent selection of UNIX and Linux books that I would check out constantly. |
|||
|
|||
(22-04-2019, 05:26 AM)venam Wrote: Hello nixers, Let me confuse the nixers a bit: 1. You're talking about X11. What about X10? ;-) 2. With XWayland, the latest installment in the "we need a backwards-compatible X replacement which does everything differently than X" series, .Xresources is probably a file that needs to be loaded explicitly - as always, depending on the distribution's maintainers, I guess. (Welp, Red Hat...) 3. All folders mentioned above could be somewhere else than where you'd think they are. -- <mort> choosing a terrible license just to be spiteful towards others is possibly the most tux0r thing I've ever seen |
|||
|
|||
(22-04-2019, 06:56 PM)jkl Wrote: 1. You're talking about X11. What about X10? ;-) The best questions would actually be "What about X2, X3, X4, X5, X7, X8 ?" :-P As for the .Xresources, it as always been a file to load explicitely. It just happens that some default configurations load it by default: Code: $ grep userresources /etc/X11/xinit/xinitrc This, of course, is up to the distro maintainers ;-) What bother me with X11 though, is that it is designed to be a network protocol, yet you never see it in the wild (besides perhaps X11 forwarding over ssh). X being a "network protocol" should allow awesome stuff like what you get on plan9, where your whole system is spread on multiple machines. Why don't we have people providing "graphics as a service" or similar? Why do we have to use stuff like X11VNC or ffserver? Is it a lack of knowledge? Did X11 failed at being what it is? |
|||