Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/omamobile-shell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down
20 changes: 20 additions & 0 deletions packages/omamobile-shell/bin/omamobile-setup-user
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@
# 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. 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 && $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
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
Expand Down
32 changes: 31 additions & 1 deletion packages/omamobile-shell/test/setup-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -255,3 +256,32 @@ 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 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 } })\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"
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 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"
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"
2 changes: 1 addition & 1 deletion packages/omamobile-shell/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.64
0.2.67