80fb965906f43eb1cd22c791c2e56bb481a1f28f — Stacy Harper 6 months ago ba8d65c
Add a precise system part about tinydm
1 files changed, 19 insertions(+), 14 deletions(-)

@@ 77,22 77,27 @@ Named runlevels in OpenRC are stored in directories under `/etc/runlevels`. When
    13) [swapfile](https://gitlab.com/postmarketOS/pmaports/-/blob/master/main/postmarketos-base/rootfs-etc-init.d-swapfile)  - note: swapfile size is 0, no swap is activated
    14) [sxmo-pinephone](https://git.sr.ht/~mil/sxmo-utils/tree/master/item/configs/openrc/sxmo-pinephone) 
    15) [udev-postmount](https://git.alpinelinux.org/aports/tree/main/eudev/udev-postmount.initd) 
    16) [xdm](https://git.alpinelinux.org/aports/tree/community/xdm/xdm.initd) - starts X Display Manager
    16) [tinydm](https://gitlab.com/postmarketOS/tinydm) - starts Display Manager
    17) [local](https://github.com/OpenRC/openrc/blob/master/init.d/local.in)  - this runs user-provided init scripts placed in the `/etc/local.d/` directory

## X Display Manager - xdm

Details on `xdm` and the login widget configuration can be found in the [`xdm` man page](http://manpages.org/xdm).

* `/usr/sbin/xdm` runs with the arguments specified by the variable `$xdm_opts`, which is set in [`/etc/conf.d/xdm`](https://git.sr.ht/~mil/sxmo-xdm-config/tree/master/item/xdm.confd). Currently, the `$xdm_opts` variable is empty.
* The [`/usr/lib/X11/Xsetup_0`](https://git.sr.ht/~mil/sxmo-xdm-config/tree/master/item/Xsetup_0) script runs to assist in setting up the screen the user sees along with the xlogin widget. 
  * If present, the file `/usr/lib/X11/xdm/wallpaper.jpg` will be set as the background for the login screen. 
  * If present, the file `/usr/lib/X11/xdm/welcome.ogg` will be played as the startup sound.
* The xlogin widget is displayed based on the configuration in [`/etc/X11/xdm/Xresources`](https://git.sr.ht/~mil/sxmo-xdm-config/tree/master/item/Xresources), including colors, fonts, dimensions, and optional logo. 
* After the user logs in, the  [`/usr/lib/X11/Xstartup`](https://gitlab.freedesktop.org/xorg/app/xdm/-/blob/master/config/Xstartup.in) script runs, which registers the user's session using `sessreg`.
* Then `xdm` runs the [`/usr/lib/X11/Xsession`](https://git.sr.ht/~mil/sxmo-xdm-config/tree/master/item/Xsession) script, which simply hands off control to  [`/usr/sbin/sxmo_xinit.sh`](https://git.sr.ht/~mil/sxmo-utils/tree/master/item/scripts/core/sxmo_xinit.sh).

When the user logs out, `xdm` will run `/usr/lib/X11/Xreset` which currently only deregisters the user. Then the X server is reset and `Xsetup_0` is run again.)
## Display Manager - tinydm

Details on `tinydm` and the configuration can be found in the [`tinydm` ticket page](https://gitlab.com/postmarketOS/pmaports/-/issues/823).

* /var/lib/tinydm/default-session.desktop is a symlink to the wayland/x11 session to be started.
* tinydm.initd
  * openrc service file, runs autologin user tinydm-run-session
  * the username should be determined by uid, and the uid provided in a config file that postmarketos-base installs
  * essentially we can do rc-service tinydm restart then, just as if it was lightdm
* tinydm-run-session
  * resolves /var/lib/tinydm/default-session.desktop
  * starts the session (wayland or x11 is determined by the resolved path)
* tinydm-set-session is used to update this link
  * example: tinydm-set-session /usr/share/wayland-sessions/phosh.desktop
  * a force flag [-f] would overwrite it in any case
* tinydm-unset-session is used to remove a known outdated link
  * example: tinydm-unset-session /usr/share/wayland-sessions-pmos/phosh.desktop
  * if the link exists and points to exactly that file, it is removed.

## sxmo_xinit.sh