I recently switched a Fedora host from the GNOME window manager to KDE. This exercise allowed me to familiarize myself with how X and the various window managers are organized on Fedora hosts, and I thought I would jot down how to switch between window managers for future reference.
When a Fedora host is booted into run-level 5, the following initab entry will cause the X server and Window manager to start:
# Run xdm in runlevel 5 x:5:respawn:/etc/X11/prefdm -nodaemon
The prefdm script uses the /etc/sysconfig/desktop file to control which window manager (KDE or GNOME) is started, as you can see in the following code snippet from the script:
preferred= if [ -f /etc/sysconfig/desktop ]; then . /etc/sysconfig/desktop if [ "$DISPLAYMANAGER" = GNOME ]; then preferred=gdm elif [ "$DISPLAYMANAGER" = KDE ]; then preferred=kdm elif [ "$DISPLAYMANAGER" = XDM ]; then preferred=xdm fi fi
So to set the default window manager to GNOME, you can set the DISPLAYMANAGER variable to GNOME:
echo "DISPLAYMANAGER=GNOME" >> /etc/sysconfig/desktop
To use KDE, you can set the DISPLAYMANAGER variable to KDE:
echo "DISPLAYMANAGER=KDE" >> /etc/sysconfig/desktop
I dig the fact that Fedora and CentOS Linux servers control application settings through configuration files in /etc/sysconfig. This makes it easy to adjust application settings, and ensures that a package update won’t whack your customizations! Nice!