Fedora notes

Sunday, October 16, 2005

some learnings for x startup scripts of redhat style

while using fedora, i constantly feel it necessary to understand the process of x startup. sometimes those diverse and fancy names of x init scripts are really messing your head up when you try to add some init code for input method for example.

if you looked into those init scripts, you would find the clear answers of your relevant problems and would know later on where to insert your code properly.

have a look first at the initial bootup to runlevel 5:
  • /etc/inittab,
    • runlevel 5, /etc/X11/prefdm -nodaemon will be invoked at the last phase of init.
      • /etc/profile.d/lang.sh
        • /etc/sysconfig/i18n
        • ~/.i18n
      • it decides which display manager to use from /etc/sysconfig/desktop and $DISPLAYMANGER.
      • if nothing is specified, it starts gdm, kdm, xdm in order. (e.g. in my system, there is no gdm, so kdm is invoked)
now the problem is that it's hard to analyze the following process after kdm runs, cause kdm is not a script anymore, and each display manager probably has different process and take different x init scripts to start.

let us see the process starting from xinitrc as follows:
  • /etc/X11/xinit/xinitrc
    • /etc/X11/xinit/xinitrc-common
      • /etc/X11/xinit/xinitrc.d/
        • xinput.sh
          • poll and run ~/xinput.d/default, ..., /etc/X11/xinit/xinput.d/...
          • set related env variables (XIM, XMODIFIERS, ...)
          • run XIM_PROGRAM
    • ~/.Xclients if exists (e.g. I used switchdesk to create a .Xclients and .Xclients-default)
      • invoke ~/.Xclients-default that starts a preferred desktop environment such as startkde
    • /etc/X11/xinit/Xclients
      • start desktop env. if there is a specified one in /etc/sysconfig/desktop
      • if no pre-specified desktop, try gnome (gnome-session), kde, ... in order.
after some tests, i got following personal conclusions:
  • codes about adding input method such as fcitx can be neatly inserted in ~/.xinput.d/default. ppl will easily see the benefit than puting it in xinit/xinput.d/
  • set LC_CTYPE in ~/.i18n is better than in ~/.bash_profile and sysconfig/i18n
  • unlike gdm, kdm may init an x session by starting from xinitrc-common rather xinitrc, because as i tested, codes in ~/.Xclients never be invoked when kdm is used for display manager.


Post a Comment

<< Home