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
37 changes: 30 additions & 7 deletions docs/TOUCH-PLAN.md

Large diffs are not rendered by default.

36 changes: 35 additions & 1 deletion packages/omamobile-shell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ Omarchy Mobile's phone profile for Omarchy's own shell. It isn't a fork: these a
| Path | What it is |
| --- | --- |
| `plugins/omamobile.bar` | Phone status bar (a full `bar` plugin) |
| `plugins/omamobile.quicksettings` | Pull-down quick settings |
| `plugins/omamobile.quicksettings` | Pull-down quick settings: tiles (a page behind Wi-Fi, Bluetooth, Screen record and Reminder), brightness and volume, the notification shade |
| `plugins/omamobile.launcher` | Home bar: app search, app grid and a prompt to the user's Omarchy default agent |
| `plugins/omamobile.switcher` | Recent apps: swipe up on the dock, or swipe up and hold on the home pill over an app; hold a card to show the app with another one, or give it its own screen again |
| `plugins/omamobile.home` | Home screens: pages of apps and widgets on the wallpaper, with an edit mode. The built-ins include every widget in Simon Schubert's [omarchy-widgets](https://github.com/SimonSchubert/omarchy-widgets) `widgets/simonschubert/` (MIT): the OWL originals, from the `omamobile-owl-widgets` package, run by our own OWL runtime (`owl/`, see `owl/SPEC-NOTES.md`). `widgets/OWL.md` is his OWL language guide (MIT, `widgets/LICENSE-owl-guide`) |
| `plugins/omamobile.keyboard` | Hide button above the on-screen keyboard |
| `plugins/omamobile.back` | The back gesture: swipe in from a side edge for Escape |
| `plugins/omamobile.update` | The update sheet: Omarchy's update for a phone, through `omamobile-update` (package `omamobile-omarchy`) |
| `plugins/omamobile.onboarding` | The setup sheet: the first run's questions (name and email, a PIN or password, Omarchy's agent invitation) and System > PIN, through `omamobile-onboarding` and `omamobile-set-pin`, which keep their terminal prompts as the fallback |
| `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-onboarding`, `bin/omamobile-set-pin` | First-run setup and the PIN or password: the sheet above when the shell runs it, gum prompts in a terminal otherwise; `--status --json`, `--identity`, `--invite-agent` and `--apply TYPE` (secrets on stdin) are what the sheet calls |
| `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 plugin |
| `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 All @@ -29,6 +31,38 @@ Omarchy Mobile's phone profile for Omarchy's own shell. It isn't a fork: these a
| `widgets/WIDGETS.md` | The contract for user widgets, for people and coding agents (installed to `/usr/share/omamobile/shell/`) |
| `widgets/template`, `widgets/examples` | The starter **Create a widget with AI** copies, and examples to copy (`widget-template/`, `widget-examples/`) |

## Gestures

What a finger does on the phone shell (docs/TOUCH-PLAN.md), by surface. Destructive actions take two taps: the first turns the button into a question ("Clear all?", "Forget <name>?", "Reset?") for a few seconds.

| Where | Gesture | What it does |
| --- | --- | --- |
| Anywhere | Swipe in from the left or right edge | Back (Escape to the app), never over the lock or a fullscreen window |
| Home pill (over an app) | Swipe up | Home (an empty workspace, then the home page) |
| Home pill | Swipe up and hold, or a long swipe | Recent apps |
| Dock (home screen) | Swipe up | Recent apps |
| Dock | Tap the search pill | The app drawer with the keyboard |
| App drawer | Pull down from the top, or the chevron | Close it |
| App drawer | Long-press an app | Put it on the home page ("Added to home") |
| Home page | Swipe sideways | The next or previous page |
| Home page | Long-press (upright) | Edit mode: drag to move, handles to resize, tap the gear for a widget's settings; a notice says to turn the phone upright in landscape |
| Home page | Tap a dimmed "Not installed" tile | A notice; hold to edit and remove it |
| Status bar | Pull down | Quick settings, collapsed |
| Quick settings | Pull down again, or tap the handle | Expand to every tile, with the volume slider |
| Quick settings | Swipe up, tap outside, or Escape | Close |
| Quick settings | Swipe sideways on the tiles | The next page of tiles |
| Quick-settings tile | Tap | Toggle (or open: Clipboard, Dictation, Reminder) |
| Quick-settings tile | Long-press, or its chevron | The page behind it (Wi-Fi, Bluetooth, Reminder's list, theme picker) |
| Quick settings, pencil | Tap a tile | Remove it; hold and drag to move; tap one under Add tiles to add it |
| Notification shade | Swipe a row sideways | Forget that notification |
| Notification shade | Tap a row | Open it |
| Recent apps | Swipe sideways | Through the cards |
| Recent apps | Tap a card | Switch to it |
| Recent apps | Flick a card up | Close it |
| Recent apps | Long-press a card | Show it with another app, or give it its own screen |
| Incoming call | Swipe the control up or down | Answer or decline |
| Keyboard | Tap the button at its top-left | Hide it |

## AI Agent shortcut

**AI Agent** in the app drawer opens Omarchy's default agent with
Expand Down
66 changes: 61 additions & 5 deletions packages/omamobile-shell/bin/omamobile-onboarding
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,25 @@
# default AI agent (Setup > Default Agent): Omarchy shows it after the first
# update, a phone at first login.
#
# omamobile-onboarding open a terminal and run it
# omamobile-onboarding open it: the shell's sheet
# (omamobile.onboarding, TOUCH-PLAN 1.11) when
# the shell runs it, else a terminal with the
# prompts
# omamobile-onboarding --nudge at login: if anything is missing, say so
# omamobile-onboarding --status --json
# what is set, for the sheet: {"name", "email",
# "identity": bool, "pin": {"set", "type"},
# "agent": the default agent or ""}
# omamobile-onboarding --identity NAME EMAIL
# save the name and email, as the prompts do
# (nothing when both are empty)
# omamobile-onboarding --invite-agent
# Omarchy's one-time invitation to pick an agent
# omamobile-onboarding --inner the terminal prompts (gum)
#
# The sheet asks the same questions in the same order and calls the entry
# points above, so what each answer does lives here alone.
# OMAMOBILE_PROMPTS=terminal skips the sheet.
set -u

omarchy_path=${OMARCHY_PATH:-/usr/share/omarchy}
Expand All @@ -18,7 +35,16 @@ has_identity() {
}

has_pin() {
! printf '' | unix_chkpwd "$USER" nullok 2>/dev/null
[[ $(omamobile-set-pin --status 2>/dev/null) == *'"set": true'* ]]
}

# Omarchy's own steps, with the answers as its installer passes them:
# git's identity, and XCompose's <Multi_key> <space> <n>/<e> shortcuts.
save_identity() {
local name=$1 email=$2
[[ -n $name || -n $email ]] || return 0
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"
}

# Omarchy's hook: one notification, only while no agent is chosen, never twice.
Expand All @@ -27,6 +53,27 @@ invite_agent() {
[[ -f $hook ]] && bash "$hook" || true
}

status_json() {
local pin
pin=$(omamobile-set-pin --status 2>/dev/null) || pin='{"set": false, "type": "pin"}'
python3 -I -c '
import json, sys
name, email, pin, agent = sys.argv[1:]
try:
pin = json.loads(pin)
except ValueError:
pin = {"set": False, "type": "pin"}
print(json.dumps({"name": name, "email": email, "identity": bool(name and email), "pin": pin, "agent": agent}))
' "$(git config --global user.name)" "$(git config --global user.email)" "$pin" "$(omarchy-default-agent 2>/dev/null | head -n1)"
}

# The shell's sheet, when the shell runs it: `summon` answers ok, or unknown
# for a shell without the plugin; no shell at all fails.
open_sheet() {
[[ ${OMAMOBILE_PROMPTS:-} == terminal ]] && return 1
[[ $(omarchy-shell shell summon omamobile.onboarding "$1" 2>/dev/null) == ok ]]
}

case "${1:-}" in
--nudge)
# one nudge at a time: the agent waits until the phone itself is set up
Expand All @@ -38,14 +85,22 @@ case "${1:-}" in
"Add your name and email, and a PIN or password to lock it. Tap to start." \
--exec omamobile-onboarding
;;
--status)
status_json
;;
--identity)
save_identity "${2:-}" "${3:-}"
;;
--invite-agent)
invite_agent
;;
--inner)
echo "Welcome to Omarchy Mobile. Two quick steps."
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"
save_identity "$name" "$email"
echo "Saved."
fi
echo
Expand All @@ -57,10 +112,11 @@ case "${1:-}" in
invite_agent
;;
"")
open_sheet '{}' && exit 0
exec omarchy-launch-floating-terminal-with-presentation "omamobile-onboarding --inner"
;;
*)
echo "Usage: omamobile-onboarding [--nudge]" >&2
echo "Usage: omamobile-onboarding [--nudge|--status --json|--identity NAME EMAIL|--invite-agent]" >&2
exit 1
;;
esac
141 changes: 135 additions & 6 deletions packages/omamobile-shell/bin/omamobile-set-pin
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,24 @@
# Set or change the phone's PIN or password: it is the account password, so
# Omarchy's lock screen, sudo and polkit all check it through PAM.
#
# omamobile-set-pin open a terminal to set or change it
# omamobile-set-pin --type print this user's choice: pin or password
# omamobile-set-pin set or change it: the shell's sheet
# (omamobile.onboarding, TOUCH-PLAN 1.11) when
# the shell runs it, else a terminal with the
# prompts below
# omamobile-set-pin --type print this user's choice: pin or password
# omamobile-set-pin --status JSON: {"set": bool, "type": "pin"|"password"}
# omamobile-set-pin --apply TYPE
# what the sheet runs: the current PIN or
# password (an empty line when there is none)
# and the new one on stdin, one per line, never
# in argv. passwd makes the change (driven on a
# pty, answering its prompts as the terminal
# flow does), then TYPE is recorded. Exit 0 set,
# 3 the current one was wrong, 5 the new one
# was refused (the reason on stdout), 1 else.
# omamobile-set-pin --inner the terminal prompts (gum)
# (A phone without one is pointed here by omamobile-onboarding at login.)
# OMAMOBILE_PROMPTS=terminal skips the sheet.
#
# The choice decides how the phone asks for it, like Android: a PIN gets the
# lock screen's number pad and the on-screen keyboard's digits, a password the
Expand All @@ -26,9 +41,15 @@ current_type() {
[[ $type == password ]] && echo password || echo pin
}

# Whether the account has a password at all: an empty one is accepted
# (nullok) by unix_chkpwd, and means none.
has_pin() {
! printf '' | unix_chkpwd "$USER" nullok 2>/dev/null
}

# Record TYPE (pin or password) and set Omarchy's toggles to match.
record_type() {
mkdir -p "$(dirname "$record")" "$toggles"
mkdir -p "${record%/*}" "$toggles"
printf '%s\n' "$1" >"$record.new" && mv "$record.new" "$record"
# the lock's number pad and the prompts' 123/ABC switch: a touch phone
touch "$toggles/lock-keypad"
Expand All @@ -39,6 +60,100 @@ record_type() {
fi
}

# With a PIN or password set, the phone locks right after it starts.
mark_lock_on_start() {
mkdir -p "$toggles"
touch "$toggles/lock-on-start"
}

status_json() {
local set=false
has_pin && set=true
printf '{"set": %s, "type": "%s"}\n' "$set" "$(current_type)"
}

# The shell's sheet, when the shell runs it: `summon` answers ok, or unknown
# for a shell without the plugin; no shell at all fails.
open_sheet() {
[[ ${OMAMOBILE_PROMPTS:-} == terminal ]] && return 1
[[ $(omarchy-shell shell summon omamobile.onboarding "$1" 2>/dev/null) == ok ]]
}

# passwd on a pty, its prompts answered from the two lines on our stdin.
# Python's pty module, since passwd talks to the terminal, not stdin. The
# secrets never reach argv, the environment or the output.
read -r -d '' PASSWD_DRIVER <<'PY' || true
import os, pty, re, select, sys, time
current = sys.stdin.readline().rstrip("\n")
new = sys.stdin.readline().rstrip("\n")
if not new:
print("No new PIN or password was given")
sys.exit(1)
pid, fd = pty.fork()
if pid == 0:
os.environ["LC_ALL"] = "C"
try:
os.execvp("passwd", ["passwd"])
finally:
os._exit(127)
out = b""
seen = 0
answered = []
status = None
deadline = time.time() + 60
while time.time() < deadline:
try:
ready, _, _ = select.select([fd], [], [], 0.25)
except InterruptedError:
continue
if ready:
try:
chunk = os.read(fd, 4096)
except OSError:
chunk = b""
if not chunk:
break
out += chunk
pending = out[seen:].decode("utf-8", "replace")
prompt = re.search(r"([^\n]*password[^\n]*):\s*$", pending, re.I)
if prompt:
which = "new" if "new" in prompt.group(1).lower() else "current"
answered.append(which)
os.write(fd, ((new if which == "new" else current) + "\n").encode())
seen = len(out)
continue
done, st = os.waitpid(pid, os.WNOHANG)
if done:
status = st
break
if status is None:
try:
os.kill(pid, 9)
except OSError:
pass
_, status = os.waitpid(pid, 0)
try:
os.close(fd)
except OSError:
pass
code = os.waitstatus_to_exitcode(status)
text = out.decode("utf-8", "replace")
if code == 0 and "updated successfully" in text:
sys.exit(0)
# pam_unix's and pam_pwquality's refusals of the new one; "password
# unchanged" is what passwd says after any failure, and means nothing here.
refusals = ("BAD PASSWORD", "must choose", "too short", "too simple", "too similar", "do not match",
"No password has been supplied", "already used")
for line in text.splitlines():
if any(key.lower() in line.lower() for key in refusals):
reason = re.sub(r"^.*BAD PASSWORD:\s*", "", line.strip(), flags=re.I)
print(reason or "The new one was refused")
sys.exit(5)
if answered and answered[0] == "current" and "new" not in answered:
sys.exit(3)
sys.exit(1)
PY

case "${1:-}" in
--inner)
echo "Choose how you unlock the phone. It is also used for sudo."
Expand All @@ -63,20 +178,34 @@ case "${1:-}" in
gum confirm "Try again?" || exit 1
done
record_type "$type"
mkdir -p "$toggles"
touch "$toggles/lock-on-start"
mark_lock_on_start
echo
[[ $type == pin ]] && echo "PIN set." || echo "Password set."
echo "Your phone now locks after it starts."
;;
--apply)
type=${2:-}
case $type in pin | password) ;; *) echo "Usage: omamobile-set-pin --apply pin|password" >&2; exit 2 ;; esac
python3 -I -c "$PASSWD_DRIVER"
rc=$?
if [[ $rc == 0 ]]; then
record_type "$type"
mark_lock_on_start
fi
exit $rc
;;
--type)
current_type
;;
--status)
status_json
;;
"")
open_sheet '{"page":"pin"}' && exit 0
exec omarchy-launch-floating-terminal-with-presentation "omamobile-set-pin --inner"
;;
*)
echo "Usage: omamobile-set-pin [--type]" >&2
echo "Usage: omamobile-set-pin [--type|--status|--apply pin|password]" >&2
exit 1
;;
esac
6 changes: 6 additions & 0 deletions packages/omamobile-shell/bin/omamobile-setup-user
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,12 @@ fi
if omarchy-done ensure omamobile-back-plugin; then
add_plugin omamobile.back
fi
# The setup sheet (omamobile.onboarding, TOUCH-PLAN 1.11): the first run's
# questions and System > PIN as sheets; omamobile-onboarding and
# omamobile-set-pin open it when the shell has it, the terminal otherwise.
if omarchy-done ensure omamobile-onboarding-plugin; then
add_plugin omamobile.onboarding
fi
if omarchy-done ensure omamobile-menu-update; then
extension=~/.config/omarchy/extensions/omarchy-menu.jsonc
mkdir -p "$(dirname "$extension")"
Expand Down
25 changes: 25 additions & 0 deletions packages/omamobile-shell/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,31 @@ Omarchy's update).
IPC: `omarchy-shell shell call omamobile.update snapshot ''` (page, step,
result; never the PIN).

## omamobile.onboarding

The setup sheet (TOUCH-PLAN 1.11): the first run's questions and System >
PIN as sheets, in place of the gum prompts `omamobile-onboarding` and
`omamobile-set-pin` put in a terminal, which a touch screen can't answer
(arrow keys and Enter). `omarchy-shell shell summon omamobile.onboarding
'{}'` is the first run (name and email, then a PIN or password unless there
is one, then Omarchy's invitation to pick a default agent); `'{"page":"pin"}'`
is System > PIN (PIN or password, then the entry). The scripts open the sheet
themselves when the shell runs it (`summon` answers `ok`) and fall back to
the terminal prompts otherwise, or with `OMAMOBILE_PROMPTS=terminal`.

The scripts stay the one definition of what each answer does: the sheet
reads `omamobile-onboarding --status --json`, saves with `--identity NAME
EMAIL` (Omarchy's `git.sh` and `xcompose.sh`), invites with
`--invite-agent`, and sets the PIN with `omamobile-set-pin --apply TYPE`,
which takes the current and the new secret on its stdin (never argv, a
file or the log), drives `passwd` on a pty as the terminal flow's prompts
did, and records the choice and `lock-on-start`. Its exit code says what
happened (3 wrong current, 5 refused with the reason on stdout), and the
sheet goes back to the step that needs another answer. The fields keep to
the bottom of the card, above the on-screen keyboard, with the ABC/123
switch of the update sheet. `test/onboarding.sh` drives the entry points
against a fake `passwd`; `test/onboarding-render` draws every page.

## omamobile.access

The question xdg-desktop-portal asks before an app first uses the camera, the
Expand Down
Loading