From 20cc124a6dfa98b5e187708f5ed8facbfba734ba Mon Sep 17 00:00:00 2001 From: Daniel Girtler Date: Wed, 20 Nov 2024 00:50:16 +1100 Subject: [PATCH] Fix seat-access selection (#2885) * Fix seat-access selection * Format import --- archinstall/default_profiles/desktops/__init__.py | 6 ++++++ archinstall/default_profiles/desktops/hyprland.py | 11 +++-------- archinstall/default_profiles/desktops/sway.py | 9 ++------- archinstall/lib/profile/profiles_handler.py | 6 +++++- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/archinstall/default_profiles/desktops/__init__.py b/archinstall/default_profiles/desktops/__init__.py index e69de29b..d91a0f3a 100644 --- a/archinstall/default_profiles/desktops/__init__.py +++ b/archinstall/default_profiles/desktops/__init__.py @@ -0,0 +1,6 @@ +from enum import Enum + + +class SeatAccess(Enum): + seatd = 'seatd' + polkit = 'polkit' diff --git a/archinstall/default_profiles/desktops/hyprland.py b/archinstall/default_profiles/desktops/hyprland.py index 43f5fb2c..5df6b89c 100644 --- a/archinstall/default_profiles/desktops/hyprland.py +++ b/archinstall/default_profiles/desktops/hyprland.py @@ -1,6 +1,6 @@ -from enum import Enum from typing import TYPE_CHECKING, Any +from archinstall.default_profiles.desktops import SeatAccess from archinstall.default_profiles.profile import GreeterType, ProfileType, SelectResult from archinstall.default_profiles.xorg import XorgProfile from archinstall.tui import Alignment, FrameProperties, MenuItem, MenuItemGroup, ResultType, SelectMenu @@ -10,11 +10,6 @@ if TYPE_CHECKING: _: Any -class SeatAccess(Enum): - seatd = 'seatd' - polkit = 'polkit' - - class HyprlandProfile(XorgProfile): def __init__(self) -> None: super().__init__('Hyprland', ProfileType.DesktopEnv, description='') @@ -44,7 +39,7 @@ class HyprlandProfile(XorgProfile): @property def services(self) -> list[str]: if pref := self.custom_settings.get('seat_access', None): - return [pref.value] + return [pref] return [] def _ask_seat_access(self) -> None: @@ -68,7 +63,7 @@ class HyprlandProfile(XorgProfile): if result.type_ == ResultType.Selection: if result.item() is not None: - self.custom_settings['seat_access'] = result.get_value() + self.custom_settings['seat_access'] = result.get_value().value def do_on_select(self) -> SelectResult | None: self._ask_seat_access() diff --git a/archinstall/default_profiles/desktops/sway.py b/archinstall/default_profiles/desktops/sway.py index 21a9db43..774160d6 100644 --- a/archinstall/default_profiles/desktops/sway.py +++ b/archinstall/default_profiles/desktops/sway.py @@ -1,6 +1,6 @@ -from enum import Enum from typing import TYPE_CHECKING, Any +from archinstall.default_profiles.desktops import SeatAccess from archinstall.default_profiles.profile import GreeterType, ProfileType, SelectResult from archinstall.default_profiles.xorg import XorgProfile from archinstall.tui import Alignment, FrameProperties, MenuItem, MenuItemGroup, ResultType, SelectMenu @@ -10,11 +10,6 @@ if TYPE_CHECKING: _: Any -class SeatAccess(Enum): - seatd = 'seatd' - polkit = 'polkit' - - class SwayProfile(XorgProfile): def __init__(self) -> None: super().__init__( @@ -77,7 +72,7 @@ class SwayProfile(XorgProfile): if result.type_ == ResultType.Selection: if result.item() is not None: - self.custom_settings['seat_access'] = result.get_value() + self.custom_settings['seat_access'] = result.get_value().value def do_on_select(self) -> SelectResult | None: self._ask_seat_access() diff --git a/archinstall/lib/profile/profiles_handler.py b/archinstall/lib/profile/profiles_handler.py index 88cd96ce..db6cd803 100644 --- a/archinstall/lib/profile/profiles_handler.py +++ b/archinstall/lib/profile/profiles_handler.py @@ -120,9 +120,13 @@ class ProfileHandler: info('No profile definition found: {}'.format(', '.join(invalid_sub_profiles))) custom_settings = profile_config.get('custom_settings', {}) - profile.set_custom_settings(custom_settings) profile.current_selection = valid_sub_profiles + for sub_profile in valid_sub_profiles: + sub_profile_settings = custom_settings.get(sub_profile.name, {}) + if sub_profile_settings: + sub_profile.custom_settings = sub_profile_settings + return profile @property