"""Screen lock. UI-frei. niri-only — Locker via swaylock (ext-session-lock)."""
from __future__ import annotations

import shutil

# swaylock spricht das ext-session-lock-Protokoll, das niri implementiert;
# gtklock als Fallback. (hyprlock entfällt — Hyprland-only.)
_LOCKERS = ("swaylock", "gtklock")


def locker() -> str | None:
    for name in _LOCKERS:
        if shutil.which(name):
            return name
    return None


def preferred() -> str:
    return "swaylock"


def lock_now_argv() -> list[str] | None:
    name = locker()
    return [name] if name else None


def install_argv() -> list[str]:
    return ["pacman", "-S", "--needed", "--noconfirm", preferred()]
