From fc246062c12734b54be8d80b0d3c99ce36b1b6b7 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Sun, 1 Nov 2026 09:04:45 -0647 Subject: [PATCH 1/2] omamobile-shell 0.2.67: omamobile-setup-user --adopt, for a user set up by hand A user set up during bring-up has none of the setup's once-only markers, so the login service never runs, and running the script would reseed shell.json and repeat every step. --adopt marks each once-only step done without running it; the per-login parts still run. --- packages/omamobile-shell/README.md | 2 +- .../omamobile-shell/bin/omamobile-setup-user | 17 ++++++++++++ packages/omamobile-shell/test/setup-user.sh | 26 ++++++++++++++++++- packages/omamobile-shell/version | 2 +- 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/packages/omamobile-shell/README.md b/packages/omamobile-shell/README.md index 9acd9a751..c99d79c95 100644 --- a/packages/omamobile-shell/README.md +++ b/packages/omamobile-shell/README.md @@ -19,7 +19,7 @@ Omarchy Mobile's phone profile for Omarchy's own shell. It isn't a fork: these a | `plugins/omamobile.access` | The permission sheet: "Allow Camera to use the camera?" with the app's icon and two large buttons, in place of xdg-desktop-portal-gtk's desktop dialog | | `plugins/omamobile.fingerprint` | The under-display fingerprint sensor: target during verification, enrollment screen | | `profile/shell.json` | The phone layout the setup seeds once | -| `bin/omamobile-setup-user` | Omarchy Mobile's per-user setup (Omarchy lifecycle `setup-user`) | +| `bin/omamobile-setup-user` | Omarchy Mobile's per-user setup (Omarchy lifecycle `setup-user`); `--adopt` marks every once-only step done without running it, for a user set up by hand rather than by firstboot, so the setup service can run at each login without reseeding `shell.json` or repeating a step | | `bin/omamobile-launch` | One app per screen: every launch from the shell (drawer, home screen, widgets, links, the agent) gets a new empty workspace through a per-launch Hyprland exec rule, or focuses the app's open window; and the switcher's "Show with…" and "Move to its own screen" | | `bin/omamobile-osk-watch` | Reports squeekboard's visibility (sm.puri.OSK0) to the fingerprint, keyboard and launcher plugins | | `bin/omamobile-osk-guard` | Turns the on-screen keyboard (`screen-keyboard-enabled`) back on when it was left off with no screensaver running (a user unit for every graphical session) | diff --git a/packages/omamobile-shell/bin/omamobile-setup-user b/packages/omamobile-shell/bin/omamobile-setup-user index 5c827813e..17ec7c462 100755 --- a/packages/omamobile-shell/bin/omamobile-setup-user +++ b/packages/omamobile-shell/bin/omamobile-setup-user @@ -6,6 +6,23 @@ # markers, so the user's later changes are never overwritten. set -euo pipefail +# --adopt: for a user set up by hand (a bring-up), not by firstboot. Every +# once-only step is marked done without being run, so the user's files stay +# as they are (shell.json isn't reseeded, nothing is appended twice), while +# the parts that run at every login (plugin links, keyboard layouts and +# theme, the menu entries kept current) still run. A step the user does want +# can be had afterwards by removing its marker from +# ~/.local/state/omarchy/done/ before the next login. +if [[ ${1:-} == --adopt ]]; then + omarchy-done() { + if [[ $1 == ensure ]]; then + command omarchy-done check "$2" 2>/dev/null || { command omarchy-done mark "$2"; echo "omamobile-setup-user: adopted $2 (marked done, not run)"; } + return 1 + fi + command omarchy-done "$@" + } +fi + # (test/setup-user.sh points both at the package's own tree and a scratch dir) share=${OMAMOBILE_SHELL_SHARE:-/usr/share/omamobile/shell} config=~/.config/omarchy diff --git a/packages/omamobile-shell/test/setup-user.sh b/packages/omamobile-shell/test/setup-user.sh index 0972031c1..a439b314c 100644 --- a/packages/omamobile-shell/test/setup-user.sh +++ b/packages/omamobile-shell/test/setup-user.sh @@ -16,6 +16,7 @@ fake() { printf '#!/bin/bash\n%s\n' "$2" >"$F/$1"; chmod +x "$F/$1"; } fake omarchy-done 'd=$HOME/.local/state/omarchy/done; mkdir -p "$d" case $1 in ensure) [[ -e $d/$2 ]] && exit 1; touch "$d/$2" ;; + check) [[ -e $d/$2 ]] ;; mark) touch "$d/$2" ;; esac' fake gsettings 'echo "gsettings $*" >>"$HOME/calls"' @@ -49,7 +50,7 @@ done run() { env -i HOME="${RUN_HOME:-$H}" PATH="$F:/usr/bin:/bin" XDG_RUNTIME_DIR="$t" OMAMOBILE_SHELL_SHARE="$pkg" OMAMOBILE_SYSTEM_APPLICATIONS="$A" \ OMAMOBILE_DT="${RUN_DT:-$t/dt-gs201-cheetah}" OMAMOBILE_SQUEEKBOARD_SHARE="$pkg/squeekboard/keyboards" \ - bash bin/omamobile-setup-user >"$t/out" 2>&1 || { cat "$t/out"; fail "omamobile-setup-user runs"; } + bash bin/omamobile-setup-user "$@" >"$t/out" 2>&1 || { cat "$t/out"; fail "omamobile-setup-user runs"; } } run # A user who wants Logout back gives the row their own entry @@ -255,3 +256,26 @@ RUN_HOME=$hk run || fail "a layout the user wrote stays" [[ -L $hk/.local/share/squeekboard/keyboards/fr.yaml ]] || fail "the others are linked beside it" pass "the keyboard: a layout of the user's own stays" + +# --adopt: a user set up by hand, with no markers, keeps every file as it is; +# every once-only step is marked done, the plugin links are made, and a +# normal login afterwards changes nothing +ha=$t/home-adopt; mkdir -p "$ha/.config/hypr" "$ha/.config/omarchy/extensions" "$ha/.config/foot" +cp "$H/.config/foot/foot.ini" "$ha/.config/foot/foot.ini" +cp "$t/home/.config/omarchy/extensions/omarchy-menu.jsonc" "$ha/.config/omarchy/extensions/" 2>/dev/null || printf '{\n}\n' >"$ha/.config/omarchy/extensions/omarchy-menu.jsonc" +printf '{"plugins": [{"id": "mine"}]}\n' >"$ha/.config/omarchy/shell.json" +printf -- '-- mine\nhl.config({ cursor = { invisible = true } })\n' >"$ha/.config/hypr/looknfeel.lua" +printf -- '-- mine\n' >"$ha/.config/hypr/autostart.lua" +printf 'local omarchy_gdk_scale = 2\nlocal omarchy_monitor_scale = 2\n' >"$ha/.config/hypr/monitors.lua" +snap() { (cd "$ha/.config" && cat omarchy/shell.json hypr/looknfeel.lua hypr/autostart.lua hypr/monitors.lua foot/foot.ini) | sha256sum; } +before=$(snap) +RUN_HOME=$ha run --adopt; out=$(cat "$t/out") +[[ $(snap) == "$before" ]] || fail "--adopt changed the user's files" +n=$(grep -c 'omarchy-done ensure' bin/omamobile-setup-user) +m=$(ls "$ha/.local/state/omarchy/done" | grep -c '^omamobile-') +(( m >= n - 1 )) || fail "--adopt marked $m steps of about $n" +[[ -L $ha/.config/omarchy/plugins/omamobile.home ]] || fail "--adopt still links the plugins" +grep -c 'adopted omamobile-shell-profile' <<<"$out" >/dev/null || fail "--adopt says what it marked" +RUN_HOME=$ha run >/dev/null +[[ $(snap) == "$before" ]] || fail "a login after --adopt changed the user's files" +pass "--adopt: a hand-set-up user keeps their files, every once-only step is marked, and later logins change nothing" diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version index 87759d12a..9fd6a7732 100644 --- a/packages/omamobile-shell/version +++ b/packages/omamobile-shell/version @@ -1 +1 @@ -0.2.64 +0.2.67 From 367f89bf031c7e71ac8563f2ebafe03e6f61568f Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Sun, 1 Nov 2026 12:03:50 -0647 Subject: [PATCH 2/2] omamobile-shell: --adopt marks only the steps that would overwrite or repeat The first version marked every once-only step, so a hand-set-up user also lost the steps that check their files first, such as Chromium's no-first-run and mobile flags: on the palmtop Chromium opened on its terms-of-service page. Only the shell profile, the monitor scale, the appended cursor and keyboard lines and the screensaver files are skipped now. --- .../omamobile-shell/bin/omamobile-setup-user | 17 +++++---- packages/omamobile-shell/test/setup-user.sh | 38 +++++++++++-------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/packages/omamobile-shell/bin/omamobile-setup-user b/packages/omamobile-shell/bin/omamobile-setup-user index 17ec7c462..eee3ef20a 100755 --- a/packages/omamobile-shell/bin/omamobile-setup-user +++ b/packages/omamobile-shell/bin/omamobile-setup-user @@ -6,16 +6,19 @@ # markers, so the user's later changes are never overwritten. set -euo pipefail -# --adopt: for a user set up by hand (a bring-up), not by firstboot. Every -# once-only step is marked done without being run, so the user's files stay -# as they are (shell.json isn't reseeded, nothing is appended twice), while -# the parts that run at every login (plugin links, keyboard layouts and -# theme, the menu entries kept current) still run. A step the user does want -# can be had afterwards by removing its marker from +# --adopt: for a user set up by hand (a bring-up), not by firstboot. The +# once-only steps that would overwrite or repeat what such a user already +# has are marked done without running: the shell profile (shell.json), the +# monitor scale, the cursor and on-screen keyboard lines appended to the +# Hyprland files, and the screensaver's branding files. Every other step +# checks the user's files itself before it changes anything, so it runs as +# on a new user (Chromium's flags, the menu entries, the plugins). A marked +# step the user does want can be had by removing its marker from # ~/.local/state/omarchy/done/ before the next login. if [[ ${1:-} == --adopt ]]; then + adopt=" omamobile-shell-profile omamobile-monitor-scale omamobile-hide-cursor omamobile-osk omamobile-screensaver " omarchy-done() { - if [[ $1 == ensure ]]; then + if [[ $1 == ensure && $adopt == *" $2 "* ]]; then command omarchy-done check "$2" 2>/dev/null || { command omarchy-done mark "$2"; echo "omamobile-setup-user: adopted $2 (marked done, not run)"; } return 1 fi diff --git a/packages/omamobile-shell/test/setup-user.sh b/packages/omamobile-shell/test/setup-user.sh index a439b314c..11358b556 100644 --- a/packages/omamobile-shell/test/setup-user.sh +++ b/packages/omamobile-shell/test/setup-user.sh @@ -257,25 +257,31 @@ RUN_HOME=$hk run [[ -L $hk/.local/share/squeekboard/keyboards/fr.yaml ]] || fail "the others are linked beside it" pass "the keyboard: a layout of the user's own stays" -# --adopt: a user set up by hand, with no markers, keeps every file as it is; -# every once-only step is marked done, the plugin links are made, and a -# normal login afterwards changes nothing -ha=$t/home-adopt; mkdir -p "$ha/.config/hypr" "$ha/.config/omarchy/extensions" "$ha/.config/foot" -cp "$H/.config/foot/foot.ini" "$ha/.config/foot/foot.ini" -cp "$t/home/.config/omarchy/extensions/omarchy-menu.jsonc" "$ha/.config/omarchy/extensions/" 2>/dev/null || printf '{\n}\n' >"$ha/.config/omarchy/extensions/omarchy-menu.jsonc" +# --adopt: a user set up by hand, with no markers, keeps the files the +# overwriting steps would change (shell.json, the scale, the cursor and +# keyboard lines, the screensaver), while the steps that check before they +# change still run (Chromium's flags among them); a login afterwards changes +# nothing more +ha=$t/home-adopt; mkdir -p "$ha/.config/hypr" "$ha/.config/omarchy/extensions" "$ha/.config/foot" "$ha/.config/omarchy/branding" +printf '[main]\npad=10x10\n\n[touch]\nlong-press-delay=500\n' >"$ha/.config/foot/foot.ini" +printf '{\n}\n' >"$ha/.config/omarchy/extensions/omarchy-menu.jsonc" printf '{"plugins": [{"id": "mine"}]}\n' >"$ha/.config/omarchy/shell.json" -printf -- '-- mine\nhl.config({ cursor = { invisible = true } })\n' >"$ha/.config/hypr/looknfeel.lua" +printf -- '-- mine\nhl.config({ cursor = { invisible = true } })\ndofile("%s/hypr/phone.lua")\n' "$pkg" >"$ha/.config/hypr/looknfeel.lua" printf -- '-- mine\n' >"$ha/.config/hypr/autostart.lua" printf 'local omarchy_gdk_scale = 2\nlocal omarchy_monitor_scale = 2\n' >"$ha/.config/hypr/monitors.lua" -snap() { (cd "$ha/.config" && cat omarchy/shell.json hypr/looknfeel.lua hypr/autostart.lua hypr/monitors.lua foot/foot.ini) | sha256sum; } +printf 'mine\n' >"$ha/.config/omarchy/branding/screensaver.txt" +snap() { (cd "$ha/.config" && cat hypr/looknfeel.lua hypr/autostart.lua hypr/monitors.lua omarchy/branding/screensaver.txt foot/foot.ini) | sha256sum; } before=$(snap) RUN_HOME=$ha run --adopt; out=$(cat "$t/out") -[[ $(snap) == "$before" ]] || fail "--adopt changed the user's files" -n=$(grep -c 'omarchy-done ensure' bin/omamobile-setup-user) -m=$(ls "$ha/.local/state/omarchy/done" | grep -c '^omamobile-') -(( m >= n - 1 )) || fail "--adopt marked $m steps of about $n" +[[ $(snap) == "$before" ]] || fail "--adopt changed a file an overwriting step owns" +python3 -c 'import json,sys; d=json.load(open(sys.argv[1])); assert {"id":"mine"} in d["plugins"]' "$ha/.config/omarchy/shell.json" || fail "--adopt reseeded shell.json" +for s in omamobile-shell-profile omamobile-monitor-scale omamobile-hide-cursor omamobile-osk omamobile-screensaver; do + [[ -e $ha/.local/state/omarchy/done/$s ]] || fail "--adopt did not mark $s" + grep -c "adopted $s" <<<"$out" >/dev/null || fail "--adopt did not say it adopted $s" +done +grep -cx -- --no-first-run "$ha/.config/chromium-flags.conf" >/dev/null || fail "--adopt skipped Chromium's flags" [[ -L $ha/.config/omarchy/plugins/omamobile.home ]] || fail "--adopt still links the plugins" -grep -c 'adopted omamobile-shell-profile' <<<"$out" >/dev/null || fail "--adopt says what it marked" -RUN_HOME=$ha run >/dev/null -[[ $(snap) == "$before" ]] || fail "a login after --adopt changed the user's files" -pass "--adopt: a hand-set-up user keeps their files, every once-only step is marked, and later logins change nothing" +before=$(snap); flags=$(sha256sum <"$ha/.config/chromium-flags.conf") +RUN_HOME=$ha run +[[ $(snap) == "$before" && $(sha256sum <"$ha/.config/chromium-flags.conf") == "$flags" ]] || fail "a login after --adopt changed the user's files" +pass "--adopt: the overwriting steps are marked and skipped, the checked steps (Chromium's flags) run, and later logins change nothing"