1+ from enum import Enum
12from typing import override
23
3- from archinstall .default_profiles .profile import DisplayServerType , GreeterType , Profile , ProfileType
4+ from archinstall .default_profiles .profile import CustomSetting , DisplayServerType , GreeterType , Profile , ProfileType
5+ from archinstall .lib .menu .helpers import Selection
6+ from archinstall .lib .translationhandler import tr
7+ from archinstall .tui .ui .menu_item import MenuItem , MenuItemGroup
8+ from archinstall .tui .ui .result import ResultType
9+
10+
11+ class PlasmaFlavor (Enum ):
12+ Plasma = 'plasma'
13+ Meta = 'plasma-meta'
14+ Desktop = 'plasma-desktop'
15+
16+ def show (self ) -> str :
17+ match self :
18+ case PlasmaFlavor .Plasma :
19+ desc = tr ('Extensive KDE Plasma installation' )
20+ case PlasmaFlavor .Meta :
21+ desc = tr ('Curated selection of KDE Plasma packages' )
22+ case PlasmaFlavor .Desktop :
23+ desc = tr ('Minimal KDE Plasma installation' )
24+ case _:
25+ raise ValueError (f'Unknown Plasma flavor: { self } ' )
26+
27+ return f'{ self .value } : { desc } '
428
529
630class PlasmaProfile (Profile ):
@@ -15,18 +39,46 @@ def __init__(self) -> None:
1539 @property
1640 @override
1741 def packages (self ) -> list [str ]:
18- return [
19- 'plasma-desktop' ,
20- 'kscreen' ,
21- 'plasma-pa' ,
22- 'konsole' ,
23- 'kate' ,
24- 'dolphin' ,
25- 'ark' ,
26- 'plasma-workspace' ,
27- ]
42+ flavor_str = self .custom_settings .get (CustomSetting .PlasmaFlavor , PlasmaFlavor .Plasma .value )
43+ flavor = PlasmaFlavor (flavor_str )
44+
45+ match flavor :
46+ case PlasmaFlavor .Plasma :
47+ return [
48+ 'plasma' ,
49+ ]
50+ case PlasmaFlavor .Meta :
51+ return [
52+ 'plasma-meta' ,
53+ ]
54+ case PlasmaFlavor .Desktop :
55+ return [
56+ 'plasma-desktop' ,
57+ ]
2858
2959 @property
3060 @override
3161 def default_greeter_type (self ) -> GreeterType :
3262 return GreeterType .PlasmaLoginManager
63+
64+ async def _select_flavor (self ) -> None :
65+ header = tr ('Select a flavor of KDE Plasma to install' ) + '\n '
66+
67+ items = [MenuItem (s .show (), value = s ) for s in PlasmaFlavor ]
68+ group = MenuItemGroup (items , sort_items = False )
69+
70+ default = self .custom_settings .get (CustomSetting .PlasmaFlavor , None )
71+ group .set_default_by_value (default )
72+
73+ result = await Selection [PlasmaFlavor ](
74+ group ,
75+ header = header ,
76+ allow_skip = False ,
77+ ).show ()
78+
79+ if result .type_ == ResultType .Selection :
80+ self .custom_settings [CustomSetting .PlasmaFlavor ] = result .get_value ().value
81+
82+ @override
83+ async def do_on_select (self ) -> None :
84+ await self ._select_flavor ()
0 commit comments