Skip to content

Commit 091665a

Browse files
authored
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.
1 parent 73d78b1 commit 091665a

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

archinstall/default_profiles/desktop.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from typing import TYPE_CHECKING, Self, override
22

3-
from archinstall.default_profiles.profile import DisplayServerType, GreeterType, Profile, ProfileType, SelectResult
3+
from archinstall.default_profiles.desktops.utils import provision_seat_access
4+
from archinstall.default_profiles.profile import CustomSetting, DisplayServerType, GreeterType, Profile, ProfileType, SelectResult
45
from archinstall.lib.log import info
56
from archinstall.lib.menu.helpers import Selection
67
from archinstall.lib.profile.profiles_handler import profile_handler
@@ -94,6 +95,9 @@ def provision(self, install_session: Installer, users: list[User]) -> None:
9495
for profile in self.current_selection:
9596
profile.provision(install_session, users)
9697

98+
if seat_access := profile.custom_settings.get(CustomSetting.SeatAccess):
99+
provision_seat_access(install_session, users, seat_access)
100+
97101
@override
98102
def install(self, install_session: Installer) -> None:
99103
# Install common packages for all desktop environments

archinstall/default_profiles/desktops/utils.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from enum import Enum
22

3+
from archinstall.lib.installer import Installer
34
from archinstall.lib.menu.helpers import Selection
5+
from archinstall.lib.models.users import User
46
from archinstall.lib.translationhandler import tr
57
from archinstall.tui.menu_item import MenuItem, MenuItemGroup
68
from archinstall.tui.result import ResultType
@@ -11,6 +13,16 @@ class SeatAccess(Enum):
1113
polkit = 'polkit'
1214

1315

16+
def provision_seat_access(
17+
install_session: Installer,
18+
users: list[User],
19+
seat_access: str,
20+
) -> None:
21+
if seat_access == SeatAccess.seatd.value:
22+
for user in users:
23+
install_session.arch_chroot(f'usermod -a -G seat {user.username}')
24+
25+
1426
async def select_seat_access(profile_name: str, default: str | None) -> SeatAccess:
1527
header = tr('{} needs access to your seat').format(profile_name)
1628
header += f' ({tr("collection of hardware devices i.e. keyboard, mouse")})' + '\n'

0 commit comments

Comments
 (0)