feat(Installer): Add Multi Desktop environnement in the installer to allow the user to choose wich desktop env

This commit is contained in:
2026-05-27 19:22:42 +02:00
parent a9d4b9ac91
commit f6ee07429b
23 changed files with 358 additions and 25 deletions
@@ -0,0 +1,43 @@
#!/usr/bin/env python3
"""
Calamares job : lit le choix de bureau depuis GlobalStorage
(packagechooser_desktop) et l'écrit dans /run/fws-desktop pour
que shellprocess puisse appeler le bon fws-desktop-init-*.
"""
import libcalamares
VALID_DESKTOPS = {"xfce", "kde", "gnome", "hyprland"}
FALLBACK = "xfce"
def pretty_name():
return "Sauvegarde du choix d'environnement de bureau"
def run():
gs = libcalamares.globalstorage
raw = gs.value("packagechooser_desktop")
# packagechooser peut renvoyer une str ou une liste selon la version
if isinstance(raw, list):
choice = raw[0] if raw else FALLBACK
elif isinstance(raw, str):
choice = raw.strip()
else:
choice = FALLBACK
if choice not in VALID_DESKTOPS:
choice = FALLBACK
try:
with open("/run/fws-desktop", "w") as fh:
fh.write(choice)
except OSError as exc:
return (
"Impossible d'écrire /run/fws-desktop",
f"{exc}\nLe bureau sera xfce par défaut.",
)
libcalamares.utils.debug(f"fws-desktop-choice : bureau sélectionné = {choice}")
return None