Skip to content
Open
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
3 changes: 2 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ jobs:
run: |
pacman -Syu --noconfirm --needed git base-devel e2fsprogs zstd lz4 openssl \
python python-dbus python-gobject dbus nodejs dtc cpio file jq busybox \
xz gzip qt6-declarative qt6-svg shellcheck rsync android-tools
xz gzip qt6-declarative qt6-svg shellcheck rsync android-tools \
lua # omamobile-shell: hypr/phone.lua's rules and the display scale under a stub of Hyprland's Lua
# Arch's nodejs can lag a simdjson soname bump: on 2026-10-29
# simdjson 5.0.8 dropped the libsimdjson.so.34 that nodejs still
# linked, and node no longer started. Only while node can't start,
Expand Down
5 changes: 3 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,9 @@ Each entry gives the gotcha, then the reason or the fix. Details are in the link

- **`grep -q` under `set -o pipefail`:** `grep -q` exits early, SIGPIPEs the writer, and the pipeline fails on large input. Use `grep -c … >/dev/null`.
- **Omarchy's Chromium launcher splits each line of `chromium-flags.conf` on spaces:** quote a flag whose value has spaces (`"--user-agent=…"`).
- **Chromium needs `--force-device-scale-factor` on the phone,** even with the mobile user agent: its window layout won't go below about 500 px and the panel is 480 px wide in logical pixels, so without it the window runs off the right edge. Sites get phone layouts from the user agent.
- **Grok Bot needs it too** (`~/.config/grok-bot-flags.conf`, read by its launcher): it won't lay out narrower than 512 px. `omamobile-setup-user` picks the factor from the panel's mode so the layout is about 578 px wide (0.83 on the 7 Pro, 0.70 on the 9a).
- **Chromium needs `--force-device-scale-factor` on the phone,** even with the mobile user agent: its window layout won't go below about 500 px and the panel is 480 px wide in logical pixels on the 7 Pro (450 to 504 on the others), so without it the window runs off the right edge. Sites get phone layouts from the user agent.
- **Grok Bot needs it too** (`~/.config/grok-bot-flags.conf`, read by its launcher): it won't lay out narrower than 512 px. `omamobile-setup-user` picks the factor once, before the compositor runs, from the panel's mode at scale 3, so the layout is about 578 px wide on the 7 Pro (0.83) and wider elsewhere (0.62 on a 9a set up from omamobile-shell 0.2.116, whose panel is 450 px at its own 2.4; 0.70 on one set up before, at 8/3).
- **Each screen's scale comes from its pixels per inch, in the config.** `hypr/display-scale.lua` (omamobile-shell 0.2.116+; `omamobile-setup-user` loads it at the top of `monitors.lua`) gives a DSI panel the 7 Pro's 170.7 logical px per inch from the mode and the millimetres DRM reports, snapped to a scale Hyprland takes (3 on the 7 Pro, 2.4 on the 9a, 8/3 on the 8 Pro), through `omarchy_monitor_scale`; other outputs get rules of their own (110 px/in, or 1 without a size). Change scales in `monitors.lua` (a number for `omarchy_monitor_scale`, or a rule for the output further down; a rule for another mode only, such as 60 Hz, keeps `scale = omarchy_monitor_scale`), not with `hyprctl eval` or `keyword monitor`: the next config reload, which Omarchy causes often, drops a runtime rule. `omamobile-display-scale` shows the numbers, read-only. A panel that reports 0x0 mm keeps 3.
- **The screensaver runs in a terminal, so focusing it pops up the on-screen keyboard:** `patches/omarchy/0006-*` turns `org.gnome.desktop.a11y.applications screen-keyboard-enabled` off for the screensaver and back on afterwards (from an EXIT trap in the launcher, since omamobile-omarchy 0.1.9), and `omamobile-osk-guard` (omamobile-shell 0.2.19) turns it back on whenever it is off with no screensaver running. If the keyboard stops appearing, check that key first.
- **Vendor chroots:** bootstrap binaries such as `servicemanager` use `/system/bin/bootstrap/linker64` as their interpreter. `extract-vendor-chroot` links it to the runtime APEX linker. Run the chroot by path, without `env chroot`.
- **If a shell change doesn't show on a phone, check that `omamobile-setup-user.service` runs at login and that its marker exists.** The user unit re-links every `omamobile.*` plugin into `~/.config/omarchy/plugins/` at each login, so a package update reaches the user; it runs only if `~/.local/state/omarchy/done/omamobile-shell-profile` exists, which firstboot creates. On the 9a, whose user was set up during bring-up, the marker was missing, so the unit was skipped at every login, and two plugin links still pointed at hand copies (`omamobile.quicksettings` at a 2026-10-17 copy with no notification shade, `omamobile.switcher` at a 2026-10-22 copy) while four plugins weren't linked at all. Check with `systemctl --user status omamobile-setup-user` and `ls ~/.local/state/omarchy/done/`. Relink with the script's loop (`for p in /usr/share/omamobile/shell/plugins/omamobile.*; do ln -sfn "$p" ~/.config/omarchy/plugins/"${p##*/}"; done`), not the script: without its markers it would copy the package's `shell.json` over the user's and repeat every other once-only step, such as appending the cursor and keyboard lines to the Hyprland files again. [tegu NOTES](device/tegu/NOTES.md#2026-10-31-and-11-01-leftovers-on-the-palmtop-from-bring-up)
Expand Down
3 changes: 2 additions & 1 deletion packages/omamobile-shell/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ depends=(omarchy omamobile-apps 'omamobile-omarchy>=0.1.11' 'omamobile-owl-widge
which # voice input: voxtype finds wtype and wl-copy with which
pipewire-audio pipewire-pulse pipewire-alsa wireplumber
inotify-tools qt6-declarative
iproute2 jq # omamobile-sleepd: ss for SSH sessions; jq also for omamobile-keys
iproute2 jq # omamobile-sleepd: ss for SSH sessions; jq also for omamobile-keys and omamobile-display-scale
lua # omamobile-display-scale runs hypr/display-scale.lua (Hyprland pulls it in too)
# Both are in Omarchy's base package list, which root images install.
dnsmasq # the Hotspot tile: NetworkManager's shared mode hands out addresses with it
foot xdg-terminal-exec # guard for hand-built/partial installations
Expand Down
21 changes: 19 additions & 2 deletions packages/omamobile-shell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ 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`); at every login it also enables and starts the Phone and Messages agent's user unit (`omatel-agent.service`, when installed), so calls and texts notify with no app open; `--adopt`, for a user set up by hand rather than by firstboot, marks the once-only steps that would overwrite or repeat what that user has (the shell profile, the monitor scale, the cursor and keyboard lines, the screensaver, Files' click policy) done without running them; the other steps run as for a new user (missing phone plugins and an idle block go into `shell.json`, Chromium's flags are written), and the setup service then runs at each login |
| `bin/omamobile-setup-user` | Omarchy Mobile's per-user setup (Omarchy lifecycle `setup-user`); at every login it also enables and starts the Phone and Messages agent's user unit (`omatel-agent.service`, when installed), so calls and texts notify with no app open; `--adopt`, for a user set up by hand rather than by firstboot, marks the once-only steps that would overwrite or repeat what that user has (the shell profile, the monitor scale and the per-screen scale, the cursor and keyboard lines, the screensaver, Files' click policy) done without running them; the other steps run as for a new user (missing phone plugins and an idle block go into `shell.json`, Chromium's flags are written), and the setup service then runs at each login |
| `bin/omamobile-display-scale` | Shows the scale each screen gets so the UI is the same physical size on every phone (read-only): for each output Hyprland has, its mode, its size in mm, pixels per inch, the scale `hypr/display-scale.lua` gives it, the logical size and how large the UI comes out against the Pixel 7 Pro's; with `W H MMW MMH [OUTPUT]`, the same for a panel without a compositor. Hyprland applies the scales itself, from `monitors.lua` |
| `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-screenshot-open` | What a screenshot toast's tap ("Tap to view", patch 0020) opens on a phone (`OMARCHY_SCREENSHOT_EDITOR`, set in `environment.d/30-omamobile-screenshot.conf`; Omarchy passes the saved file's path): the screenshot in Loupe (omamobile-apps), fitted, with touch zoom, pan and swipe, and Loupe's copy, share and delete. Tensaku, Omarchy's default, can't be panned or zoomed by touch; without Loupe it is the fallback, through `omamobile-screenshot-edit` |
Expand Down Expand Up @@ -97,7 +98,23 @@ Open, save and choose-a-folder requests through the portal (Qt, GTK, Electron an

## Windows on a phone screen

`hypr/phone.lua` maximizes every app between the bar and the dock, with no gaps, no border and full opacity (Omarchy's 0.96-0.985 let the home widgets show through). When the maximized window closes, the next one takes the screen (`misc:exit_window_retains_fullscreen`). Modal dialogs float centred at their own size, never bigger than the screen; picture-in-picture is 300x169 in the top-right corner. `omamobile-setup-user` sets the monitor scale to 3 with `GDK_SCALE` to match, gives foot 6 px padding, a scrollback multiplier of 3 and a 300 ms long press, and adds Chromium's Wayland input-method flags, each once and only over Omarchy's own values.
`hypr/phone.lua` maximizes every app between the bar and the dock, with no gaps, no border and full opacity (Omarchy's 0.96-0.985 let the home widgets show through). When the maximized window closes, the next one takes the screen (`misc:exit_window_retains_fullscreen`). Modal dialogs float centred at their own size, never bigger than the screen; picture-in-picture is 16:9 in the top-right corner, 62.5% of the screen's shorter side wide (300x169 on the 7 Pro). `omamobile-setup-user` loads `hypr/display-scale.lua` at the top of the user's `monitors.lua` (once, while the monitor scale is still a default): every screen's scale comes from its pixels and the millimetres DRM reports, so a phone's panel gets the Pixel 7 Pro's 170.7 logical px per inch (3 on the 7 Pro, 2.4 on the 9a, 8/3 on the 8 Pro) and an external screen 110 px per inch, each snapped to a scale Hyprland takes; the panel's goes through Omarchy's `omarchy_monitor_scale` (3 until Hyprland has read the panel) and `GDK_SCALE` follows it rounded up, and a number there or a rule for one output further down still wins. It also gives foot 6 px padding, a scrollback multiplier of 3 and a 300 ms long press, and adds Chromium's Wayland input-method flags, each once and only over Omarchy's own values.

## The same size on every phone

The shell was laid out on the Pixel 7 Pro: 1440x3120 at 512 px/in, scale 3, 480x1040 logical px. `hypr/display-scale.lua` gives every phone's panel that density, 170.7 logical px per inch, from the mode and the millimetres DRM reports (`hyprctl monitors -j` shows them as `physicalWidth` and `physicalHeight`), snapped to the nearest scale that divides the mode into whole logical pixels in 120ths, which is all Hyprland takes:

| Phone | Panel | px/in | Scale | Logical | UI size against the 7 Pro |
| --- | --- | --- | --- | --- | --- |
| Pixel 7 Pro (`cheetah`) | 1440x3120, 71x155 mm | 512 | 3 | 480x1040 | 100% |
| Pixel 9a (`tegu`) | 1080x2424 | 422 | 2.4 | 450x1010 | 97% |
| Pixel 8 Pro (`husky`) | 1344x2992, 70x155 mm | 489 | 8/3 | 504x1122 | 93% |

At one scale of 3 for every phone the 9a's UI was 21% larger than the 7 Pro's, and the 8 Pro's 2992 px don't divide by 3 (Hyprland moved it to 3.2, with a warning). A phone that isn't listed gets its scale the same way, from what its panel reports; a panel that reports no size keeps 3. An external screen gets 110 px/in (a 27-inch 4K is 1.5, 1440p 1), and one of unknown size (a headless output) 1. `omamobile-display-scale` shows the numbers for every output, or for a panel given as `W H MMW MMH`.

It all comes from the config, so a reload keeps it: `monitors.lua` loads the module, Omarchy's rule for every output takes the panel's scale through `omarchy_monitor_scale`, and every other output gets a rule of its own. A rule a user copies from Omarchy's line (a 60 Hz mode, say) keeps the panel's scale as long as it keeps `scale = omarchy_monitor_scale`; a number in `omarchy_monitor_scale`, or a rule with a number for one output further down (Omarchy's display scaling writes one), wins. Nothing changes an output's mode: the module makes no rule for the panel, its rule for any other output keeps the mode that output already has, a user's rule replaces it whole, and the setup changes only the two `local` lines of `monitors.lua`. Hyprland reads the config before it has any outputs, so on a cold start the panel comes up at 3 and, where its own scale differs (the 9a, the 8 Pro), Hyprland reloads its config once, before the shell has drawn. An output plugged in later does the same.

The cost of a fractional scale (2.4, 8/3; the 7 Pro's 3 is whole). Clients that speak `wp-fractional-scale-v1` draw at the exact size: Qt 6 (the shell itself), GTK 4, foot, Chromium and Electron, Firefox. The others get a buffer scale of 3, the scale rounded up, and Hyprland scales their buffer down to the panel: their text is a little softer, and they draw more pixels than the panel has (1350x3030 for the 9a's 1080x2424, 1.56 times; 1512x3366 for the 8 Pro's 1344x2992, 1.27 times), which costs some GPU time and battery while they redraw. GTK 3 apps are among them, and so is squeekboard, the on-screen keyboard. X11 apps under XWayland are drawn unscaled with `GDK_SCALE` 3 (the panel's scale rounded up), so on the 9a they come out 25% larger than the rest, and on the 8 Pro 12.5%, rather than smaller.

The package contract follows omarchy-mac's: `./install DESTDIR` stages files and enables nothing, `test/all` runs the package's own tests, and `version` holds the version.

Expand Down
64 changes: 64 additions & 0 deletions packages/omamobile-shell/bin/omamobile-display-scale
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
# SPDX-License-Identifier: MIT
# The scale each screen gets, so the phone's UI is the same physical size on
# every model: from the mode and the size in mm that DRM reports, the scale
# that gives the Pixel 7 Pro's 170.7 logical px per inch on a panel in the
# hand (512 px/in at 3) and 110 on an external screen, snapped to the nearest
# scale Hyprland takes (whole logical pixels, in 120ths). Hyprland applies it
# itself: hypr/display-scale.lua, which omamobile-setup-user loads from the
# user's monitors.lua, does the same sums. This command only shows them; it
# changes nothing.
#
# omamobile-display-scale every output: its mode, size, pixels
# per inch, the scale it should have,
# and the scale Hyprland has now
# omamobile-display-scale W H MMW MMH [OUTPUT]
# the scale for a W x H panel of
# MMW x MMH mm (OUTPUT names its
# connector, DSI-1 by default)
# omamobile-display-scale --help
#
# SIZE is how large the UI comes out against its target: 100% is the 7 Pro's
# size on a panel, under 100% smaller. A "-" for SCALE is a panel that
# reports no size: it keeps the scale in monitors.lua.
set -euo pipefail

module=${OMAMOBILE_SHELL_SHARE:-/usr/share/omamobile/shell}/hypr/display-scale.lua

usage() { awk 'NR > 2 && !/^#/ { exit } NR > 2 { sub(/^# ?/, ""); print }' "${BASH_SOURCE[0]}"; }

# Rows on stdin: name, width, height, mm width, mm height, current scale
# (tab-separated); a table on stdout.
table() {
OMAMOBILE_DISPLAY_MODULE=$module lua -e '
local M = dofile(os.getenv("OMAMOBILE_DISPLAY_MODULE"))
local function num(s) return string.format("%.4g", s) end
print(string.format("%-12s %-10s %-8s %-6s %-6s %-10s %-5s %s", "OUTPUT", "MODE", "MM", "PX/IN", "SCALE", "LOGICAL", "SIZE", "NOW"))
for line in io.stdin:lines() do
local name, w, h, mw, mh, now = line:match("^([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)$")
if name then
w, h, mw, mh = tonumber(w) or 0, tonumber(h) or 0, tonumber(mw) or 0, tonumber(mh) or 0
local ppi = M.ppi(w, h, mw, mh)
local s = M.scale_for(name, w, h, mw, mh)
local target = M.handheld(name) and M.PHONE_PPI or M.DESKTOP_PPI
print(string.format("%-12s %-10s %-8s %-6s %-6s %-10s %-5s %s", name, w .. "x" .. h, mw .. "x" .. mh,
ppi and string.format("%.0f", ppi) or "-", s and num(s) or "-",
s and string.format("%dx%d", math.floor(w / s + 0.5), math.floor(h / s + 0.5)) or "-",
(s and ppi) and string.format("%.0f%%", 100 * s * target / ppi) or "-",
tonumber(now) and num(tonumber(now)) or now))
end
end'
}

case ${1:-} in
-h | --help) usage ;;
"")
command -v hyprctl >/dev/null || { echo "omamobile-display-scale: no hyprctl; give W H MMW MMH instead" >&2; exit 1; }
hyprctl monitors all -j | jq -r '.[] | select(.disabled != true) | [.name, .width, .height, .physicalWidth, .physicalHeight, .scale] | @tsv' | table
;;
*)
(($# == 4 || $# == 5)) || { usage >&2; exit 2; }
for n in "$1" "$2" "$3" "$4"; do [[ $n =~ ^[0-9]+$ ]] || { usage >&2; exit 2; }; done
printf '%s\t%s\t%s\t%s\t%s\t-\n' "${5:-DSI-1}" "$1" "$2" "$3" "$4" | table
;;
esac
Loading