From 091665a975eb3275c365ea375216e217d4169dfb Mon Sep 17 00:00:00 2001 From: Softer Date: Wed, 10 Jun 2026 09:56:17 +0300 Subject: [PATCH] Add users to seat group when seatd is selected (#4578) * Add users to seat group when seatd is selected When a desktop profile uses seatd for seat access, the user must be in the seat group for the compositor to access input devices. Without this, sway/hyprland/niri/labwc fail to start after installation. * Move seat access provisioning into DesktopProfile.provision() The four Wayland profiles (Hyprland, Sway, niri, labwc) each duplicated a provision() override calling provision_seat_access(). Move that into the base DesktopProfile.provision() loop, which already iterates the selected profiles, and read CustomSetting.SeatAccess from each. The None check now lives at the call site (walrus), so provision_seat_access() takes a plain str. This removes the per-profile overrides and their TYPE_CHECKING imports. * Use top-level imports in seat access utils The Installer and User imports were under a TYPE_CHECKING guard, but they cause no circular import (bspwm.py already imports both at top level). Move them to module scope per review feedback. --- archinstall/default_profiles/desktop.py | 6 +++++- archinstall/default_profiles/desktops/utils.py | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/archinstall/default_profiles/desktop.py b/archinstall/default_profiles/desktop.py index b70f9f11..f9195357 100644 --- a/archinstall/default_profiles/desktop.py +++ b/archinstall/default_profiles/desktop.py @@ -1,6 +1,7 @@ from typing import TYPE_CHECKING, Self, override -from archinstall.default_profiles.profile import DisplayServerType, GreeterType, Profile, ProfileType, SelectResult +from archinstall.default_profiles.desktops.utils import provision_seat_access +from archinstall.default_profiles.profile import CustomSetting, DisplayServerType, GreeterType, Profile, ProfileType, SelectResult from archinstall.lib.log import info from archinstall.lib.menu.helpers import Selection from archinstall.lib.profile.profiles_handler import profile_handler @@ -94,6 +95,9 @@ class DesktopProfile(Profile): for profile in self.current_selection: profile.provision(install_session, users) + if seat_access := profile.custom_settings.get(CustomSetting.SeatAccess): + provision_seat_access(install_session, users, seat_access) + @override def install(self, install_session: Installer) -> None: # Install common packages for all desktop environments diff --git a/archinstall/default_profiles/desktops/utils.py b/archinstall/default_profiles/desktops/utils.py index 03e85aa5..b179ad50 100644 --- a/archinstall/default_profiles/desktops/utils.py +++ b/archinstall/default_profiles/desktops/utils.py @@ -1,6 +1,8 @@ from enum import Enum +from archinstall.lib.installer import Installer from archinstall.lib.menu.helpers import Selection +from archinstall.lib.models.users import User from archinstall.lib.translationhandler import tr from archinstall.tui.menu_item import MenuItem, MenuItemGroup from archinstall.tui.result import ResultType @@ -11,6 +13,16 @@ class SeatAccess(Enum): polkit = 'polkit' +def provision_seat_access( + install_session: Installer, + users: list[User], + seat_access: str, +) -> None: + if seat_access == SeatAccess.seatd.value: + for user in users: + install_session.arch_chroot(f'usermod -a -G seat {user.username}') + + async def select_seat_access(profile_name: str, default: str | None) -> SeatAccess: header = tr('{} needs access to your seat').format(profile_name) header += f' ({tr("collection of hardware devices i.e. keyboard, mouse")})' + '\n'