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.
This commit is contained in:
Softer 2026-06-10 09:56:17 +03:00 committed by GitHub
parent 73d78b1aa9
commit 091665a975
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View File

@ -1,6 +1,7 @@
from typing import TYPE_CHECKING, Self, override 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.log import info
from archinstall.lib.menu.helpers import Selection from archinstall.lib.menu.helpers import Selection
from archinstall.lib.profile.profiles_handler import profile_handler from archinstall.lib.profile.profiles_handler import profile_handler
@ -94,6 +95,9 @@ class DesktopProfile(Profile):
for profile in self.current_selection: for profile in self.current_selection:
profile.provision(install_session, users) profile.provision(install_session, users)
if seat_access := profile.custom_settings.get(CustomSetting.SeatAccess):
provision_seat_access(install_session, users, seat_access)
@override @override
def install(self, install_session: Installer) -> None: def install(self, install_session: Installer) -> None:
# Install common packages for all desktop environments # Install common packages for all desktop environments

View File

@ -1,6 +1,8 @@
from enum import Enum from enum import Enum
from archinstall.lib.installer import Installer
from archinstall.lib.menu.helpers import Selection from archinstall.lib.menu.helpers import Selection
from archinstall.lib.models.users import User
from archinstall.lib.translationhandler import tr from archinstall.lib.translationhandler import tr
from archinstall.tui.menu_item import MenuItem, MenuItemGroup from archinstall.tui.menu_item import MenuItem, MenuItemGroup
from archinstall.tui.result import ResultType from archinstall.tui.result import ResultType
@ -11,6 +13,16 @@ class SeatAccess(Enum):
polkit = 'polkit' 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: async def select_seat_access(profile_name: str, default: str | None) -> SeatAccess:
header = tr('{} needs access to your seat').format(profile_name) header = tr('{} needs access to your seat').format(profile_name)
header += f' ({tr("collection of hardware devices i.e. keyboard, mouse")})' + '\n' header += f' ({tr("collection of hardware devices i.e. keyboard, mouse")})' + '\n'