Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/default_profiles/desktop.py
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2024-05-10 15:56:28 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2024-05-10 15:56:28 +0200
commit683da22298abbd90f51d4dd38a7ec4b0dfb04555 (patch)
treeec2ac04967f9277df038edc362201937b331abe5 /archinstall/default_profiles/desktop.py
parentaf7ab9833c9f9944874f0162ae0975175ddc628d (diff)
parent3381cd55673e5105697d354cf4a1be9a7bcef062 (diff)
merged with upstreamHEADmaster
Diffstat (limited to 'archinstall/default_profiles/desktop.py')
-rw-r--r--archinstall/default_profiles/desktop.py87
1 files changed, 87 insertions, 0 deletions
diff --git a/archinstall/default_profiles/desktop.py b/archinstall/default_profiles/desktop.py
new file mode 100644
index 00000000..417d86d6
--- /dev/null
+++ b/archinstall/default_profiles/desktop.py
@@ -0,0 +1,87 @@
+from typing import Any, TYPE_CHECKING, List, Optional, Dict
+
+from archinstall.lib import menu
+from archinstall.lib.output import info
+from archinstall.lib.profile.profiles_handler import profile_handler
+from archinstall.default_profiles.profile import Profile, ProfileType, SelectResult, GreeterType
+
+if TYPE_CHECKING:
+ from archinstall.lib.installer import Installer
+ _: Any
+
+
+class DesktopProfile(Profile):
+ def __init__(self, current_selection: List[Profile] = []):
+ super().__init__(
+ 'Desktop',
+ ProfileType.Desktop,
+ description=str(_('Provides a selection of desktop environments and tiling window managers, e.g. GNOME, KDE Plasma, Sway')),
+ current_selection=current_selection,
+ support_greeter=True
+ )
+
+ @property
+ def packages(self) -> List[str]:
+ return [
+ 'nano',
+ 'vim',
+ 'openssh',
+ 'htop',
+ 'wget',
+ 'iwd',
+ 'wireless_tools',
+ 'wpa_supplicant',
+ 'smartmontools',
+ 'xdg-utils'
+ ]
+
+ @property
+ def default_greeter_type(self) -> Optional[GreeterType]:
+ combined_greeters: Dict[GreeterType, int] = {}
+ for profile in self.current_selection:
+ if profile.default_greeter_type:
+ combined_greeters.setdefault(profile.default_greeter_type, 0)
+ combined_greeters[profile.default_greeter_type] += 1
+
+ if len(combined_greeters) >= 1:
+ return list(combined_greeters)[0]
+
+ return None
+
+ def _do_on_select_profiles(self):
+ for profile in self.current_selection:
+ profile.do_on_select()
+
+ def do_on_select(self) -> SelectResult:
+ choice = profile_handler.select_profile(
+ profile_handler.get_desktop_profiles(),
+ self._current_selection,
+ title=str(_('Select your desired desktop environment')),
+ multi=True
+ )
+
+ match choice.type_:
+ case menu.MenuSelectionType.Selection:
+ self.set_current_selection(choice.value) # type: ignore
+ self._do_on_select_profiles()
+ return SelectResult.NewSelection
+ case menu.MenuSelectionType.Skip:
+ return SelectResult.SameSelection
+ case menu.MenuSelectionType.Reset:
+ return SelectResult.ResetCurrent
+
+ def post_install(self, install_session: 'Installer'):
+ for profile in self._current_selection:
+ profile.post_install(install_session)
+
+ def install(self, install_session: 'Installer'):
+ # Install common packages for all desktop environments
+ install_session.add_additional_packages(self.packages)
+
+ for profile in self._current_selection:
+ info(f'Installing profile {profile.name}...')
+
+ install_session.add_additional_packages(profile.packages)
+ install_session.enable_service(profile.services)
+
+ profile.install(install_session)