V0rt3x667/ArchyPie-Setup

Test Experimental Video Detection

V0rt3x667 opened this issue · 2 comments

Replace the hacky and not very robust method of detecting x11/wayland/kms use via reading the envar XDG_SESSION_TYPE.

The following un-merged pull request has been submitted to the RetroPie Project. I would like to adopt it early with some modifications: RetroPie/RetroPie-Setup#3686

TARGETS:

  • Remove usage of XDG_SESSION_TYPE
  • Restore using sudo to run the script as per RetroPie

ON HOLD!

After doing further research I have come to the conclusion that there is no reliable one size fits all solution to determine session type. XDG_SESSION_TYPE is a none starter because it can be set by a display manger but what if you don't use one? It can also be set by the desktop or compositor but what if you use a desktop that does not set this envar? How about building a binary via SSH which sets XDG_SESSION_TYPE to tty? The build won't work on x11 or wayland as it assumes a kms setup.

Other solutions rely on parsing loginctl such as loginctl show-session $(awk -v u="$USER" '$0 ~ u{print $1}'<<<$(loginctl)) -p Type. What about users of distros like Artix that do not use systemd as an init system?

I have reverted the main branch to the default RetroPie behaviour. I will keep the test_video branch as alternative for anyone wishing to use it.