#!/usr/bin/env python3 import libcalamares # Chaque valeur doit avoir un /usr/local/bin/fws-desktop-init- # correspondant (invariant 1:1). Toute valeur hors-set retombe sur FALLBACK. VALID = {"xfce", "kde", "gnome", "hyprland"} FALLBACK = "xfce" def pretty_name(): return "Sélection de l'environnement de bureau" STATE = "/run/fws-desktop" def run(): # Le choix est fait dans le live par /usr/local/bin/fws-pick-desktop, qui # écrit STATE (le module packagechooser n'est pas compilé dans le paquet # calamares AUR, donc pas de sélection côté Calamares). Ici on valide et on # normalise pour garantir une valeur sûre à shellprocess (repli xfce). choice = FALLBACK try: with open(STATE) as fh: raw = fh.read().strip() if raw in VALID: choice = raw except OSError: pass try: with open(STATE, "w") as fh: fh.write(choice) except OSError as e: libcalamares.utils.warning(f"fws-desktop-choice: impossible d'écrire {STATE}: {e}") libcalamares.utils.debug(f"fws-desktop-choice: bureau = {choice}") return None