From 8f2bf9b7dbecd91fcc51550984bebdb3ab07fab4 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Wed, 11 Nov 2026 10:49:26 -0500 Subject: [PATCH 1/2] omamobile-shell 0.2.124, omamobile-omarchy 0.1.43, omamobile-firstboot 0.1.4: what Omarchy 4.5 renamed or dropped under us An audit of our packages against the real Omarchy 4.0.6 and 4.5.0-3 packages found places where we call something 4.5 no longer has. Each fix works on both versions, since phones stay on 4.0.6 until the pin moves. Restart buttons (shell): the update sheet and the mobile network page ran omarchy-system-reboot, which 4.5 replaced with "omarchy-system reboot", so both buttons would have done nothing. They now run omamobile-reboot, which uses whichever the installed Omarchy has, and systemd's reboot with neither. omamobile-update's terminal hint says "omarchy reboot", an alias both versions have. Name and email in onboarding (shell): it ran install/user/git.sh, which 4.5 removed, printed "Saved." and set nothing. It now hands both to 4.5's omarchy-setup-git, or without that command sets git itself and runs Omarchy's Compose script as before, and says so when the save failed. Name and email at first boot (firstboot): 4.5's user setup no longer writes git's identity from the installer's answers. Firstboot writes it itself after Omarchy's setup, under either version. The update's restart step (omarchy): 4.5 runs it twice, --services-only and --reboot-only. The phone's stand-in ignored the argument and did everything twice, restarting the shell twice. Each call now does its half, and a service that failed to restart in the first is still in the second's warnings. 4.5's new boot verification gets the stand-in patch 0012's header already named: a phone has no UKI or initramfs for it to check, and slot B's images are checked by omamobile-boot-update. Tested with stand-ins only, on the laptop: omamobile-omarchy's suite on omarchy 4.5.0-3 (219 checks) and 4.0.6-1 (269), omamobile-shell's (319) and omamobile-firstboot's (13). Not run on a phone. Co-Authored-By: Claude Fable 5.2 --- .../bin/omamobile-firstboot | 11 ++++ packages/omamobile-firstboot/test/all | 9 +++ packages/omamobile-firstboot/version | 2 +- .../omamobile-omarchy/bin/omamobile-update | 9 ++- .../lib/update-bin/omarchy-update-boot | 15 +++++ .../lib/update-bin/omarchy-update-restart | 55 ++++++++++++++----- packages/omamobile-omarchy/test/all | 2 +- packages/omamobile-omarchy/test/update.sh | 32 ++++++++++- packages/omamobile-omarchy/version | 2 +- .../omamobile-shell/bin/omamobile-onboarding | 31 +++++++++-- packages/omamobile-shell/bin/omamobile-reboot | 34 ++++++++++++ packages/omamobile-shell/plugins/README.md | 3 +- .../MobileNetworkModel.js | 2 +- .../plugins/omamobile.update/UpdateModel.js | 2 +- packages/omamobile-shell/test/all | 2 + .../test/onboarding-identity.sh | 54 ++++++++++++++++++ .../omamobile-shell/test/reboot-command.sh | 42 ++++++++++++++ packages/omamobile-shell/test/update-model.js | 2 +- packages/omamobile-shell/version | 2 +- 19 files changed, 281 insertions(+), 30 deletions(-) create mode 100755 packages/omamobile-omarchy/lib/update-bin/omarchy-update-boot create mode 100755 packages/omamobile-shell/bin/omamobile-reboot create mode 100644 packages/omamobile-shell/test/onboarding-identity.sh create mode 100755 packages/omamobile-shell/test/reboot-command.sh diff --git a/packages/omamobile-firstboot/bin/omamobile-firstboot b/packages/omamobile-firstboot/bin/omamobile-firstboot index 39f4ea018..5d44a0d02 100755 --- a/packages/omamobile-firstboot/bin/omamobile-firstboot +++ b/packages/omamobile-firstboot/bin/omamobile-firstboot @@ -441,6 +441,17 @@ s_user_setup() { uid=$(id -u "$U") home=$ROOT$(home_of "$U") systemctl start "user@$uid.service" || echo " no user manager; continuing without it" as_user omarchy-provision-user --force --first-install || { echo " omarchy-provision-user failed"; failed=1; } + # git's name and email. Omarchy 4.0's user setup wrote them from the two + # variables as_user passes; Omarchy 4.5's writes only the Compose shortcuts + # (its git setup is a command the owner runs). Written here, so the + # installer's answers reach git under either; a blank one stays unset, and + # a failure is said but doesn't fail the first boot. + if [[ -n ${C[FULL_NAME]//[[:space:]]/} ]]; then + as_user git config --global user.name "${C[FULL_NAME]}" || echo " git's user.name could not be set" + fi + if [[ -n ${C[EMAIL]//[[:space:]]/} ]]; then + as_user git config --global user.email "${C[EMAIL]}" || echo " git's user.email could not be set" + fi if command -v omamobile-setup-user >/dev/null; then as_user omamobile-setup-user || { echo " omamobile-setup-user failed"; failed=1; } fi diff --git a/packages/omamobile-firstboot/test/all b/packages/omamobile-firstboot/test/all index 403030cf7..38bfc85cf 100755 --- a/packages/omamobile-firstboot/test/all +++ b/packages/omamobile-firstboot/test/all @@ -182,6 +182,8 @@ grep -qx pin "$R/home/alice/.config/omamobile/credential" || fail "the credentia [[ -e $R/home/alice/.local/state/omarchy/toggles/lock-on-start ]] || fail "the phone locks after boot" grep -qF "$PSK" "$R/var/log/omamobile/firstboot.log" "$t/run.out" && fail "the log never has the passphrase" grep -qF "$HASH" "$R/var/log/omamobile/firstboot.log" "$t/run.out" && fail "the log never has the hash" +grep -c ' git config --global user.name Alice Example$' "$CALLS" >/dev/null || fail "git gets the owner's name, whatever Omarchy's user setup does" +grep -c ' git config --global user.email alice@example.org$' "$CALLS" >/dev/null || fail "git gets the owner's email" pass "a run sets everything up and deletes the conf" [[ -e $R/ran-other-leaf ]] || fail "Omarchy's setup leaves run" @@ -200,6 +202,13 @@ grep -q '^usermod -aG wheel,audio,video,input' "$CALLS" || fail "a second run up [[ $(grep -cxF "$KEY" "$R/home/alice/.ssh/authorized_keys") == 1 ]] || fail "a second run doesn't duplicate the key" pass "running again is safe" +# The name and email are optional: without them git is left alone +: > "$CALLS" +good | sed '/^WIFI_/d; /^FULL_NAME=/d; /^EMAIL=/d' > "$R/etc/omamobile/firstboot.conf" +run || { cat "$t/run.out"; fail "a run without a name and email succeeds"; } +grep -c ' git config ' "$CALLS" >/dev/null && fail "without a name and email git's config is not written" +pass "the installer's name and email reach git; without them git is left alone" + : > "$CALLS" rm "$R/usr/share/pacman/keyrings/"*.gpg export TEST_NOW=1 diff --git a/packages/omamobile-firstboot/version b/packages/omamobile-firstboot/version index b1e80bb24..845639eef 100644 --- a/packages/omamobile-firstboot/version +++ b/packages/omamobile-firstboot/version @@ -1 +1 @@ -0.1.3 +0.1.4 diff --git a/packages/omamobile-omarchy/bin/omamobile-update b/packages/omamobile-omarchy/bin/omamobile-update index a8eb00978..7df208655 100755 --- a/packages/omamobile-omarchy/bin/omamobile-update +++ b/packages/omamobile-omarchy/bin/omamobile-update @@ -33,7 +33,12 @@ directory of stand-ins first on PATH (/usr/lib/omamobile-omarchy/update-bin): root), omarchy-update-aur-pkgs (no AUR builds on the phone), omarchy-update-orphan-pkgs (listed, never removed), omarchy-update-restart (no gum, no false "kernel updated": - a restart is asked for when omamobile-boot-update wrote slot B), + a restart is asked for when omamobile-boot-update wrote slot B; + Omarchy 4.5 runs it as two halves, --services-only then + --reboot-only, and each does only its half), + omarchy-update-boot (4.5's boot verification is for a + computer's boot files; slot B's images are checked by + omamobile-boot-update), omarchy-migrate (boot-related migrations held), sudo (non-interactive from the sheet) @@ -720,7 +725,7 @@ def run(args): print() print("omamobile-update: %s" % result["message"]) if result["needs_reboot"]: - print("Restart the phone to finish (%s): omarchy-system-reboot" % "; ".join(result["reasons"])) + print("Restart the phone to finish (%s): omarchy reboot" % "; ".join(result["reasons"])) for h in result["held"]: print("Held migration %s (%s): omamobile-update run-migration %s" % (h[0], h[1], h[0])) return code diff --git a/packages/omamobile-omarchy/lib/update-bin/omarchy-update-boot b/packages/omamobile-omarchy/lib/update-bin/omarchy-update-boot new file mode 100755 index 000000000..92d0dc9e8 --- /dev/null +++ b/packages/omamobile-omarchy/lib/update-bin/omarchy-update-boot @@ -0,0 +1,15 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Omarchy Mobile (on PATH only during omamobile-update): Omarchy 4.5's boot +# verification, which asks the platform's boot package whether the files the +# update left will boot (a UKI, limine, an initramfs on a computer). A phone +# has none of those: its boot images are slot B's, written and read back by +# linux-omamobile's hook (omamobile-boot-update), and a write that was +# refused or failed is reported by the restart step that follows, as a +# warning with the command that finishes it. So there is nothing to verify +# here, and nothing here may fail the update or ask for sudo. +if (( $# )); then + echo "Usage: omarchy-update-boot" >&2 + exit 2 +fi +exit 0 diff --git a/packages/omamobile-omarchy/lib/update-bin/omarchy-update-restart b/packages/omamobile-omarchy/lib/update-bin/omarchy-update-restart index f892c403f..4f6e55401 100755 --- a/packages/omamobile-omarchy/lib/update-bin/omarchy-update-restart +++ b/packages/omamobile-omarchy/lib/update-bin/omarchy-update-restart @@ -9,8 +9,42 @@ # wrote slot B during this update; a kernel package it could not write is a # warning. Services Omarchy marked are restarted and the shell too, as on a # desktop. Nothing reboots here: the update sheet offers the restart. -out=${OMAMOBILE_UPDATE_DIR:-${XDG_RUNTIME_DIR:-/tmp}/omamobile-update}/restart.json +# +# Omarchy 4.5 runs this step twice: --services-only after the migrations +# (the marked services and the shell), then --reboot-only at the very end +# (whether a restart is needed). Each does its half here too, so services +# and the shell restart once; a service that failed to restart in the first +# half is kept for the second's warnings. Without an argument (Omarchy 4.0) +# it does both, as before. +dir=${OMAMOBILE_UPDATE_DIR:-${XDG_RUNTIME_DIR:-/tmp}/omamobile-update} +out=$dir/restart.json +kept=$dir/restart-warnings reasons=() warnings=() +services=1 verdict=1 +case ${1:-} in + --services-only) verdict=0 ;; + --reboot-only) services=0 ;; + "") ;; + *) echo "omarchy-update-restart (phone): unknown option $1" >&2; exit 2 ;; +esac + +if (( services )); then + mkdir -p "$dir" + : > "$kept" + for file in "$HOME"/.local/state/omarchy/restart-*-required; do + [[ -f $file ]] || continue + name=${file##*/} + service=${name#restart-} + service=${service%-required} + echo "Restarting $service" + omarchy-state clear "$name" || rm -f "$file" + "omarchy-restart-$service" || echo "Restarting $service failed" >> "$kept" + done + + echo -e "\e[32m\nRestarting shell\e[0m" + omarchy-restart-shell || true +fi +(( verdict )) || exit 0 modules=${OMAMOBILE_MODULES_DIR:-/usr/lib/modules}/$(uname -r) [[ -d $modules ]] || warnings+=("No modules for the running kernel in $modules") @@ -53,20 +87,13 @@ if [[ -n $pid ]] && [[ $(readlink "/proc/$pid/exe" 2>/dev/null) == *"(deleted)"* reasons+=("Hyprland was updated") fi -for file in "$HOME"/.local/state/omarchy/restart-*-required; do - [[ -f $file ]] || continue - name=${file##*/} - service=${name#restart-} - service=${service%-required} - echo "Restarting $service" - omarchy-state clear "$name" || rm -f "$file" - "omarchy-restart-$service" || warnings+=("Restarting $service failed") -done - -echo -e "\e[32m\nRestarting shell\e[0m" -omarchy-restart-shell || true +if [[ -s $kept ]]; then + mapfile -t failed < "$kept" + warnings+=("${failed[@]}") +fi +rm -f "$kept" -mkdir -p "${out%/*}" +mkdir -p "$dir" python3 -I - "$out" "${#reasons[@]}" "${reasons[@]}" "${warnings[@]}" <<'PY' import json, sys out, n = sys.argv[1], int(sys.argv[2]) diff --git a/packages/omamobile-omarchy/test/all b/packages/omamobile-omarchy/test/all index 74173a3e6..35a33d808 100755 --- a/packages/omamobile-omarchy/test/all +++ b/packages/omamobile-omarchy/test/all @@ -26,7 +26,7 @@ for f in usr/bin/omamobile-omarchy-patches usr/bin/omamobile-update usr/lib/omam [[ -e $t/stage/$f ]] || fail "not staged: $f" done for f in omarchy-snapshot omarchy-update-aur-pkgs omarchy-update-orphan-pkgs omarchy-update-confirm \ - omarchy-update-firmware omarchy-update-restart omarchy-migrate sudo; do + omarchy-update-firmware omarchy-update-restart omarchy-update-boot omarchy-migrate sudo; do [[ -x $t/stage/usr/lib/omamobile-omarchy/update-bin/$f ]] || fail "stand-in not staged: $f" done [[ $(ls "$t/stage/usr/share/omamobile/omarchy/patches" | wc -l) == $(ls patches/*.patch | wc -l) ]] || fail "every patch staged" diff --git a/packages/omamobile-omarchy/test/update.sh b/packages/omamobile-omarchy/test/update.sh index b7801d928..90add925e 100755 --- a/packages/omamobile-omarchy/test/update.sh +++ b/packages/omamobile-omarchy/test/update.sh @@ -69,7 +69,7 @@ cat >"$fake/omarchy-update" <>"$calls" echo "omarchy-update OMARCHY_PATH=\${OMARCHY_PATH-unset}" >>"$calls" -for c in omarchy-snapshot omarchy-update-aur-pkgs omarchy-update-orphan-pkgs omarchy-migrate omarchy-update-restart sudo; do +for c in omarchy-snapshot omarchy-update-aur-pkgs omarchy-update-orphan-pkgs omarchy-migrate omarchy-update-restart omarchy-update-boot sudo; do echo "resolve \$c \$(command -v \$c)" >>"$calls" done omarchy-snapshot create; echo "snapshot rc \$?" >>"$calls" @@ -350,7 +350,7 @@ ok "the PIN reached sudo -S on stdin, never argv" 'grep -c "^sudo -S -p -v$" "$ ok "no password file left behind" '[[ ! -e $XDG_RUNTIME_DIR/omamobile-update/auth ]]' ok "the unit runs as omamobile-update" 'grep -c -- "--unit=omamobile-update" "$calls" >/dev/null' ok "omarchy-update -y, unlogged (script is ours), OMAMOBILE_UPDATE=1" 'grep -c "^omarchy-update -y OMARCHY_UPDATE_LOGGED=1 OMAMOBILE_UPDATE=1" "$calls" >/dev/null' -for c in omarchy-snapshot omarchy-update-aur-pkgs omarchy-update-orphan-pkgs omarchy-migrate omarchy-update-restart sudo; do +for c in omarchy-snapshot omarchy-update-aur-pkgs omarchy-update-orphan-pkgs omarchy-migrate omarchy-update-restart omarchy-update-boot sudo; do ok "stand-in on PATH: $c" 'grep -c "^resolve $c $PKG/lib/update-bin/$c$" "$calls" >/dev/null' done ok "snapshot: skipped with 127, real Snapper never called" 'grep -c "^snapshot rc 127$" "$calls" >/dev/null && ! grep -c real-snapshot "$calls" >/dev/null' @@ -445,6 +445,34 @@ printf '{"result": "skipped", "release": "", "message": "AUTO_WRITE is off", "ti out=$(rs $((now - 5))) ok "restart: a skipped write (development phone) asks for nothing" 'python3 -c "import json,sys; d=json.loads(sys.argv[1]); assert not d[\"needs_reboot\"] and not any(\"kernel\" in w for w in d[\"warnings\"]), d" "$out"' +# Omarchy 4.5 runs the restart step in two halves. The first restarts the +# marked services and the shell and decides nothing; the second decides and +# restarts nothing, and still knows which service failed to restart +half() { OMAMOBILE_UPDATE_DIR=$t/rs OMAMOBILE_BOOT_UPDATE_STATUS=$t/bu.json OMAMOBILE_UPDATE_STARTED=$((now - 5)) bash lib/update-bin/omarchy-update-restart "$@" >/dev/null 2>&1; } +printf '{"result": "written", "release": "7.3.0-rc6-omamobile-g0123456789ab", "kernel_changed": true, "message": "x", "time": %d}\n' "$now" >"$t/bu.json" +mkdir -p "$HOME/.local/state/omarchy" +touch "$HOME/.local/state/omarchy/restart-waybar-required" "$HOME/.local/state/omarchy/restart-broken-required" +rm -rf "$t/rs"; : >"$calls" +half --services-only +ok "restart, first half: the marked service and the shell restart, once each" '[[ $(grep -c "^restart-waybar$" "$calls") == 1 && $(grep -c "^restart-shell$" "$calls") == 1 ]]' +ok "restart, first half: no verdict yet" '[[ ! -e $t/rs/restart.json ]]' +: >"$calls" +half --reboot-only +ok "restart, second half: nothing restarts again" '! grep -c "^restart-" "$calls" >/dev/null' +ok "restart, second half: the verdict, with the first half's failed service as a warning" 'python3 -c "import json; d=json.load(open(\"$t/rs/restart.json\")); assert d[\"needs_reboot\"] and \"kernel was updated\" in d[\"reasons\"][0] and d[\"warnings\"] == [\"Restarting broken failed\"], d"' +half --reboot-only +ok "restart, second half alone: no warning left over from an earlier run" 'python3 -c "import json; d=json.load(open(\"$t/rs/restart.json\")); assert d[\"warnings\"] == [], d"' +rc=0; half --sideways || rc=$? +ok "restart: an option it doesn't know is refused" '[[ $rc == 2 ]]' +: >"$calls"; rm -rf "$t/rs" +half +ok "restart, no argument (Omarchy 4.0): both halves in one run" 'grep -c "^restart-shell$" "$calls" >/dev/null && [[ -e $t/rs/restart.json ]]' +rc=0; out=$(bash lib/update-bin/omarchy-update-boot 2>&1) || rc=$? +ok "boot check (Omarchy 4.5): the phone's stand-in passes, silently, without sudo" '[[ $rc == 0 && -z $out ]]' +rc=0; bash lib/update-bin/omarchy-update-boot extra 2>/dev/null || rc=$? +ok "boot check: an argument is refused as Omarchy's is" '[[ $rc == 2 ]]' +printf 'omarchy 4.0.5-1\nmesa 26.1-1\n' >"$t/plan" + # Low battery and wrong repository order: refused before the PIN is used battery 12 Discharging 0 rm -f "$t/sudo-ok"; : >"$calls" diff --git a/packages/omamobile-omarchy/version b/packages/omamobile-omarchy/version index 4a3e97d00..278cbc8db 100644 --- a/packages/omamobile-omarchy/version +++ b/packages/omamobile-omarchy/version @@ -1 +1 @@ -0.1.42 +0.1.43 diff --git a/packages/omamobile-shell/bin/omamobile-onboarding b/packages/omamobile-shell/bin/omamobile-onboarding index ed69c5d39..50cf83998 100644 --- a/packages/omamobile-shell/bin/omamobile-onboarding +++ b/packages/omamobile-shell/bin/omamobile-onboarding @@ -31,6 +31,27 @@ has_identity() { [[ -n $(git config --global user.name) && -n $(git config --global user.email) ]] } +# The owner's name and email, for git and the Compose shortcuts. Omarchy 4.5 +# has one command for both (omarchy-setup-git, which sets what it is given +# and asks nothing); Omarchy 4.0 had two install scripts, of which 4.5 kept +# only the Compose one. A blank value is left as it was, as before. +# OMAMOBILE_SETUP_GIT names another command, for the tests. +save_identity() { + local name=$1 email=$2 setup=${OMAMOBILE_SETUP_GIT:-omarchy-setup-git} args=() + [[ -z ${name//[[:space:]]/} ]] || args+=(--name "$name") + [[ -z ${email//[[:space:]]/} ]] || args+=(--email "$email") + (( ${#args[@]} )) || return 0 + if command -v "$setup" >/dev/null 2>&1; then + "$setup" "${args[@]}" + return + fi + [[ -z ${name//[[:space:]]/} ]] || git config --global user.name "$name" || return 1 + [[ -z ${email//[[:space:]]/} ]] || git config --global user.email "$email" || return 1 + if [[ -f $omarchy_path/install/user/xcompose.sh ]]; then + OMARCHY_USER_NAME=$name OMARCHY_USER_EMAIL=$email bash "$omarchy_path/install/user/xcompose.sh" || return 1 + fi +} + has_pin() { ! printf '' | unix_chkpwd "$USER" nullok 2>/dev/null } @@ -162,10 +183,12 @@ case "${1:-}" in echo name=$(gum input --header "Your name" --placeholder "Ada Lovelace" --value "$(git config --global user.name)") email=$(gum input --header "Your email" --placeholder "ada@example.com" --value "$(git config --global user.email)") - if [[ -n $name || -n $email ]]; then - OMARCHY_USER_NAME=$name OMARCHY_USER_EMAIL=$email bash "$omarchy_path/install/user/git.sh" - OMARCHY_USER_NAME=$name OMARCHY_USER_EMAIL=$email bash "$omarchy_path/install/user/xcompose.sh" - echo "Saved." + if [[ -n ${name//[[:space:]]/} || -n ${email//[[:space:]]/} ]]; then + if save_identity "$name" "$email"; then + echo "Saved." + else + echo "Your name and email could not be saved. Set them later with: omamobile-onboarding" + fi fi echo if has_pin; then diff --git a/packages/omamobile-shell/bin/omamobile-reboot b/packages/omamobile-shell/bin/omamobile-reboot new file mode 100755 index 000000000..e684b5d63 --- /dev/null +++ b/packages/omamobile-shell/bin/omamobile-reboot @@ -0,0 +1,34 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# omamobile-reboot: restart the phone the way Omarchy does (an on-screen +# note, the open apps closed, then systemd's reboot, which stops every unit: +# the modem gets its clean stop). +# +# The shell's Restart buttons (the update sheet, the mobile network page) run +# this, so they don't carry the name of Omarchy's command, which changed: +# Omarchy 4.0 has omarchy-system-reboot, Omarchy 4.5 has "omarchy-system +# reboot". With neither, systemd is asked directly. +# +# omamobile-reboot +# omamobile-reboot --help +# +# OMAMOBILE_SYSTEMCTL names another systemctl, for the tests. + +case ${1:-} in + -h|--help) + sed -n '3,13s/^# \{0,1\}//p' "$0" + exit 0 + ;; + "") ;; + *) + echo "omamobile-reboot: unknown option $1" >&2 + exit 2 + ;; +esac + +if command -v omarchy-system >/dev/null 2>&1; then + exec omarchy-system reboot +elif command -v omarchy-system-reboot >/dev/null 2>&1; then + exec omarchy-system-reboot +fi +exec "${OMAMOBILE_SYSTEMCTL:-systemctl}" reboot --no-wall diff --git a/packages/omamobile-shell/plugins/README.md b/packages/omamobile-shell/plugins/README.md index 2ca67f2de..5b554f985 100644 --- a/packages/omamobile-shell/plugins/README.md +++ b/packages/omamobile-shell/plugins/README.md @@ -932,7 +932,8 @@ Omarchy's update). update doesn't either: the new shell's instance reopens the sheet on the run's progress or result. * **Result:** updated; updated with a restart needed (Restart now runs - `omarchy-system-reboot`); updated but the phone patches failed (the PIN pad + `omamobile-reboot`, Omarchy's own restart under either of its names); + updated but the phone patches failed (the PIN pad may be missing; the log's path); refused; or stopped, with the log's path (`~/.local/state/omamobile/update/update.log`). Migrations held for review are listed. diff --git a/packages/omamobile-shell/plugins/omamobile.mobilenetwork/MobileNetworkModel.js b/packages/omamobile-shell/plugins/omamobile.mobilenetwork/MobileNetworkModel.js index a6ea45b14..119a663ad 100644 --- a/packages/omamobile-shell/plugins/omamobile.mobilenetwork/MobileNetworkModel.js +++ b/packages/omamobile-shell/plugins/omamobile.mobilenetwork/MobileNetworkModel.js @@ -4,7 +4,7 @@ // runs it under Node through the module.exports below. var STATUS_ARGV = ["omamobile-mobile-network", "status"] -var REBOOT_ARGV = ["omarchy-system-reboot"] +var REBOOT_ARGV = ["omamobile-reboot"] var APN = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*$/ function parseJson(text) { diff --git a/packages/omamobile-shell/plugins/omamobile.update/UpdateModel.js b/packages/omamobile-shell/plugins/omamobile.update/UpdateModel.js index 1fb22def8..60edce923 100644 --- a/packages/omamobile-shell/plugins/omamobile.update/UpdateModel.js +++ b/packages/omamobile-shell/plugins/omamobile.update/UpdateModel.js @@ -8,7 +8,7 @@ var START_ARGV = ["omamobile-update", "start"] var STATUS_ARGV = ["omamobile-update", "status", "--json"] var ACK_ARGV = ["omamobile-update", "ack"] var NOTIFY_ARGV = ["omamobile-update", "notify-check"] -var REBOOT_ARGV = ["omarchy-system-reboot"] +var REBOOT_ARGV = ["omamobile-reboot"] var MAX_DETAIL_LINES = 400 function parseJson(text) { diff --git a/packages/omamobile-shell/test/all b/packages/omamobile-shell/test/all index 3d9597d60..325be05a2 100755 --- a/packages/omamobile-shell/test/all +++ b/packages/omamobile-shell/test/all @@ -1080,6 +1080,7 @@ bash test/osk-guard.sh || fail "omamobile-osk-guard" bash -n bin/omamobile-onboarding || fail "omamobile-onboarding parses" bash test/onboarding-fingerprint.sh || fail "omamobile-onboarding's fingerprint offer" bash test/onboarding-mobile.sh || fail "omamobile-onboarding's SIM line" +bash test/onboarding-identity.sh || fail "omamobile-onboarding's name and email" # The Mobile network page (omamobile.mobilenetwork): on for new and existing # users, Setup > Mobile network only where the modem stack is, the Mobile @@ -1204,6 +1205,7 @@ pass "install stages the package" test/keys.sh || fail "omamobile-keys volume keys" test/home-command.sh || fail "omamobile-home" +test/reboot-command.sh || fail "omamobile-reboot" # Every surface on Back's list, and the order, in Qt. rc=0; out=$(python3 -B test/back-surfaces.py 2>&1) || rc=$? diff --git a/packages/omamobile-shell/test/onboarding-identity.sh b/packages/omamobile-shell/test/onboarding-identity.sh new file mode 100644 index 000000000..55f4ca9e2 --- /dev/null +++ b/packages/omamobile-shell/test/onboarding-identity.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# omamobile-onboarding's name and email step against fakes: with Omarchy +# 4.5's omarchy-setup-git it hands both over in one call; without it (Omarchy +# 4.0) it sets git itself and runs Omarchy's Compose script; a blank value is +# not written; and "Saved." is printed only when it was. +set -euo pipefail +cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." +fail() { printf 'not ok - %s\n' "$1" >&2; [[ -f ${t:-}/out ]] && cat "$t/out" >&2; exit 1; } +pass() { printf 'ok - %s\n' "$1"; } +t=$(mktemp -d); trap 'rm -rf "$t"' EXIT +F=$t/fakes; mkdir -p "$F" "$t/home" "$t/omarchy/install/user" +log=$t/calls +fake() { printf '#!/bin/bash\n%s\n' "$2" >"$F/$1"; chmod +x "$F/$1"; } +# git: reads answer nothing; writes are recorded, and fail when told to +fake git '[[ $* == "config --global user."* && $# == 3 ]] && exit 0 +printf "git" >>"$LOG"; printf " [%s]" "$@" >>"$LOG"; echo >>"$LOG"; [[ ! -e $T/git-fails ]]' +fake unix_chkpwd 'exit 1' +# gum: the name, then the email, from $T/answers +fake gum 'case $1 in input) n=$(cat "$T/asked" 2>/dev/null || echo 0); n=$((n + 1)); echo "$n" >"$T/asked"; sed -n "${n}p" "$T/answers" ;; confirm) exit 1 ;; esac' +fake omamobile-set-pin 'case $1 in --type) echo PIN ;; esac' +fake timeout 'shift; "$@"' +fake omamobile-mobile-network 'true' +fake the-setup-git 'printf "setup-git" >>"$LOG"; printf " [%s]" "$@" >>"$LOG"; echo >>"$LOG"; [[ ! -e $T/setup-fails ]]' +printf 'echo "xcompose [$OMARCHY_USER_NAME] [$OMARCHY_USER_EMAIL]" >>"$LOG"\n' >"$t/omarchy/install/user/xcompose.sh" +ob() { # ob SETUP_COMMAND NAME EMAIL + : >"$log"; rm -f "$t/asked"; printf '%s\n%s\n' "$2" "$3" >"$t/answers" + env -u XDG_STATE_HOME T="$t" LOG="$log" HOME="$t/home" USER=alice OMARCHY_PATH="$t/omarchy" OMAMOBILE_FP_RUNNER="$t/none" \ + OMAMOBILE_SETUP_GIT="$1" PATH="$F:/usr/bin:/bin" bash bin/omamobile-onboarding --inner >"$t/out" 2>&1 +} + +ob the-setup-git "Ada Lovelace" ada@example.com +[[ $(cat "$log") == "setup-git [--name] [Ada Lovelace] [--email] [ada@example.com]" ]] || fail "Omarchy 4.5: one call to its git setup with both values ($(cat "$log"))" +grep -c '^Saved\.$' "$t/out" >/dev/null || fail "Omarchy 4.5: says Saved." + +ob the-setup-git "" ada@example.com +[[ $(cat "$log") == "setup-git [--email] [ada@example.com]" ]] || fail "Omarchy 4.5: a blank name is not passed ($(cat "$log"))" +ob the-setup-git "" " " +[[ ! -s $log ]] && ! grep -c '^Saved\.$' "$t/out" >/dev/null || fail "nothing typed: nothing saved, and no Saved." +touch "$t/setup-fails"; ob the-setup-git "Ada Lovelace" ada@example.com; rm "$t/setup-fails" +! grep -c '^Saved\.$' "$t/out" >/dev/null && grep -c 'could not be saved' "$t/out" >/dev/null || fail "Omarchy 4.5: a failed save is not called Saved." +pass "setup: the name and email go to Omarchy 4.5's git setup in one call; blank values are left out; a failure isn't 'Saved.'" + +ob no-such-setup-command "Ada Lovelace" ada@example.com +[[ $(cat "$log") == "git [config] [--global] [user.name] [Ada Lovelace] +git [config] [--global] [user.email] [ada@example.com] +xcompose [Ada Lovelace] [ada@example.com]" ]] || fail "Omarchy 4.0: git's name and email, then the Compose script ($(cat "$log"))" +grep -c '^Saved\.$' "$t/out" >/dev/null || fail "Omarchy 4.0: says Saved." +ob no-such-setup-command "Ada Lovelace" "" +[[ $(cat "$log") == "git [config] [--global] [user.name] [Ada Lovelace] +xcompose [Ada Lovelace] []" ]] || fail "Omarchy 4.0: a blank email is not written to git ($(cat "$log"))" +touch "$t/git-fails"; ob no-such-setup-command "Ada Lovelace" ada@example.com; rm "$t/git-fails" +! grep -c '^Saved\.$' "$t/out" >/dev/null || fail "Omarchy 4.0: a failed git write is not called Saved." +pass "setup: without that command (Omarchy 4.0) git is set directly and Omarchy's Compose script runs" diff --git a/packages/omamobile-shell/test/reboot-command.sh b/packages/omamobile-shell/test/reboot-command.sh new file mode 100755 index 000000000..1be9a08ae --- /dev/null +++ b/packages/omamobile-shell/test/reboot-command.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# bin/omamobile-reboot, what the shell's Restart buttons run: Omarchy's own +# restart under the name the installed Omarchy has (4.5's "omarchy-system +# reboot", 4.0's omarchy-system-reboot), and systemd's when neither exists. +# PATH holds only stand-ins that record what was called, so nothing here can +# restart the machine the test runs on. +set -euo pipefail +here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd) +t=$(mktemp -d); trap 'rm -rf "$t"' EXIT +log=$t/calls +bash=$(command -v bash) +fail() { echo "not ok - omamobile-reboot: $1" >&2; exit 1; } +stub() { # stub DIR NAME + mkdir -p "$1" + printf '#!%s\nprintf "%%s" "%s" >>"%s"; (( $# )) && printf " [%%s]" "$@" >>"%s"; echo >>"%s"\n' "$bash" "$2" "$log" "$log" "$log" > "$1/$2" + chmod +x "$1/$2" +} +run() { # run DIR [args]: only DIR on PATH + local dir=$1; shift + : > "$log" + env -i PATH="$dir" "$bash" "$here/bin/omamobile-reboot" "$@" +} + +stub "$t/both" omarchy-system; stub "$t/both" omarchy-system-reboot; stub "$t/both" systemctl +run "$t/both" +[[ $(cat "$log") == "omarchy-system [reboot]" ]] || fail "with Omarchy 4.5's command it runs 'omarchy-system reboot' ($(cat "$log"))" + +stub "$t/old" omarchy-system-reboot; stub "$t/old" systemctl +run "$t/old" +[[ $(cat "$log") == "omarchy-system-reboot" ]] || fail "with only Omarchy 4.0's command it runs that ($(cat "$log"))" + +stub "$t/none" systemctl +run "$t/none" +[[ $(cat "$log") == "systemctl [reboot] [--no-wall]" ]] || fail "with neither it asks systemd ($(cat "$log"))" + +rc=0; run "$t/both" --now 2>/dev/null || rc=$? +[[ $rc == 2 && ! -s $log ]] || fail "an unknown option runs nothing (exit $rc)" +ln -s "$(command -v sed)" "$t/both/sed" +run "$t/both" --help | grep -c 'restart the phone the way Omarchy does' >/dev/null || fail "--help prints the header" +[[ ! -s $log ]] || fail "--help runs nothing" +echo "ok - omamobile-reboot: Omarchy 4.5's command, then 4.0's, then systemd; an unknown option and --help run nothing" diff --git a/packages/omamobile-shell/test/update-model.js b/packages/omamobile-shell/test/update-model.js index d98a9c8ca..67f5af394 100644 --- a/packages/omamobile-shell/test/update-model.js +++ b/packages/omamobile-shell/test/update-model.js @@ -105,7 +105,7 @@ test("start's exit codes", () => { test("commands: omamobile-update's, the PIN never in argv", () => { assert.deepStrictEqual(M.START_ARGV, ["omamobile-update", "start"]) assert.deepStrictEqual(M.CHECK_ARGV, ["omamobile-update", "check", "--json"]) - assert.deepStrictEqual(M.REBOOT_ARGV, ["omarchy-system-reboot"]) + assert.deepStrictEqual(M.REBOOT_ARGV, ["omamobile-reboot"]) }) let failed = 0 diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version index 07c01eb66..52c3f2af3 100644 --- a/packages/omamobile-shell/version +++ b/packages/omamobile-shell/version @@ -1 +1 @@ -0.2.120 +0.2.124 From e95e7c5d42bb338f8be5d7961d22c5d05284d0a9 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Wed, 11 Nov 2026 12:42:22 -0500 Subject: [PATCH 2/2] omamobile-shell, omamobile-omarchy: Omarchy 4.5's renamed menu rows, its dock and kernel rows, dictation keys and default, and one more held migration More from the 4.0.6 to 4.5.0-3 audit; each works on both versions. Menu rows: Omarchy 4.5 moved Style to Appearance, so the rows the phone hides (bar position, hide/show bar, one-window ratio, workspace layout, the disk-unlock screen) came back under new ids. They are hidden under both sets. New in 4.5 and hidden too: the dock for floating workspaces and Update > Kernel, which would install a kernel the phone can't boot. Dictation: on 4.5 Omarchy binds Alt + Space to its dictation command, and a migration keeps F9 for someone who had dictation before. phone.lua takes both away from the on-screen keyboard, as it did 4.0's F9, and no longer adds 4.0's Voxtype F9 bind on 4.5; an F9 the owner bound to something else is left alone. The phone's own way in stays the keyboard's Mic key and the Dictation tile, which drive Voxtype directly. Voxtype is recorded as Omarchy's dictation default once, for a user who has none (4.5 ships two backends and a new user on a 4.5 image has no answer). Migrations: 1790042972, which puts a world clock on Omarchy's bar, is held (the phone has its own status bar). Read and left to run: 1791554699 (Omarchy's power-profiles-daemon build, which 4.5's package list installs on a fresh image anyway), 1791123731 (four comment lines appended to looknfeel.lua) and 1788129995 (omasnap replaces Tensaku). Of the 98 migrations new in 4.5, the phone's patterns hold 22, all boot loader, kernel, PAM, input-method or titlebar ones. Screenshots need no change yet: 4.5's omarchy-capture-screenshot runs omasnap (in [omarchy] for aarch64) and no longer reads the variable that pointed a tap at Loupe; our override stays for 4.0.6 and is inert on 4.5. Whether omasnap's Open and Edit work by touch is a look on a 4.5 phone. Tested with stand-ins: omamobile-shell's suite (322 checks, with phone.lua under a stub of 4.5's helpers in four cases) and omamobile-omarchy's on 4.5.0-3 (219) and 4.0.6-1 (269). Not run on a phone. Co-Authored-By: Claude Fable 5.2 --- .../lib/update-bin/omarchy-migrate | 1 + .../test/migration-mobile-holds.py | 2 +- .../omamobile-shell/bin/omamobile-setup-user | 30 ++++++++ packages/omamobile-shell/hypr/phone.lua | 26 ++++++- packages/omamobile-shell/test/all | 11 +++ .../omamobile-shell/test/phone-dictation.lua | 75 +++++++++++++++++++ packages/omamobile-shell/test/setup-user.sh | 13 +++- 7 files changed, 155 insertions(+), 3 deletions(-) create mode 100644 packages/omamobile-shell/test/phone-dictation.lua diff --git a/packages/omamobile-omarchy/lib/update-bin/omarchy-migrate b/packages/omamobile-omarchy/lib/update-bin/omarchy-migrate index cb7b5eec6..2566be9c4 100755 --- a/packages/omamobile-omarchy/lib/update-bin/omarchy-migrate +++ b/packages/omamobile-omarchy/lib/update-bin/omarchy-migrate @@ -33,6 +33,7 @@ mobile_pattern='omarchy-hyprland-titlebars|owedvideo|fcitx|omarchy-apply-lock|/e mobile_hold_reason() { case $1 in 1791403310.sh) echo 'installs titlebars pinned to a different Hyprland build' ;; + 1790042972.sh) echo 'adds a world clock to the bar (the phone has its own status bar)' ;; 1789764927.sh) echo 'starts owedvideo (unreviewed mobile video pipeline)' ;; 1791367434.sh) echo 'replaces input method with Fcitx defaults' ;; 1791125650.sh) echo 'changes fprintd resume/stop lifecycle (preserve mobile PAM/claim policy)' ;; diff --git a/packages/omamobile-omarchy/test/migration-mobile-holds.py b/packages/omamobile-omarchy/test/migration-mobile-holds.py index a7732a5d6..b59a6db27 100644 --- a/packages/omamobile-omarchy/test/migration-mobile-holds.py +++ b/packages/omamobile-omarchy/test/migration-mobile-holds.py @@ -8,7 +8,7 @@ import tempfile PACKAGE = Path(__file__).resolve().parent.parent -NAMED = ['1789764927', '1791367434', '1791125650', '1791403310'] +NAMED = ['1789764927', '1791367434', '1791125650', '1791403310', '1790042972'] # Reviewed and released: Omarchy's own file, so a change of its text that # would match a hold pattern shows here RELEASED = ['1792648436'] diff --git a/packages/omamobile-shell/bin/omamobile-setup-user b/packages/omamobile-shell/bin/omamobile-setup-user index e67859b4e..b6f4c60cd 100755 --- a/packages/omamobile-shell/bin/omamobile-setup-user +++ b/packages/omamobile-shell/bin/omamobile-setup-user @@ -537,6 +537,17 @@ if command -v "${OMAMOBILE_VOXTYPE:-voxtype}" >/dev/null && [[ -f $voxmodels/ggm echo "omamobile-setup-user: could not link ${model##*/}" >&2 done fi + # Omarchy 4.5 asks which dictation backend is the default + # (~/.config/omarchy/defaults/dictation) and ships two; its migration + # answers "voxtype" for someone who had Voxtype before, and a new user on a + # 4.5 image has no answer. The phone's is Voxtype, the one the voice bar + # drives, unless the owner has chosen. Omarchy 4.0 never reads the file. + dictation_default=~/.config/omarchy/defaults/dictation + if omarchy-done check omamobile-voxtype-setup && [[ ! -e $dictation_default ]] && + omarchy-done ensure omamobile-dictation-default; then + mkdir -p "${dictation_default%/*}" && printf 'voxtype\n' >"$dictation_default" || + echo "omamobile-setup-user: could not record Voxtype as the dictation default" >&2 + fi if omarchy-done check omamobile-voxtype-setup && ! omarchy-done check omamobile-voxtype-enabled; then if systemctl --user enable voxtype.service; then omarchy-done mark omamobile-voxtype-enabled @@ -644,6 +655,25 @@ menu_hide "no keyboard to learn bindings for" learn.keybindings learn.tmux-keybi menu_hide "the phone's status bar stays at the top" \ style.bar.position.left style.bar.position.right style.bar.position.bottom \ trigger.toggle.top-bar trigger.toggle.one-window-ratio trigger.toggle.workspace-layout +# The same rows under the ids Omarchy 4.5 gave them when Style became +# Appearance (a row the installed Omarchy doesn't have is an entry nothing +# reads), and its disk-unlock row, which the once-only block above hid under +# its 4.0 id. +menu_hide "the phone's status bar stays at the top (Omarchy 4.5's ids)" \ + appearance.top-bar.position.left appearance.top-bar.position.right appearance.top-bar.position.bottom \ + appearance.top-bar.hide appearance.top-bar.show \ + appearance.windows.one-window-ratio-on appearance.windows.one-window-ratio-off \ + appearance.workspace-layout appearance.workspace-layout.dwindle appearance.workspace-layout.scrolling \ + appearance.workspace-layout.floating +menu_hide "no disk-unlock screen on the phone (Omarchy 4.5's id)" appearance.unlock +# New in Omarchy 4.5: a dock for floating workspaces, which a phone never has +# (one maximized app per workspace), and a kernel update that would install a +# kernel the phone can't boot (the phone's kernel is linux-omamobile, written +# to slot B by its own hook). +menu_hide "no dock and no other kernel on a phone (Omarchy 4.5)" \ + appearance.dock appearance.dock.always-on appearance.dock.autohide appearance.dock.position \ + appearance.dock.position.bottom appearance.dock.position.left appearance.dock.position.right appearance.dock.position.top \ + update.kernel menu_hide "x86_64-only installers" \ install.windows install.browser.chrome install.browser.edge \ install.service.dropbox install.service.spotify install.service.nordvpn \ diff --git a/packages/omamobile-shell/hypr/phone.lua b/packages/omamobile-shell/hypr/phone.lua index e055deb25..08ae4f943 100644 --- a/packages/omamobile-shell/hypr/phone.lua +++ b/packages/omamobile-shell/hypr/phone.lua @@ -217,7 +217,31 @@ not_from_osk("ALT + SHIFT + TAB", { }) not_from_osk("CTRL + ALT + TAB", { { "Focus on next monitor", hl.dsp.focus({ monitor = "+1" }) } }) not_from_osk("CTRL + ALT + SHIFT + TAB", { { "Focus on previous monitor", hl.dsp.focus({ monitor = "-1" }) } }) -if o.cmd_present("voxtype") then +-- Dictation keys. Omarchy 4.0 binds F9 to Voxtype (voxtype.lua). Omarchy 4.5 +-- binds Alt + Space to its dictation command when a backend is installed +-- (dictation.lua, which defines o.dictation_installed), and its migration +-- keeps F9 in the bindings.lua of someone who had dictation before. Either +-- way squeekboard's own F9 and Alt + Space belong to the app in front, and +-- the phone's way to dictate is the keyboard's Mic key and the Dictation +-- tile. An F9 line in bindings.lua that isn't that migration's is the +-- owner's and is left alone. +local function migrated_f9() + local file = io.open((os.getenv("HOME") or "") .. "/.config/hypr/bindings.lua", "r") + if not file then return false end + local text = file:read("*a") + file:close() + return text:find('o.bind_hold("F9", "Start dictation (push-to-talk)", "omarchy-dictation start"', 1, true) ~= nil +end +if o.dictation_installed then + if o.dictation_installed() then + not_from_osk("ALT + SPACE", { { "Toggle dictation", "omarchy-dictation toggle" } }) + if migrated_f9() then + hl.unbind("F9") + o.bind_hold("F9", "Start dictation (push-to-talk)", "omarchy-dictation start", + "Stop dictation (push-to-talk)", "omarchy-dictation stop", { device = not_osk }) + end + end +elseif o.cmd_present("voxtype") then not_from_osk("F9", { { "Start dictation (push-to-talk)", "voxtype record start" }, { "Stop dictation (push-to-talk)", "voxtype record stop", { release = true } }, diff --git a/packages/omamobile-shell/test/all b/packages/omamobile-shell/test/all index 325be05a2..4a9c50b2f 100755 --- a/packages/omamobile-shell/test/all +++ b/packages/omamobile-shell/test/all @@ -1019,6 +1019,17 @@ lua=$(command -v lua || command -v lua5.4 || command -v luajit || true) if [[ -n $lua ]]; then out=$("$lua" test/phone-rules.lua) || { grep -v '^ok' <<<"$out"; fail "phone.lua window rules"; } pass "phone.lua: edge to edge, opaque, dialogs, picture-in-picture" + # Dictation keys under Omarchy 4.5's helpers: four homes, four bindings.lua + dk=$(mktemp -d) + mkdir -p "$dk/plain/.config/hypr" "$dk/migrated/.config/hypr" "$dk/own/.config/hypr" + printf 'o.bind("SUPER + X", "x", "y")\n' > "$dk/plain/.config/hypr/bindings.lua" + printf 'if o.dictation_installed and o.dictation_installed() then\n o.bind_hold("F9", "Start dictation (push-to-talk)", "omarchy-dictation start", "Stop dictation (push-to-talk)", "omarchy-dictation stop")\nend\n' > "$dk/migrated/.config/hypr/bindings.lua" + printf 'o.bind("F9", "My own key", "my-own-command")\n' > "$dk/own/.config/hypr/bindings.lua" + for sc in installed:plain migrated:migrated own-f9:own none:plain; do + out=$(SCENARIO=${sc%%:*} HOME=$dk/${sc##*:} "$lua" test/phone-dictation.lua) || { grep -v '^ok' <<<"$out"; rm -rf "$dk"; fail "phone.lua dictation keys (${sc%%:*})"; } + done + rm -rf "$dk" + pass "phone.lua on Omarchy 4.5: Alt + Space and the migration's F9 are for hardware keyboards; the owner's own F9 is left alone" else pass "phone.lua window rules # SKIP no lua" fi diff --git a/packages/omamobile-shell/test/phone-dictation.lua b/packages/omamobile-shell/test/phone-dictation.lua new file mode 100644 index 000000000..4d646bb78 --- /dev/null +++ b/packages/omamobile-shell/test/phone-dictation.lua @@ -0,0 +1,75 @@ +-- SPDX-License-Identifier: MIT +-- hypr/phone.lua's dictation keys under a stub of Omarchy 4.5's helpers +-- (o.dictation_installed, o.bind_hold) and binds: squeekboard's Alt + Space +-- and F9 go to the app in front, a hardware keyboard keeps Omarchy's +-- dictation keys, and an F9 the owner bound to something else is left alone. +-- SCENARIO: installed (a backend is installed, Omarchy's Alt + Space bound), +-- migrated (and bindings.lua has the F9 line 4.5's migration appends, read +-- from $HOME), own-f9 (bindings.lua binds F9 to something else), none (no +-- backend: Omarchy binds nothing). +-- Run from the package directory: SCENARIO=... HOME=... lua test/phone-dictation.lua +local scenario = os.getenv("SCENARIO") +local noop = function() end +local binds = {} +local function dsp(name) return function(arg) return { dsp = name, arg = arg } end end +hl = { + config = noop, window_rule = noop, layer_rule = noop, device = noop, + unbind = function(keys) + local kept = {} + for _, b in ipairs(binds) do if b.keys ~= keys then kept[#kept + 1] = b end end + binds = kept + end, + dsp = { window = { cycle_next = dsp("cycle_next"), bring_to_top = dsp("bring_to_top") }, focus = dsp("focus") }, +} +o = { + bind = function(keys, description, dispatcher, opts) + binds[#binds + 1] = { keys = keys, dispatcher = dispatcher, opts = opts or {} } + end, + bind_hold = function(keys, _, press, _, release, opts) + binds[#binds + 1] = { keys = keys, dispatcher = press, release = release, opts = opts or {}, hold = true } + end, + launch_on_start = noop, + cmd_present = function(cmd) return cmd == "voxtype" end, + dictation_installed = function() return scenario ~= "none" end, +} +-- What Omarchy 4.5 and the owner's bindings.lua bound before phone.lua loads +if scenario ~= "none" then o.bind("ALT + SPACE", "Toggle dictation", "omarchy-dictation toggle") end +if scenario == "migrated" then + o.bind_hold("F9", "Start dictation (push-to-talk)", "omarchy-dictation start", "Stop dictation (push-to-talk)", "omarchy-dictation stop") +elseif scenario == "own-f9" then + o.bind("F9", "My own key", "my-own-command") +end +dofile("hypr/phone.lua") + +local failed = false +local function check(ok, what) + if ok then print("ok - " .. scenario .. ": " .. what) else print("not ok - " .. scenario .. ": " .. what); failed = true end +end +local function find(keys) + local found = {} + for _, b in ipairs(binds) do if b.keys == keys then found[#found + 1] = b end end + return found +end +local function not_osk(b) + local d = b.opts.device + return d ~= nil and d.inclusive == false and #d.list == 1 and d.list[1] == "hl-virtual-keyboard-squeekboard" +end +local space, f9 = find("ALT + SPACE"), find("F9") +for _, b in ipairs(f9) do + check(b.dispatcher ~= "voxtype record start", "Omarchy 4.0's Voxtype F9 bind is not added on 4.5") +end +if scenario == "none" then + check(#space == 0 and #f9 == 0, "without a dictation backend nothing is bound") +else + check(#space == 1 and not_osk(space[1]) and space[1].dispatcher == "omarchy-dictation toggle", + "Alt + Space toggles dictation from every keyboard but squeekboard") + if scenario == "installed" then + check(#f9 == 0, "F9 is not bound when the owner's bindings.lua doesn't bind it") + elseif scenario == "migrated" then + check(#f9 == 1 and f9[1].hold and not_osk(f9[1]) and f9[1].dispatcher == "omarchy-dictation start" + and f9[1].release == "omarchy-dictation stop", "the migration's F9 push-to-talk stays, for every keyboard but squeekboard") + elseif scenario == "own-f9" then + check(#f9 == 1 and f9[1].dispatcher == "my-own-command" and f9[1].opts.device == nil, "the owner's own F9 bind is left as it is") + end +end +os.exit(failed and 1 or 0) diff --git a/packages/omamobile-shell/test/setup-user.sh b/packages/omamobile-shell/test/setup-user.sh index 1adde8036..45621364d 100644 --- a/packages/omamobile-shell/test/setup-user.sh +++ b/packages/omamobile-shell/test/setup-user.sh @@ -98,12 +98,16 @@ for id in update.channel update.channel.stable update.channel.rc update.channel. learn.keybindings learn.tmux-keybindings learn.herdr-keybindings \ style.bar.position.left style.bar.position.right style.bar.position.bottom \ trigger.toggle.top-bar trigger.toggle.one-window-ratio trigger.toggle.workspace-layout \ + appearance.top-bar.position.left appearance.top-bar.position.right appearance.top-bar.position.bottom \ + appearance.top-bar.hide appearance.top-bar.show appearance.windows.one-window-ratio-on \ + appearance.windows.one-window-ratio-off appearance.workspace-layout appearance.workspace-layout.floating \ + appearance.unlock appearance.dock appearance.dock.position.left update.kernel \ install.windows install.browser.chrome install.gaming.steam; do grep -qx "$id false" <<<"$menu" || fail "Menu row $id is hidden" [[ $(grep -c "\"$id\"" "$ext") == 1 ]] || fail "Menu row $id is named once after two logins" done grep -qx 'system.logout true' <<<"$menu" || fail "a row the user set is left as they set it" -for id in style.bar.position.top update.omarchy install.gaming.retroarch; do +for id in style.bar.position.top appearance.top-bar.position.top appearance.top-bar.indicators update.omarchy install.gaming.retroarch; do grep -q "^$id false" <<<"$menu" && fail "Menu row $id stays" done pass "menu rows that break the phone are hidden once, by content, and a user's own entry is kept" @@ -317,6 +321,7 @@ vc "$hn" | grep -cx 'model = "base.en"' >/dev/null || fail "Omarchy's Voxtype co vc "$hn" | grep -cx 'context_window_optimization = true' >/dev/null || fail "the new config gets the context cut too" [[ $(grep -cx 'systemctl --user enable voxtype.service' "$hn/calls") == 1 ]] || fail "voxtype.service is enabled once" [[ -e $hn/.local/state/omarchy/done/voxtype-install-invitation ]] || fail "Omarchy's Install Dictation invitation is marked done" +[[ $(cat "$hn/.config/omarchy/defaults/dictation") == voxtype ]] || fail "Voxtype is recorded as the dictation default (Omarchy 4.5 asks)" if grep -c '^voxtype ' "$hn/calls" >/dev/null 2>&1; then fail "nothing is downloaded (no voxtype setup)"; fi rm "$hn/.local/share/voxtype/models/ggml-base.en.bin" RUN_HOME=$hn RUN_VOICE_MODELS=$VM run @@ -324,10 +329,15 @@ RUN_HOME=$hn RUN_VOICE_MODELS=$VM run [[ $(grep -cx 'systemctl --user enable voxtype.service' "$hn/calls") == 1 ]] || fail "voxtype.service is enabled only once" # A user with Voxtype set up already: config and downloaded model stay ho=$t/voice-own; vhome "$ho"; echo own >"$ho/.local/share/voxtype/models/ggml-base.en.bin" +mkdir -p "$ho/.config/omarchy/defaults"; echo superwhisper >"$ho/.config/omarchy/defaults/dictation" printf '[whisper]\nmodel = "tiny.en"\n' >"$ho/.config/voxtype/config.toml" RUN_HOME=$ho RUN_VOICE_MODELS=$VM run [[ ! -L $ho/.local/share/voxtype/models/ggml-base.en.bin && $(cat "$ho/.local/share/voxtype/models/ggml-base.en.bin") == own ]] || fail "a downloaded model stays" vc "$ho" | grep -cx 'model = "tiny.en"' >/dev/null || fail "the user's Voxtype config stays" +[[ $(cat "$ho/.config/omarchy/defaults/dictation") == superwhisper ]] || fail "a dictation default the owner chose stays" +rm "$hn/.config/omarchy/defaults/dictation" +RUN_HOME=$hn RUN_VOICE_MODELS=$VM run +[[ ! -e $hn/.config/omarchy/defaults/dictation ]] || fail "a dictation default the owner removed is not written again" # A failed enable (firstboot without a user manager) is tried again at the # next login, and only until it works; the once-only parts don't repeat hr=$t/voice-retry; vhome "$hr"; rm -rf "$hr/.config/voxtype" "$hr/.local/share/voxtype"; touch "$hr/systemctl-fails" @@ -354,6 +364,7 @@ for case in novox nomodel; do if [[ $case == novox ]]; then RUN_HOME=$hx RUN_VOICE_MODELS=$VM RUN_VOXTYPE=$t/no-voxtype run; else RUN_HOME=$hx run; fi [[ ! -e $hx/.local/share/voxtype && ! -e $hx/.config/voxtype && ! -e $hx/.local/state/omarchy/done/omamobile-voxtype-setup ]] || fail "$case: Voxtype is left alone" + [[ ! -e $hx/.config/omarchy/defaults/dictation ]] || fail "$case: no dictation default is recorded" if grep -c 'enable voxtype' "$hx/calls" >/dev/null 2>&1; then fail "$case: voxtype.service isn't enabled"; fi done rm "$F/voxtype"