diff --git a/BUILD.md b/BUILD.md index b60beaee..e3ef3048 100644 --- a/BUILD.md +++ b/BUILD.md @@ -109,8 +109,8 @@ release tags. release's, and one built in between is newer than its version says until the next release replaces it. - The layout is upstream Omarchy's: the Omarchy tree in `/usr/share/omarchy` - (`OMARCHY_PATH`) with its commands in `/usr/bin`, the greeter in - `/usr/share/omarchy-greeter`, session helpers in `/usr/libexec`, the tablet + (`OMARCHY_PATH`) with its commands in `/usr/bin`, session helpers in + `/usr/libexec`, the tablet user's defaults in `/etc/skel` (and in `/usr/share/omarchy/config`, where `omarchy-refresh-config` copies them from), `system/overlay` where it says. Files another package owns (filesystem's `/etc/os-release`, bluez's diff --git a/CHANGELOG.md b/CHANGELOG.md index 12f4ed16..543bd752 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,9 @@ is missing or empty. in red without anything moving. - The Home button responds to every press: it no longer depends on what the keyboard is doing. +- No more separate login screen: the tablet boots straight to the lock, the + same screen as after Power, and the desktop is ready the moment you enter + the PIN. Logout starts a fresh desktop behind the lock. ## [0.3.2] - 2026-11-19 diff --git a/desktop/configuration/first-theme b/desktop/configuration/first-theme index cbdad5ff..b07e9faf 100644 --- a/desktop/configuration/first-theme +++ b/desktop/configuration/first-theme @@ -41,7 +41,6 @@ if [[ ! -e "$state/icons.revision" ]]; then fi # Apply the same GTK light/dark and icon settings as upstream Omarchy. omarchy-theme-set-gnome || echo 'Warning: could not update GTK theme settings' >&2 -if command -v omarchy-greeter-theme-publish >/dev/null; then omarchy-greeter-theme-publish || true; fi # This only registers the user hook and queues local theme state; it does not # copy or reuse the VM's Firefox profile. Package installation is a separate step. if command -v omafox >/dev/null; then diff --git a/desktop/configuration/login-session b/desktop/configuration/login-session index 464d1bf8..da02a616 100644 --- a/desktop/configuration/login-session +++ b/desktop/configuration/login-session @@ -1,5 +1,6 @@ #!/bin/bash -# Started by greetd on VT1 once PAM accepted the PIN, never from SSH. +# Started by greetd on VT1 at boot, without a prompt (its initial session), +# never from SSH. The session starts locked: the PIN is the lock's. set -euo pipefail [[ ${XDG_VTNR:-} == 1 && ${USER:-} == tablet && -z ${SSH_CONNECTION:-} ]] || exit 1 [[ -n ${XDG_SESSION_ID:-} && -d ${XDG_RUNTIME_DIR:-/nonexistent} && -O $XDG_RUNTIME_DIR ]] || { @@ -11,8 +12,6 @@ set -euo pipefail exit 1 } export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus" -# The user session must read its live theme, not the greeter's snapshot. -unset OMARCHY_GREETER_THEME_DIR export OMARCHY_PATH=/usr/share/omarchy export XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=labwc export WLR_RENDERER=pixman QT_QUICK_BACKEND=software QT_QPA_PLATFORM=wayland @@ -108,4 +107,21 @@ omarchy-toggle-maximize-windows --apply || true session_config=$XDG_RUNTIME_DIR/omarchy-xdg-config /usr/libexec/arch-ipad-touch-output "$session_config/labwc/rc.xml" || true export XDG_CONFIG_DIRS="$HOME/.local/state/omarchy/xdg-config:$session_config:${XDG_CONFIG_DIRS:-/etc/xdg}" -exec /usr/bin/labwc -m +# The shell takes the lock before the desktop is seen: Labwc's startup cover +# lifts only once the lock is drawn (plugins/lock/Service.qml). +export OMARCHY_START_LOCKED=1 +# A logout ends Labwc; so does a crash. Either way the desktop starts again +# here, behind the lock: there is no login screen to go back to. A desktop that +# ends within 10 s three times in a row (a second apart) is not restarted: greetd then runs +# omarchy-session-failed, and serial and SSH are there. +quick=0 +while :; do + started=$SECONDS + /usr/bin/labwc -m || true + if (( SECONDS - started < 10 )); then + (( ++quick < 3 )) || { logger -t omarchy-session 'The desktop ended at once three times; not restarting it'; exit 1; } + sleep 1 + else + quick=0 + fi +done diff --git a/desktop/greeter/greetd.toml b/desktop/greeter/greetd.toml deleted file mode 100644 index 828ade8e..00000000 --- a/desktop/greeter/greetd.toml +++ /dev/null @@ -1,8 +0,0 @@ -# The touch PIN greeter on VT1. It starts the desktop as tablet once PAM -# (/etc/pam.d/greetd, written by the installer) accepts the PIN. -[terminal] -vt = 1 - -[default_session] -command = "/usr/libexec/omarchy-greeter-session" -user = "greeter" diff --git a/desktop/greeter/greeter-session b/desktop/greeter/greeter-session deleted file mode 100644 index 974a0785..00000000 --- a/desktop/greeter/greeter-session +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -set -eu -export XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=labwc -export WLR_RENDERER=pixman QT_QUICK_BACKEND=software QT_QPA_PLATFORM=wayland -export LIBGL_ALWAYS_SOFTWARE=1 LIBSEAT_BACKEND=seatd -export OMARCHY_TOUCH_MODE=1 -# greetd's greeter user has no home; keep Quickshell's caches in its session. -export XDG_CACHE_HOME="$XDG_RUNTIME_DIR/cache" XDG_STATE_HOME="$XDG_RUNTIME_DIR/state" -# The snapshot contains data only; the QML code below remains system-owned. -theme=$(readlink -f /var/lib/omarchy-greeter-theme/current 2>/dev/null || true) -case "$theme" in - /var/lib/omarchy-greeter-theme/snapshot-*) ;; - *) theme= ;; -esac -if [ -z "$theme" ] || [ ! -s "$theme/colors.toml" ] || [ ! -f "$theme/background" ]; then - theme=/usr/share/omarchy-greeter/default-theme -fi -export OMARCHY_GREETER_THEME_DIR=$theme -# -S ends the compositor when the greeter exits, allowing greetd to launch the user session. -exec /usr/bin/labwc -C /usr/share/omarchy-greeter/labwc -S 'qs -p /usr/share/omarchy-greeter/shell.qml' diff --git a/desktop/greeter/labwc/autostart b/desktop/greeter/labwc/autostart deleted file mode 100644 index a3e3c752..00000000 --- a/desktop/greeter/labwc/autostart +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# The greeter itself is started by labwc -S so its exit ends the compositor. -# The same logical scale as the desktop (and its lock screen): the native -# panel at scale 2, before the greeter maps. -/usr/libexec/arch-ipad-scale-output > "$XDG_RUNTIME_DIR/greeter-display.log" 2>&1 || true -# No cursor on the touch greeter: the desktop's startup HideCursor chord. -/usr/libexec/omarchy-wtype -M alt -M logo h -m logo -m alt > "$XDG_RUNTIME_DIR/greeter-cursor.log" 2>&1 || true diff --git a/desktop/greeter/labwc/rc.xml b/desktop/greeter/labwc/rc.xml deleted file mode 100644 index 6cf56b3c..00000000 --- a/desktop/greeter/labwc/rc.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - yes - server - /run/omarchy-handover - yes - yes - - - - - - - - diff --git a/desktop/greeter/shell.qml b/desktop/greeter/shell.qml deleted file mode 100644 index 746d0eff..00000000 --- a/desktop/greeter/shell.qml +++ /dev/null @@ -1,117 +0,0 @@ -import QtQuick -import Quickshell -import Quickshell.Io -import Quickshell.Wayland -import Quickshell.Services.Greetd -import "plugins/lock" as Lock - -ShellRoot { - id: root - property string pin: "" - property string submittedPin: "" - property bool busy: false - property string failure: "" - readonly property string themeDir: Quickshell.env("OMARCHY_GREETER_THEME_DIR") - - function submit(value) { - if (busy || !/^[0-9]{6}$/.test(value)) return - if (!Greetd.available) { failure = "Authentication is unavailable"; return } - failure = "" - submittedPin = value - busy = true - Greetd.createSession("tablet") - } - Connections { - target: Greetd - function onAuthMessage(message, error, responseRequired, echoResponse) { - if (responseRequired && !echoResponse && root.submittedPin !== "") { - const answer = root.submittedPin - root.submittedPin = "" - Greetd.respond(answer) - } else if (responseRequired) { - root.submittedPin = "" - root.busy = false - root.failure = "Unsupported authentication prompt" - Greetd.cancelSession() - } else if (error) { - root.failure = "Authentication failed. Try again." - } - } - function onAuthFailure(message) { - root.submittedPin = "" - root.pin = "" - root.busy = false - root.failure = "PIN not accepted. Try again." - } - function onError(error) { - root.submittedPin = "" - root.pin = "" - root.busy = false - root.failure = "PIN not accepted, or sign-in temporarily unavailable." - } - function onReadyToLaunch() { - root.submittedPin = "" - Greetd.launch(["/usr/libexec/arch-ipad-login-session"]) - } - } - - // The PIN screen is on: record it for the installer (omarchy-desktop-ready) - Process { - id: readiness - command: ["/usr/libexec/omarchy-desktop-ready"] - } - Component.onCompleted: Qt.callLater(function() { readiness.running = true }) - - // No input for 30 s: dark, then sleep, through omarchy-powerd like everything - // else. Repeated while idle: it does nothing once dark, and a wake that does - // not count as input here cannot leave the panel lit for good. - IdleMonitor { - id: idle - timeout: 30 - respectInhibitors: false - } - Process { - id: darken - command: ["/usr/libexec/omarchy-powerctl", "idle"] - } - Timer { - interval: 30000 - repeat: true - running: idle.isIdle - triggeredOnStart: true - onTriggered: darken.running = true - } - - PanelWindow { - id: window - anchors { top: true; bottom: true; left: true; right: true } - color: "transparent" - WlrLayershell.namespace: "orchard-greeter" - WlrLayershell.layer: WlrLayer.Overlay - WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive - - // Labwc holds the previous session's last picture until this file - // exists (handoverDirectory): the pad appears with its wallpaper drawn. - property int drawnFrames: 0 - FrameAnimation { - running: view.backgroundDrawn && window.drawnFrames < 3 - onTriggered: { - window.drawnFrames += 1 - var file = Quickshell.env("LABWC_STARTUP_READY") || "" - if (window.drawnFrames === 3 && file !== "") Quickshell.execDetached(["touch", file]) - } - } - Lock.LockView { - id: view - anchors.fill: parent - backgroundPath: root.themeDir + "/background" - passwordText: root.pin - authenticatingPassword: root.busy - failureMessage: root.failure - inputEnabled: true - onPasswordTextEdited: function(value) { root.pin = value } - onSubmitPassword: function(value) { root.submit(value) } - onClearFailureRequested: root.failure = "" - } - } -} diff --git a/desktop/install-tree b/desktop/install-tree index af3e7710..fc56db01 100755 --- a/desktop/install-tree +++ b/desktop/install-tree @@ -6,8 +6,8 @@ # BUILD holds the compiled keyboard and cursor helper (`make`), OMARCHY the # pinned upstream Omarchy (desktop/upstream.lock), DBUS_NEXT the unpacked # dbus-next wheel. The layout is upstream Omarchy's package's: the Omarchy -# tree in /usr/share/omarchy (OMARCHY_PATH) with its commands in /usr/bin, the -# greeter in /usr/share/omarchy-greeter, helpers in /usr/libexec, the tablet +# tree in /usr/share/omarchy (OMARCHY_PATH) with its commands in /usr/bin, +# helpers in /usr/libexec, the tablet # user's defaults in /etc/skel (and /usr/share/omarchy/config, where # omarchy-refresh-config copies them from), system/overlay where it says. # Files another package owns go to /usr/share/omarchy/etc-overrides; the @@ -41,20 +41,8 @@ mkdir -p "$omarchy" cp -R "$shell/." "$omarchy/" find "$omarchy" \( -name __pycache__ -o -name '*.pyc' \) -prune -exec rm -rf {} + -# The greeter, system-owned: never read from the user's home directory, with the -# shell's shared UI code. -greeter=$root/usr/share/omarchy-greeter -mkdir -p "$greeter" -cp -R "$here/greeter/." "$greeter/" -cp -R "$shell/shell/Commons" "$shell/shell/Ui" "$greeter/" -for name in LockView.qml; do - put "$shell/shell/plugins/lock/$name" "$greeter/plugins/lock/$name" -done -chmod 755 "$greeter/labwc/autostart" -put "$here/greeter/greeter-session" "$root/usr/libexec/omarchy-greeter-session" 755 - # Upstream's themes at the pin. Jade Horse, upstream's default, is the tablet's -# first theme and the greeter's fallback. +# first theme. cp -RP "$upstream/themes" "$omarchy/themes" # Upstream's app icon sets (Papercraft, the default; Arcade; Original). cp -RP "$upstream/icons" "$omarchy/icons" @@ -66,15 +54,6 @@ cp -R "$here/icons/." "$omarchy/icons/" for set in "$omarchy"/icons/*/; do if [[ -f $set/btop.svg.tpl && ! -e $set/omactivity.svg.tpl ]]; then ln -s btop.svg.tpl "$set/omactivity.svg.tpl"; fi done -theme=$omarchy/themes/jade-horse -put "$theme/colors.toml" "$greeter/default-theme/colors.toml" -[[ ! -f $theme/shell.toml ]] || put "$theme/shell.toml" "$greeter/default-theme/shell.toml" -background=$(find "$theme/backgrounds" -maxdepth 1 -type f \ - \( -iname '*.webp' -o -iname '*.png' -o -iname '*.jpg' -o -iname '*.jpeg' \) | LC_ALL=C sort | head -n 1) -[[ -n $background ]] || { echo 'The default theme has no image background' >&2; exit 1; } -put "$background" "$greeter/default-theme/background" -mkdir -p "$root/usr/lib/tmpfiles.d" -printf 'd /var/lib/omarchy-greeter-theme 0755 tablet tablet -\n' > "$root/usr/lib/tmpfiles.d/omarchy-greeter-theme.conf" # The keyboard and the startup cursor helper. put "$build/wvkbd-mobintl" "$omarchy/trials/wvkbd-mobintl-v0.20-font18-special15-state" 755 @@ -127,7 +106,7 @@ done # Files another package owns (bash's /etc/skel/.bashrc, greetd's config). overrides=$omarchy/etc-overrides put "$config/bashrc" "$overrides/etc/skel/.bashrc" -put "$here/greeter/greetd.toml" "$overrides/etc/greetd/config.toml" +put "$here/login/greetd.toml" "$overrides/etc/greetd/config.toml" # The session's helpers and system files. while read -r source name mode; do @@ -139,7 +118,8 @@ $config/auto-brightness usr/libexec/arch-ipad-auto-brightness 755 $config/rotate-output usr/libexec/arch-ipad-rotate-output 755 $config/touch-output usr/libexec/arch-ipad-touch-output 755 $config/login-session usr/libexec/arch-ipad-login-session 755 -$here/greeter/greetd-seatd.conf etc/systemd/system/greetd.service.d/seatd.conf 644 +$here/login/greetd-seatd.conf etc/systemd/system/greetd.service.d/seatd.conf 644 +$here/login/session-failed usr/libexec/omarchy-session-failed 755 $config/networkmanager.rules etc/polkit-1/rules.d/40-arch-ipad-networkmanager.rules 644 $config/firefox-policies.json usr/lib/firefox/distribution/policies.json 644 $config/firefox-autoconfig.js usr/lib/firefox/defaults/pref/omarchy-a.js 644 diff --git a/desktop/greeter/greetd-seatd.conf b/desktop/login/greetd-seatd.conf similarity index 100% rename from desktop/greeter/greetd-seatd.conf rename to desktop/login/greetd-seatd.conf diff --git a/desktop/login/greetd.toml b/desktop/login/greetd.toml new file mode 100644 index 00000000..35fd6ff6 --- /dev/null +++ b/desktop/login/greetd.toml @@ -0,0 +1,22 @@ +# No login screen: at boot greetd starts the tablet's session without a prompt, +# and the session starts locked. The PIN is the lock's (/etc/pam.d/ +# omarchy-lock-password, written by the installer); a logout starts the desktop +# again behind the lock, inside this same session (arch-ipad-login-session). +[terminal] +vt = 1 + +# The sessions' PAM service: no password step, the tablet user only, the usual +# account and session rules. greetd 0.10 takes the initial session's service +# from here, not from that section. +[general] +service = "greetd-autologin" + +[initial_session] +command = "/usr/libexec/arch-ipad-login-session" +user = "tablet" + +# greetd runs this only when no session runs: the tablet's never came up or +# gave up. It says so in the journal; serial and SSH are there as always. +[default_session] +command = "/usr/libexec/omarchy-session-failed" +user = "greeter" diff --git a/desktop/login/session-failed b/desktop/login/session-failed new file mode 100755 index 00000000..bd4d3b71 --- /dev/null +++ b/desktop/login/session-failed @@ -0,0 +1,6 @@ +#!/bin/sh +# greetd's default session: it runs only when the tablet's session is not +# running (it refused to start, or its desktop kept ending at once). There is +# no login screen to show instead; serial and SSH still log in. +logger -t omarchy-session 'The tablet session is not running; see journalctl -b -t omarchy-session -t greetd. Serial and SSH are available.' +exec sleep infinity diff --git a/desktop/shell/bin/omarchy-greeter-theme-publish b/desktop/shell/bin/omarchy-greeter-theme-publish deleted file mode 100644 index b403a720..00000000 --- a/desktop/shell/bin/omarchy-greeter-theme-publish +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/python3 -"""Publish public theme data for the unprivileged greeter, never executable QML. - -The caller owns the snapshot directory; the greeter only reads it. Atomic -snapshot replacement keeps a running or starting greeter off partial files. -""" -import fcntl -import os -from pathlib import Path -import shutil -import subprocess -import sys -import tempfile - -DEST = Path('/var/lib/omarchy-greeter-theme') -STATE = Path.home() / '.local/state/omarchy/current' -FALLBACK = Path('/usr/share/omarchy-greeter/default-theme/background') -MAX_CONFIG = 128 * 1024 -MAX_IMAGE = 32 * 1024 * 1024 -IMAGES = {'.png', '.jpg', '.jpeg', '.webp', '.bmp'} -VIDEOS = {'.mp4', '.mkv', '.webm', '.mov', '.avi'} - - -def copy_bounded(source, target, limit): - with source.open('rb') as src, target.open('xb') as dst: - data = src.read(limit + 1) - if len(data) > limit: - raise ValueError(f'{source.name} exceeds the size limit') - dst.write(data) - target.chmod(0o644) - - -def publish(): - if not DEST.is_dir(): - raise RuntimeError('greeter theme directory is not provisioned') - fd = os.open(DEST / '.publish.lock', os.O_CREAT | os.O_RDWR | os.O_NOFOLLOW, 0o600) - with os.fdopen(fd, 'r+') as lock: - fcntl.flock(lock, fcntl.LOCK_EX) - build = Path(tempfile.mkdtemp(prefix='snapshot-', dir=DEST)) - build.chmod(0o755) - link = None - published = False - try: - copy_bounded(STATE / 'theme/colors.toml', build / 'colors.toml', MAX_CONFIG) - for source, name in ((STATE / 'theme/shell.toml', 'shell.toml'), - (Path.home() / '.config/omarchy/shell.toml', 'user-shell.toml')): - if source.is_file(): - copy_bounded(source, build / name, MAX_CONFIG) - background = (STATE / 'background').resolve(strict=True) - if background.suffix.lower() in IMAGES: - copy_bounded(background, build / 'background', MAX_IMAGE) - elif background.suffix.lower() in VIDEOS and shutil.which('ffmpegthumbnailer'): - poster = build / 'poster.png' - try: - subprocess.run(['ffmpegthumbnailer', '-i', str(background), '-o', str(poster), '-s', '1920'], - check=True, timeout=8, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) - if not poster.is_file() or poster.stat().st_size > MAX_IMAGE: - raise ValueError('video poster is missing or too large') - poster.rename(build / 'background') - (build / 'background').chmod(0o644) - except (OSError, ValueError, subprocess.SubprocessError): - poster.unlink(missing_ok=True) - copy_bounded(FALLBACK, build / 'background', MAX_IMAGE) - else: - copy_bounded(FALLBACK, build / 'background', MAX_IMAGE) - # The link points only to this newly created, completed directory. - link = DEST / ('.current-' + build.name) - os.symlink(build.name, link) - os.replace(link, DEST / 'current') - link = None - published = True - # Retain a few previous versions for readers that resolved the old - # link just before the swap; do not follow user-created symlinks. - snapshots = sorted((p for p in DEST.iterdir() if p.name.startswith('snapshot-') - and p.is_dir() and not p.is_symlink()), - key=lambda p: p.stat().st_mtime_ns, reverse=True) - for old in snapshots[3:]: - if old != build: - shutil.rmtree(old, ignore_errors=True) - except BaseException: - if link is not None: - link.unlink(missing_ok=True) - if not published: - shutil.rmtree(build, ignore_errors=True) - raise - - -if __name__ == '__main__': - try: - publish() - except (OSError, ValueError, RuntimeError, subprocess.SubprocessError) as error: - print(f'Greeter theme not updated: {error}', file=sys.stderr) - sys.exit(1) diff --git a/desktop/shell/bin/omarchy-system b/desktop/shell/bin/omarchy-system index a5d6e452..c19e339d 100755 --- a/desktop/shell/bin/omarchy-system +++ b/desktop/shell/bin/omarchy-system @@ -18,7 +18,7 @@ fi action=${1:-} case $action in - # Labwc port: login-session execs labwc, and greetd starts the greeter when it exits. + # Labwc port: login-session starts Labwc again when it exits, behind the lock. logout) command=(labwc --exit) ;; reboot) command=(systemctl reboot --no-wall) ;; firmware) command=(systemctl reboot --firmware-setup --no-wall) ;; @@ -61,8 +61,15 @@ exit_session() { fi # Only show the OSD once the exit has taken 2 seconds, so a quick one doesn't flash it. - { sleep 2; omarchy-osd -i "${action/firmware/reboot}" -m "$message" -d 0; } & - local osd_pid=$! + # Orchard: a logout says so at once, until the desktop is gone; it is the + # only sign of it before the next desktop shows the lock. + local osd_pid="" + if [[ $action == "logout" ]]; then + omarchy-osd -i logout -m "$message" -d 0 || true + else + { sleep 2; omarchy-osd -i "${action/firmware/reboot}" -m "$message" -d 0; } & + osd_pid=$! + fi if [[ $action != "logout" ]]; then omarchy-state clear re*-required @@ -71,11 +78,17 @@ exit_session() { # Proceed as soon as apps exit, with a bound for unresponsive windows. timeout 2s omarchy-hyprland-window-close-all --wait if "${command[@]}"; then + # Orchard: a logout ends only the desktop; arch-ipad-login-session starts + # the next one behind the lock in the same login session. Its OSD went + # with the old desktop; nothing is left to wait for. + if [[ $action == "logout" ]]; then + return 0 + fi # The unit kills the delayed OSD when this script exits, so stay until the session goes down. wait "$osd_pid" else local status=$? - kill "$osd_pid" 2>/dev/null + [[ -z $osd_pid ]] || kill "$osd_pid" 2>/dev/null omarchy-shell -q osd close return "$status" fi diff --git a/desktop/shell/bin/omarchy-theme-bg-set b/desktop/shell/bin/omarchy-theme-bg-set index ee0ebc04..45d85cf6 100755 --- a/desktop/shell/bin/omarchy-theme-bg-set +++ b/desktop/shell/bin/omarchy-theme-bg-set @@ -34,14 +34,3 @@ if [[ $(omarchy-shell shell switchBackground "$BACKGROUND" "$INTRO" 2>/dev/null) ln -nsf "$BACKGROUND" "$CURRENT_BACKGROUND_LINK" omarchy-shell -q background set "$BACKGROUND" fi - -# Orchard: the greeter shows the same background. The shell repoints the link -# once its transition is done, so publish after that (bounded: a stuck shell -# still publishes). -if command -v omarchy-greeter-theme-publish >/dev/null; then - for _ in {1..100}; do - [[ $(readlink "$CURRENT_BACKGROUND_LINK") != "$BACKGROUND" ]] || break - sleep 0.1 - done - omarchy-greeter-theme-publish || true -fi diff --git a/desktop/shell/bin/omarchy-theme-set b/desktop/shell/bin/omarchy-theme-set index d2909015..209ba999 100644 --- a/desktop/shell/bin/omarchy-theme-set +++ b/desktop/shell/bin/omarchy-theme-set @@ -48,7 +48,6 @@ colors_payload=$(base64 -w0 "$state/theme/colors.toml") shell_payload=$(base64 -w0 "$state/theme/shell.toml") omarchy-shell -q shell applyTheme "$colors_payload" "$shell_payload" omarchy-shell -q background set "$state/theme/backgrounds/$selected" -if command -v omarchy-greeter-theme-publish >/dev/null; then omarchy-greeter-theme-publish || true; fi kill -HUP "$(pgrep -x labwc | head -n1)" omarchy-theme-set-foot || true # Upstream's icon set, drawn in the new colors after the switch so it never holds it up. diff --git a/desktop/shell/shell/plugins/background/Background.qml b/desktop/shell/shell/plugins/background/Background.qml index d4550f38..19765990 100644 --- a/desktop/shell/shell/plugins/background/Background.qml +++ b/desktop/shell/shell/plugins/background/Background.qml @@ -425,7 +425,9 @@ Item { // shell has drawn (Labwc's startup cover) names a file to create once // the wallpaper is on screen. // Once: the compositor removes the file after its fade. - readonly property string startupReadyFile: Quickshell.env("LABWC_STARTUP_READY") || "" + // A session that starts locked lifts it from the lock instead + // (plugins/lock/Service.qml): the desktop is not to be seen first. + readonly property string startupReadyFile: Quickshell.env("OMARCHY_START_LOCKED") === "1" ? "" : (Quickshell.env("LABWC_STARTUP_READY") || "") property bool startupSignalled: false onBackgroundReadyChanged: { if (!backgroundReady || startupSignalled || startupReadyFile === "") return diff --git a/desktop/shell/shell/plugins/lock/Service.qml b/desktop/shell/shell/plugins/lock/Service.qml index 30e6f946..28f691e9 100644 --- a/desktop/shell/shell/plugins/lock/Service.qml +++ b/desktop/shell/shell/plugins/lock/Service.qml @@ -23,6 +23,15 @@ Item { property bool authenticatingPassword: false property bool fingerprintAuthenticating: false property bool passwordPamConfigured: false + // Orchard: greetd logs the tablet in without a prompt and the session starts + // locked (arch-ipad-login-session sets OMARCHY_START_LOCKED). The lock is + // taken as soon as its PIN check is known; Labwc's startup cover lifts only + // once the lock is drawn, so nothing of the desktop is seen before the PIN. + // Without a PIN check the lock cannot be taken and the cover stays: closed, + // never open. + readonly property bool startLocked: Quickshell.env("OMARCHY_START_LOCKED") === "1" + property bool startLockTaken: false + property bool startupLifted: false property bool fingerprintConfigured: false property int fingerprintUnreachedStreak: 0 property bool fingerprintAttemptReachedDevice: false @@ -533,6 +542,16 @@ Item { onWakeRequested: root.runInputWake() } + // At session start: the lock is secure and its wallpaper drawn; a few + // frames on, the startup cover lifts onto it. + property int shownFrames: 0 + FrameAnimation { + running: root.startLocked && !root.startupLifted && sessionLock.secure && lockView.backgroundDrawn + onTriggered: { + lockSurface.shownFrames += 1 + if (lockSurface.shownFrames >= 3) root.liftStartup() + } + } } } @@ -879,6 +898,7 @@ Item { // the failsafe can be cleared from a TTY -- so re-ask rather than act on it. onPasswordPamConfiguredChanged: { if (!passwordPamConfigured) return + takeStartLock() strandedLock = false strandedLockResolved = false @@ -886,11 +906,35 @@ Item { checkStrandedLock() } + function takeStartLock() { + if (!startLocked || startLockTaken || !passwordPamConfigured) return + startLockTaken = beginLock() + if (startLockTaken) logEvent("start-locked") + } + + // The lock is on screen: lift Labwc's startup cover, and record for the + // installer that the PIN screen is on (omarchy-desktop-ready pin-screen). + function liftStartup() { + if (startupLifted) return + startupLifted = true + var file = Quickshell.env("LABWC_STARTUP_READY") || "" + if (file !== "") Quickshell.execDetached(["touch", file]) + pinScreenReadiness.running = true + logEvent("start-lock-shown") + } + + // A child of the shell, so the record names the shell's process. + Process { + id: pinScreenReadiness + command: ["/usr/libexec/omarchy-desktop-ready", "pin-screen"] + } + Component.onCompleted: { knownScreenCount = realScreenCount() refreshBackground() refreshFingerprintStatus() checkStrandedLock() + takeStartLock() } ShellIpc { diff --git a/docs/power-and-lock.md b/docs/power-and-lock.md index 33bedf91..17936ec3 100644 --- a/docs/power-and-lock.md +++ b/docs/power-and-lock.md @@ -29,9 +29,24 @@ orchard `docs/bring-up/suspend.md`); this model decides when. 9. Being plugged in lights the screen, as on any tablet, asleep or awake. Being unplugged wakes the kernel (orchard) but stays dark and sleeps again. +## Login: the session starts locked + +There is no login screen. At boot greetd starts the tablet's session without a +prompt (its `initial_session`), and the session starts locked: the shell takes +the lock as soon as its PIN check (`/etc/pam.d/omarchy-lock-password`) is +known, and Labwc's startup cover lifts only once the lock is drawn, so nothing +of the desktop is seen before the PIN. Without a PIN check the lock cannot be +taken and the cover stays. The lock's drawn first frame is also the installer's +"ready" (`/run/omarchy-session/ready.json`). + +Logout ends Labwc, and `arch-ipad-login-session` starts it again behind the +lock, in the same login session; so does a crash. A desktop that ends within +10 s three times in a row is not restarted: greetd's default session +(`omarchy-session-failed`) says so in the journal, and serial and SSH are there. + ## One owner -A system service, because it serves the greeter and the desktop alike, and +A system service, because it serves the session from its first frame on, and because system services thaw with the kernel while `user.slice` stays frozen a little longer. No user-space code runs before the kernel's device resume finishes, so that time is the floor for press to lit: a driver that blocks its @@ -60,7 +75,8 @@ measured as 3.36 s); the key timestamps can. It: brightness if nothing is remembered, never below 5%). `systemd-backlight` is disabled: it would save the dark 0 and start every later boot at its minimum; - asks the session's shell to lock (as the session's user: `omarchy-shell lock - lock`, then `status` until `secure`). The greeter has nothing to lock; + lock`, then `status` until `secure`). No session (or greetd's fallback) + has nothing to lock; - requests sleep through logind, and holds a logind delay inhibitor so that a suspend from anywhere else comes through here first (`PrepareForSleep`); - takes the session's inputs over `/run/omarchy-powerd.sock` (group `video`): @@ -196,7 +212,6 @@ instant, and sleep only follows 10 s after the last one left it dark. | Settle (lock requested → sleep) | 10 s | After Power immediately, or after the idle grace expires | | Desktop idle → dark | 5 min | the shell's `idle.lock` | | Lock screen idle → dark | 30 s | the lock's blank timer, sent as `idle` | -| Greeter idle → dark | 30 s | `IdleMonitor` in the greeter's `shell.qml` | | Playback check | 1 s, only while dark | `SETTLING` is longer, so it is seen first | | Suspend never began | 30 s awake | time the loop ran: a gap between two turns counts at most 1 s; once logind or the kernel began the sleep, only its end ends it (last resort: 120 s awake) | | Retry of a refused sleep | 60 s | `RETRY_SECONDS`; not when `CanSuspend` says the board cannot sleep | diff --git a/docs/upstream.md b/docs/upstream.md index 595caa86..dc8afcdb 100644 --- a/docs/upstream.md +++ b/docs/upstream.md @@ -9,7 +9,7 @@ means moving both pins together. ## What comes from upstream, and how - **At build time, unchanged:** `themes/` (Jade Horse is the tablet's first - theme and the greeter's fallback), `icons/` (the app icon sets) and + theme), `icons/` (the app icon sets) and `applications/foot.desktop`, taken from the pinned tarball by `desktop/install-tree`. Our own drawings in `desktop/icons/` join upstream's sets (Firefox, which they do not draw), and Omactivity takes upstream's Activity @@ -66,8 +66,10 @@ field for the on-screen keyboard, and no version under the selected app; the shell itself opens the launcher instead), the menu's bar logo (opens the launcher), the image picker (fits a phone's width), `Commons/Color.qml` (cyan, blue and yellow from the theme, `lock.scrim`), network rows (long press for Forget and Change passphrase), Bluetooth pairing feedback, the background (no Hyprland -boot cover or theme intro videos, software decode at panel size), the greeter's data-only theme -snapshot (`Commons/Color.qml`) and wallpaper readiness (`LockView.qml`), +boot cover or theme intro videos, software decode at panel size, no startup +signal of its own when the session starts locked), the lock (taken at session +start, lifting Labwc's startup cover; `plugins/lock/Service.qml`), wallpaper +readiness (`LockView.qml`), `Style.qml` (a larger bar target), `config/omarchy/shell.json` (the tablet's bar and the plugins it turns off). @@ -87,8 +89,7 @@ and window buttons (`labwc-*`, `render-labwc-*.py`), the on-screen keyboard (`bin/omarchy-keyboard`, `shell/plugins/keyboard/`), the bar's Overflow widget, the screen flash, the Home button and overview, rotation lock, auto-brightness, volume keys, the background picker process, Bluetooth pairing window, -`uwsm-app` (apps in their own systemd scope), KDE colours, greeter theme -publishing, fastfetch/starship/foot/fontconfig defaults, the pinned Tokyo Night +`uwsm-app` (apps in their own systemd scope), KDE colours, fastfetch/starship/foot/fontconfig defaults, the pinned Tokyo Night palette in `theme/` and our migrations. ## Moving the pin diff --git a/release/manifests.py b/release/manifests.py index 445ef077..c10d04e4 100644 --- a/release/manifests.py +++ b/release/manifests.py @@ -45,10 +45,10 @@ def write(output, version, root, offered, orchard, *, architecture='aarch64'): 'boot_method = ' + json.dumps(boot_method) + '\nmin_orchard = "0.2.0"\nprotocol = 1\n') document += table('orchard', orchard) # The tablet user gets the password and the lock-screen PIN at install. The - # installer waits over this boot's SSH for the greeter's ready record: the - # PIN screen is on. + # installer waits over this boot's SSH for the session's ready record: its + # lock, the PIN screen, is on. document += table('install', {'default_root': '/omarchy', - 'ready': '/run/omarchy-greeter/ready.json'}) + 'ready': '/run/omarchy-session/ready.json'}) document += table('install.account', {'user': 'tablet', 'password': True, 'pin': True, 'passwordless_sudo': False}) document += table('root', {key: value for key, value in root.items() if key != 'map'}) diff --git a/system/README.md b/system/README.md index 36e4f732..28965bf0 100644 --- a/system/README.md +++ b/system/README.md @@ -13,4 +13,4 @@ A file under `/etc` overrides orchard's default of the same name under `/usr/lib The installed system boots directly from its boot entry, which orchard's installer writes with orchard's kernel, initrd and the board's DTB; no recovery hands over to it, and the system needs no kernel-install or initrd generator. -The ready helper runs in the greeter's and the tablet's Wayland sessions once their shells are up. The greeter's record, `/run/omarchy-greeter/ready.json` (directory from tmpfiles.d), tells the installer the PIN screen is on; it holds the boot ID, the shell's process and its socket. +The ready helper runs in the tablet's Wayland session: once its shell is up, and once the lock it starts with is on screen. The latter record, `/run/omarchy-session/ready.json` (directory from tmpfiles.d), tells the installer the PIN screen is on; it holds the boot ID, the shell's process and its socket. diff --git a/system/overlay/etc/pam.d/greetd-autologin b/system/overlay/etc/pam.d/greetd-autologin new file mode 100644 index 00000000..0bc7de65 --- /dev/null +++ b/system/overlay/etc/pam.d/greetd-autologin @@ -0,0 +1,9 @@ +#%PAM-1.0 +# greetd's sessions (/etc/greetd/config.toml names this service): the tablet's +# session at boot, without a prompt. It starts locked; the PIN is the lock's +# (/etc/pam.d/omarchy-lock-password, written by the installer). No other user +# gets a session through greetd this way. +auth required pam_succeed_if.so quiet user = tablet +auth required pam_permit.so +account include system-local-login +session include system-local-login diff --git a/system/overlay/etc/pam.d/greetd-greeter b/system/overlay/etc/pam.d/greetd-greeter index 99600c51..25a78fe9 100644 --- a/system/overlay/etc/pam.d/greetd-greeter +++ b/system/overlay/etc/pam.d/greetd-greeter @@ -1,6 +1,7 @@ #%PAM-1.0 -# The greeter itself (user greeter) needs no password; the PIN is checked in -# /etc/pam.d/greetd, which the installer writes. +# greetd's default session (user greeter, omarchy-session-failed) needs no +# password. The tablet's session starts without a prompt through +# /etc/pam.d/greetd, which the installer writes; its PIN is the lock's. auth required pam_permit.so account include system-local-login session include system-local-login diff --git a/system/overlay/usr/lib/omarchy-a/package-install b/system/overlay/usr/lib/omarchy-a/package-install index bfbbb48d..4df13ca0 100755 --- a/system/overlay/usr/lib/omarchy-a/package-install +++ b/system/overlay/usr/lib/omarchy-a/package-install @@ -32,7 +32,9 @@ post_install() { } post_upgrade() { - : + # The login screen is gone (the session starts locked): its copies of the + # theme, which the tablet user published for it, have no reader any more. + rm -rf -- /var/lib/omarchy-greeter-theme } case "${1:-}" in diff --git a/system/overlay/usr/lib/tmpfiles.d/omarchy-greeter.conf b/system/overlay/usr/lib/tmpfiles.d/omarchy-greeter.conf deleted file mode 100644 index 57a533c2..00000000 --- a/system/overlay/usr/lib/tmpfiles.d/omarchy-greeter.conf +++ /dev/null @@ -1,2 +0,0 @@ -# The greeter records here that the PIN screen is on; the installer waits for it. -d /run/omarchy-greeter 0755 greeter greeter - diff --git a/system/overlay/usr/lib/tmpfiles.d/omarchy-handover.conf b/system/overlay/usr/lib/tmpfiles.d/omarchy-handover.conf index da908d74..a2dc28e2 100644 --- a/system/overlay/usr/lib/tmpfiles.d/omarchy-handover.conf +++ b/system/overlay/usr/lib/tmpfiles.d/omarchy-handover.conf @@ -1,6 +1,6 @@ # Session transitions (the Orchard repository's labwc: 0003-session-transitions.patch in OrchardLinux/packages). -# The greeter's and the desktop's Labwc hand their last picture to each other -# here: both users are in video, nobody else can read it, and it is on tmpfs. +# One Labwc hands its last picture to the next here (a logout, a restart of the +# desktop): the video group only, on tmpfs. d /run/omarchy-handover 2770 root video - # The picture on the panel must survive the moment between the two compositors: # without this the kernel restores its own, blank console picture there. The diff --git a/system/overlay/usr/lib/tmpfiles.d/omarchy-session.conf b/system/overlay/usr/lib/tmpfiles.d/omarchy-session.conf new file mode 100644 index 00000000..5d06b736 --- /dev/null +++ b/system/overlay/usr/lib/tmpfiles.d/omarchy-session.conf @@ -0,0 +1,3 @@ +# The tablet session records here that its lock, the PIN screen, is on; the +# installer waits for it. +d /run/omarchy-session 0755 tablet tablet - diff --git a/system/overlay/usr/libexec/omarchy-desktop-ready b/system/overlay/usr/libexec/omarchy-desktop-ready index 445128b7..9885ad3b 100755 --- a/system/overlay/usr/libexec/omarchy-desktop-ready +++ b/system/overlay/usr/libexec/omarchy-desktop-ready @@ -1,28 +1,29 @@ #!/usr/bin/python3 -"""Called by the greeter's and the tablet session's shells once they are up: record readiness. +"""Called by the tablet session's shell: record readiness. -The greeter's record (/run/omarchy-greeter/ready.json) is what the installer -waits for: the PIN screen is on. The tablet session keeps its own record in -its runtime directory. +Without an argument, once the shell is up: the desktop's own record in the +session's runtime directory. With `pin-screen`, once the lock the session +starts with is on screen: /run/omarchy-session/ready.json, which the installer +waits for (the release manifest names it). """ import json import os from pathlib import Path import pwd +import sys -user = pwd.getpwuid(os.getuid()).pw_name -if user == 'greeter': - target = Path('/run/omarchy-greeter') -elif user == 'tablet': - target = Path(os.environ['XDG_RUNTIME_DIR']) -else: - raise SystemExit('Readiness comes from the greeter or the tablet session') +if pwd.getpwuid(os.getuid()).pw_name != 'tablet': + raise SystemExit('Readiness comes from the tablet session') +pin_screen = sys.argv[1:] == ['pin-screen'] +if sys.argv[1:] and not pin_screen: + raise SystemExit('Usage: omarchy-desktop-ready [pin-screen]') +target = Path('/run/omarchy-session') if pin_screen else Path(os.environ['XDG_RUNTIME_DIR']) socket = Path(os.environ['XDG_RUNTIME_DIR']) / os.environ['WAYLAND_DISPLAY'] if not socket.is_socket() or target.stat().st_uid != os.getuid(): raise SystemExit('No owned Wayland session') record = {'boot_id': Path('/proc/sys/kernel/random/boot_id').read_text().strip(), 'shell_pid': os.getppid(), 'wayland_socket': str(socket)} -name = 'ready.json' if user == 'greeter' else 'omarchy-desktop-ready.json' +name = 'ready.json' if pin_screen else 'omarchy-desktop-ready.json' temporary = target / (name + '.pending') temporary.write_text(json.dumps(record)) temporary.chmod(0o644) diff --git a/system/overlay/usr/libexec/omarchy-powerd b/system/overlay/usr/libexec/omarchy-powerd index c5146091..8eb961e3 100755 --- a/system/overlay/usr/libexec/omarchy-powerd +++ b/system/overlay/usr/libexec/omarchy-powerd @@ -1015,7 +1015,7 @@ class Daemon: Path(SOCKET).unlink(missing_ok=True) server = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) server.bind(SOCKET) - os.chown(SOCKET, 0, grp.getgrnam('video').gr_gid) # the tablet user and the greeter + os.chown(SOCKET, 0, grp.getgrnam('video').gr_gid) # the tablet user's session os.chmod(SOCKET, 0o660) server.listen(8) return server diff --git a/tests/test_greeter_theme_publish.py b/tests/test_greeter_theme_publish.py deleted file mode 100644 index 34052970..00000000 --- a/tests/test_greeter_theme_publish.py +++ /dev/null @@ -1,91 +0,0 @@ -import importlib.machinery -import importlib.util -from pathlib import Path -import tempfile -import unittest -from unittest.mock import patch - -SCRIPT = Path(__file__).resolve().parents[1] / 'desktop/shell/bin/omarchy-greeter-theme-publish' -loader = importlib.machinery.SourceFileLoader('greeter_theme_publish', str(SCRIPT)) -spec = importlib.util.spec_from_loader(loader.name, loader) -publisher = importlib.util.module_from_spec(spec) -loader.exec_module(publisher) - - -class GreeterThemeTests(unittest.TestCase): - def setUp(self): - self.temp = tempfile.TemporaryDirectory() - self.addCleanup(self.temp.cleanup) - self.root = Path(self.temp.name) - self.home = self.root / 'home' - self.state = self.home / '.local/state/omarchy/current' - self.dest = self.root / 'published' - self.dest.mkdir() - (self.state / 'theme').mkdir(parents=True) - (self.state / 'theme/colors.toml').write_text('foreground = "#ffffff"\n') - (self.state / 'theme/shell.toml').write_text('[lock]\nbackground = "#123456"\n') - self.image = self.home / 'wallpaper.png' - self.image.write_bytes(b'image data') - (self.state / 'background').symlink_to(self.image) - self.fallback = self.root / 'fallback' - self.fallback.write_bytes(b'fallback image') - for name, value in [('DEST', self.dest), ('STATE', self.state), ('FALLBACK', self.fallback)]: - p = patch.object(publisher, name, value) - p.start() - self.addCleanup(p.stop) - p = patch.object(Path, 'home', return_value=self.home) - p.start() - self.addCleanup(p.stop) - - def test_publishes_theme_and_selected_image_atomically(self): - publisher.publish() - first = (self.dest / 'current').resolve() - self.assertEqual((first / 'background').read_bytes(), b'image data') - self.assertIn('#ffffff', (first / 'colors.toml').read_text()) - self.assertIn('#123456', (first / 'shell.toml').read_text()) - self.assertEqual((first / 'background').stat().st_mode & 0o777, 0o644) - (self.state / 'theme/colors.toml').write_text('foreground = "#000000"\n') - publisher.publish() - second = (self.dest / 'current').resolve() - self.assertNotEqual(first, second) - self.assertIn('#ffffff', (first / 'colors.toml').read_text()) - self.assertIn('#000000', (second / 'colors.toml').read_text()) - - def test_failure_keeps_previous_snapshot(self): - publisher.publish() - previous = (self.dest / 'current').resolve() - (self.state / 'theme/colors.toml').write_bytes(b'x' * (publisher.MAX_CONFIG + 1)) - with self.assertRaises(ValueError): - publisher.publish() - self.assertEqual((self.dest / 'current').resolve(), previous) - self.assertTrue((previous / 'background').exists()) - - def test_unknown_background_uses_fallback(self): - other = self.home / 'unsupported.bin' - other.write_bytes(b'not an image') - (self.state / 'background').unlink() - (self.state / 'background').symlink_to(other) - publisher.publish() - self.assertEqual((self.dest / 'current/background').read_bytes(), b'fallback image') - - def test_video_poster_failure_publishes_fallback_and_new_theme(self): - video = self.home / 'video.mp4' - video.write_bytes(b'video') - (self.state / 'background').unlink() - (self.state / 'background').symlink_to(video) - with patch.object(publisher.shutil, 'which', return_value='/usr/bin/ffmpegthumbnailer'), \ - patch.object(publisher.subprocess, 'run', side_effect=publisher.subprocess.TimeoutExpired('thumbnail', 8)): - publisher.publish() - self.assertEqual((self.dest / 'current/background').read_bytes(), b'fallback image') - self.assertIn('#ffffff', (self.dest / 'current/colors.toml').read_text()) - - def test_user_override_is_in_snapshot(self): - path = self.home / '.config/omarchy/shell.toml' - path.parent.mkdir(parents=True) - path.write_text('[font]\nbase-size = 16\n') - publisher.publish() - self.assertEqual((self.dest / 'current/user-shell.toml').read_text(), path.read_text()) - - -if __name__ == '__main__': - unittest.main() diff --git a/tests/test_keyboard_shortcuts.py b/tests/test_keyboard_shortcuts.py index 5b20c2f3..62ad3f54 100644 --- a/tests/test_keyboard_shortcuts.py +++ b/tests/test_keyboard_shortcuts.py @@ -79,8 +79,6 @@ def test_overview_triggers(self): self.assertLess(home.index('lock status'), home.index('omarchy-overview-open')) self.assertIn('omarchy-overview-open"', changed) self.assertIn('omarchy-overview-open', (PROJECT / 'desktop/shell/default/labwc/autostart').read_text()) - # The greeter has nothing to switch between. - self.assertNotIn('overview', (PROJECT / 'desktop/greeter/labwc/rc.xml').read_text()) def test_super_tap_release_bindings_are_unchanged(self): for key in ('Super_L', 'Super_R'): diff --git a/tests/test_manifests_and_recovery.py b/tests/test_manifests_and_recovery.py index 00765aa6..34ce945d 100644 --- a/tests/test_manifests_and_recovery.py +++ b/tests/test_manifests_and_recovery.py @@ -51,7 +51,7 @@ def test_one_manifest_for_every_platform_and_an_index_pinning_its_bytes(self): self.assertNotIn('boards', doc['platforms']['apple-4k']['layer']) self.assertNotIn('boot', doc['platforms']['apple-4k']) self.assertEqual(doc['orchard'], ORCHARD) - self.assertEqual(doc['install'], {'default_root': '/omarchy', 'ready': '/run/omarchy-greeter/ready.json', 'account': { + self.assertEqual(doc['install'], {'default_root': '/omarchy', 'ready': '/run/omarchy-session/ready.json', 'account': { 'user': 'tablet', 'password': True, 'pin': True, 'passwordless_sudo': False}}) self.assertEqual(doc['root']['sha256'], hashlib.sha256(b'root.blocks.zst').hexdigest()) self.assertEqual(doc['min_orchard'], '0.2.0') diff --git a/tests/test_menu_shutdown.py b/tests/test_menu_shutdown.py index 1713b7a2..916abe59 100644 --- a/tests/test_menu_shutdown.py +++ b/tests/test_menu_shutdown.py @@ -74,8 +74,8 @@ def test_commands_are_shipped(self): self.assertTrue(os.access(BIN / name, os.X_OK), name) def test_logout_shows_osd_closes_windows_then_ends_the_compositor(self): - # login-session execs labwc, so its exit ends the session and greetd - # brings the greeter back. Upstream's uwsm stop has no session here. + # login-session starts labwc again when it exits, behind the lock. + # Upstream's uwsm stop has no session here. result, calls = self.run_action(menu_action('logout')) self.assertEqual(result.returncode, 0, result.stderr) self.assertIn('--setenv=LABWC_PID', calls[0]) diff --git a/tests/test_menu_toggles.py b/tests/test_menu_toggles.py index 5edfd62a..88ec799e 100644 --- a/tests/test_menu_toggles.py +++ b/tests/test_menu_toggles.py @@ -77,14 +77,17 @@ def test_the_on_flag_from_before_the_default_goes(self): def test_login_writes_the_maximize_rule_before_labwc_starts(self): session = (PROJECT / 'desktop/configuration/login-session').read_text() - self.assertLess(session.index('omarchy-toggle-maximize-windows --apply'), session.index('exec /usr/bin/labwc -m')) + self.assertLess(session.index('omarchy-toggle-maximize-windows --apply'), session.index('/usr/bin/labwc -m')) def test_session_merges_the_toggle_config_into_labwc(self): # Releases replace ~/.config/labwc/rc.xml, so toggle rules must come from the # state directory via labwc's XDG merge, never from edits to rc.xml. session = (PROJECT / 'desktop/configuration/login-session').read_text() self.assertIn('export XDG_CONFIG_DIRS="$HOME/.local/state/omarchy/xdg-config:', session) - self.assertEqual(session.rstrip().splitlines()[-1], 'exec /usr/bin/labwc -m') + # Labwc is the last thing the login starts, again after each logout. + loop = session[session.index('\nwhile :; do\n'):] + self.assertIn(' /usr/bin/labwc -m || true\n', loop) + self.assertEqual(session.rstrip().splitlines()[-1], 'done') toggle = (BIN / 'omarchy-toggle-maximize-windows').read_text() self.assertIn('$HOME/.local/state/omarchy/xdg-config/labwc/rc.xml', toggle) code = [line for line in toggle.splitlines() if not line.lstrip().startswith('#')] diff --git a/tests/test_migrations.py b/tests/test_migrations.py index f7211967..bd49598e 100644 --- a/tests/test_migrations.py +++ b/tests/test_migrations.py @@ -60,7 +60,7 @@ def test_the_login_runs_them_before_the_desktop_starts(self): session = (PROJECT / 'desktop/configuration/login-session').read_text() self.assertIn('OMARCHY_MIGRATE_LOCK_WAIT=0 timeout 120 omarchy-migrate', session) self.assertLess(session.index('omarchy-migrate'), session.index('arch-ipad-first-theme')) - self.assertLess(session.index('omarchy-migrate'), session.index('exec /usr/bin/labwc')) + self.assertLess(session.index('omarchy-migrate'), session.index('/usr/bin/labwc -m')) class Shipped(unittest.TestCase): diff --git a/tests/test_greeter_staging.py b/tests/test_package_staging.py similarity index 80% rename from tests/test_greeter_staging.py rename to tests/test_package_staging.py index 3d9e9198..1b374390 100644 --- a/tests/test_greeter_staging.py +++ b/tests/test_package_staging.py @@ -1,4 +1,4 @@ -"""The package's layout (desktop/install-tree): the greeter, the Omarchy tree, the user's defaults.""" +"""The package's layout (desktop/install-tree): the login, the Omarchy tree, the user's defaults.""" import os from pathlib import Path import shutil @@ -12,7 +12,7 @@ @unittest.skipUnless(shutil.which('bash'), 'bash runs desktop/install-tree') -class GreeterStagingTests(unittest.TestCase): +class PackageStagingTests(unittest.TestCase): def test_modes_whatever_the_umask(self): target = tree() skel = target / 'etc/skel' @@ -31,7 +31,7 @@ def test_trusted_ui_fallback_theme_and_tmpfiles_are_staged(self): # greetd owns its config: the package's goes there through its etc-overrides. overrides = omarchy / 'etc-overrides' self.assertFalse((target / 'etc/greetd').exists()) - self.assertEqual((overrides / 'etc/greetd/config.toml').read_bytes(), (HERE / 'greeter/greetd.toml').read_bytes()) + self.assertEqual((overrides / 'etc/greetd/config.toml').read_bytes(), (HERE / 'login/greetd.toml').read_bytes()) self.assertEqual((overrides / 'etc/skel/.bashrc').read_bytes(), (HERE / 'configuration/bashrc').read_bytes()) self.assertEqual(mode(target / 'usr/libexec/arch-ipad-login-session'), 0o755) menu = (omarchy / 'default/omarchy/omarchy-menu.jsonc').read_text() @@ -45,16 +45,11 @@ def test_trusted_ui_fallback_theme_and_tmpfiles_are_staged(self): 'omarchy-migrate', 'omarchy-launch-floating-terminal-with-presentation'): self.assertEqual(os.readlink(target / 'usr/bin' / command), '/usr/share/omarchy/bin/' + command) self.assertTrue(mode(omarchy / 'bin' / command) & 0o111, command) - greeter = target / 'usr/share/omarchy-greeter' - self.assertEqual((greeter / 'plugins/lock/LockView.qml').read_bytes(), - (HERE / 'shell/shell/plugins/lock/LockView.qml').read_bytes()) - self.assertTrue((greeter / 'Commons/Color.qml').is_file()) - # Upstream's Jade Horse is the default theme and the greeter's fallback. + # No login screen of its own: the session's lock is the PIN screen. + self.assertFalse((target / 'usr/share/omarchy-greeter').exists()) + # Upstream's Jade Horse is the default theme. themes = omarchy / 'themes' - jade = themes / 'jade-horse' - self.assertEqual((greeter / 'default-theme/background').read_bytes(), - (jade / 'backgrounds/01-mountain-horses.webp').read_bytes()) - self.assertEqual((greeter / 'default-theme/colors.toml').read_bytes(), (jade / 'colors.toml').read_bytes()) + self.assertTrue((themes / 'jade-horse/colors.toml').is_file()) self.assertTrue((themes / 'tokyo-night/colors.toml').is_file()) # Upstream's app icon sets, drawn in the theme's colors at login and on every switch. self.assertTrue((omarchy / 'icons/papercraft/folio.svg.tpl').is_file()) @@ -66,13 +61,19 @@ def test_trusted_ui_fallback_theme_and_tmpfiles_are_staged(self): first_theme = (target / 'usr/libexec/arch-ipad-first-theme').read_text() self.assertIn('themes/jade-horse', first_theme) self.assertIn("'jade-horse' >", first_theme) - self.assertIn('tablet tablet', (target / 'usr/lib/tmpfiles.d/omarchy-greeter-theme.conf').read_text()) - self.assertTrue((omarchy / 'bin/omarchy-greeter-theme-publish').is_file()) - # Boot login is the PIN greeter on VT1, not a tty1 autologin. + self.assertFalse((omarchy / 'bin/omarchy-greeter-theme-publish').exists()) + # Boot logs the tablet in through greetd on VT1, without a prompt and + # once (its initial session), not a tty1 autologin; the session starts + # locked. greetd's default session only says the session is not running. greetd = (overrides / 'etc/greetd/config.toml').read_text() self.assertIn('vt = 1', greetd) - self.assertIn('command = "/usr/libexec/omarchy-greeter-session"', greetd) - self.assertTrue(mode(target / 'usr/libexec/omarchy-greeter-session') & 0o111) + initial = greetd[greetd.index('[initial_session]'):greetd.index('[default_session]')] + self.assertIn('command = "/usr/libexec/arch-ipad-login-session"', initial) + self.assertIn('user = "tablet"', initial) + self.assertIn('command = "/usr/libexec/omarchy-session-failed"', greetd[greetd.index('[default_session]'):]) + self.assertTrue(mode(target / 'usr/libexec/omarchy-session-failed') & 0o111) + session = (target / 'usr/libexec/arch-ipad-login-session').read_text() + self.assertIn('export OMARCHY_START_LOCKED=1', session) self.assertTrue((target / 'etc/systemd/system/greetd.service.d/seatd.conf').is_file()) self.assertFalse((target / 'etc/systemd/system/getty@tty1.service.d').exists()) self.assertFalse((skel / '.bash_profile').exists()) diff --git a/tests/test_powerd.py b/tests/test_powerd.py index ab148f0b..f76840a7 100644 --- a/tests/test_powerd.py +++ b/tests/test_powerd.py @@ -502,9 +502,6 @@ def test_labwc_leaves_power_to_the_daemon_and_keeps_volume_on_the_lock_screen(se self.assertIsNone(home.get('allowWhenLocked')) for key in ('XF86AudioRaiseVolume', 'XF86AudioLowerVolume', 'XF86AudioMute'): self.assertEqual(tree.find(f"./keyboard/keybind[@key='{key}']").get('allowWhenLocked'), 'yes') - greeter = ET.fromstring((PROJECT / 'desktop/greeter/labwc/rc.xml').read_bytes()) - for key in ('XF86PowerOff', 'XF86HomePage'): - self.assertEqual(greeter.findall(f"./keyboard/keybind[@key='{key}']"), []) def test_a_held_key_on_the_lock_screen_wakes_once(self): view = (PROJECT / 'desktop/shell/shell/plugins/lock/LockView.qml').read_text() @@ -519,12 +516,9 @@ def test_every_way_to_dark_uses_the_same_client_and_the_decided_times(self): client = '/usr/libexec/omarchy-powerctl' lock = (PROJECT / 'desktop/shell/shell/plugins/lock/Service.qml').read_text() idle = (PROJECT / 'desktop/shell/shell/plugins/services/idle/Service.qml').read_text() - greeter = (PROJECT / 'desktop/greeter/shell.qml').read_text() self.assertIn(f'{client} idle', lock) self.assertIn(f'{client} idle', idle) - self.assertIn(f'["{client}", "idle"]', greeter) self.assertIn('"1" ? 30000 : 5000', lock) - self.assertRegex(greeter, r'IdleMonitor \{[^}]*timeout: 30\b') self.assertEqual(powerd.SETTLE_SECONDS, 10.0) def test_the_daemon_is_enabled_and_executable(self):