# Desktop on RHEL 8

## Many Servers and Managers

Following software is involved in getting the desktop on Linux up and running.

- **Display Server** paints the image onto the screen
  - **Xorg**: good ol' Unix X Server with network redirection
  - **Wayland**: new and modern
- **Display Manager** shows up at startup to authenticate the user and then start the desktop session
  - **gdm** Gnome Display Manager is default on RHEL 8, but NoMachine NX cannot start Gnome with it
  - **lightdm** is very flexible, but automatic Gnome screen lock does not work with it, manual locking would be needed (`dm_tool lock`)
  - **sddm** the Simple Desktop Display Manager from the KDE world fails due to a kernel bug on RHEL 8.6
- **Greeter**: user interface part of the display manager, e.g. for `lightdm` it is exchangable
- **Accounts Service** (`accounts-daemon`) used by `gdm` to learn about/store user information (last desktop session, profile image, etc)
- **Session Manager** starts the actual desktop. The installed options are found in `/usr/share/wayland-sessions/` for `Wayland` and `/usr/share/xsessions/` for `Xorg`. 
  - **gnome-session** normal Gnome starter (for `Xorg` and `Wayland`)
  - **gnome-session-custom-session** to select a specific saved Gnome session
  - **icewm-session** IceWM starter, `Xorg` only
  - **startxfce4**  XFCE starter, `Xorg` only
  - **startplasma-x11** KDE Plasma starter for `Xorg`
  - **startplasma-wayland** KDE Plasma starter for `Wayland`

Out of the box RHEL 8 starts Gnome using `gdm` and `Wayland`. `Xorg` is also supported. Others can be installed from EPEL, but there is no support from Red Hat.

## PSI Specific Desktop Settings
Per default Puppet starts `gdm` which then starts Gnome with `Xorg` using `/usr/share/xsessions/gnome-xorg.desktop`.

Normally the Display Managers offer the user to select one of the available Desktop Sessions (`*.desktop` files in `/usr/share/wayland-sessions/` and `/usr/share/xsessions/`). This has been disabled as normally at the PSI this is more set per system and not per user.

In Hiera the actual Desktop Session to be started can be selected/overriden by setting the `desktop::session_manager` to one of the `.desktop` files in above listed directories. Set it e.g. to `gnome-wayland` to test `Wayland`.

Note when changing the default Session Manager, previous users will still get the one they used before. To reset that, you need to delete
- `/var/lib/AccountsService/users/*` (for `gdm`)
- `/var/cache/lightdm/dmrc/*.dmrc` (for `lightdm`)
- `/var/lib/lightdm/.cache/lightdm-gtk-greeter/state` (for `lightdm` with `lightdm-gtk-greeter`)

### NoMachine NX
As NoMachine requires `lightdm` to start Gnome ([bug](https://kb.nomachine.com/TR08Q09375)), `lightdm` is used on these systems.
It uses a custom patched `lightdm-gtk-greeter` to allow to select only the configured keyboard layouts and to have a configurable default session (PS: the patches have been merged upstream very fast, yeah!).

### XFCE
XFCE is installed when `base::enable_xfce: true` is set in Hiera.
It then is also used by default with `base::xfce_default: true` or `desktop::session_manager: xfce`.

### IceWM
IceWM is installed when `base::enable_icewm: true` is set in Hiera.
It then is also used by default with `desktop::session_manager: icewm-session`.

### Using a different Desktop (e.g. KDE)
The respective Desktop needs to be installed, either manually or through Puppet.
The respective Session Manager can be set as system default in Hiera with  `desktop::session_manager`.

If a different Display Manager is needed, or `lightdm` on other occasions, then changes in our Puppet code are required.



