Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
205e4ae
omamobile-keys: the brightness comes back only once the panel is off
angelrenefm Nov 6, 2026
0a4e1a6
omamobile-keys: a short press turns the panel off at once, then locks
angelrenefm Nov 6, 2026
ad3b122
omamobile-keys: a fade to black first, where the shell has one
angelrenefm Nov 6, 2026
6655ed5
omamobile-keys: a locked phone wakes as the power key goes down
angelrenefm Nov 6, 2026
001d3da
omamobile-keys: presses one at a time, a held press wakes once
angelrenefm Nov 6, 2026
e22fe88
omamobile-keys: the wake starts at once and the panel first
angelrenefm Nov 6, 2026
7e34fa8
omamobile-sleepd: a power-key wake from sleep lights the lock at once
angelrenefm Nov 6, 2026
73b1db4
omamobile-keys: quick presses count
angelrenefm Nov 6, 2026
2a772f6
omamobile-keys: a press while the screen is going off wakes it back
angelrenefm Nov 6, 2026
977a1b5
omamobile-keys: the power key as Android's only with OMAMOBILE_POWER_…
angelrenefm Nov 9, 2026
48ec440
omamobile-keys: an English paraphrase next to the two quoted reports
angelrenefm Nov 10, 2026
87b444a
Merge main (#640, #642, #688) into power-key-as-android
angelrenefm Nov 12, 2026
2c075e9
omamobile-keys: the Android press's comment gives wait_screen_off's 1 s
angelrenefm Nov 12, 2026
2a3658f
omamobile-sleepd: drop the 0.2 s poll while waiting to sleep
angelrenefm Nov 12, 2026
657c88a
device-panther: the power key's switch is read by omamobile-keys alone
angelrenefm Nov 13, 2026
1f7b4bc
omamobile-shell 0.2.133, device-panther 0.1.16
angelrenefm Nov 15, 2026
17bb793
Merge main into power-key-as-android
angelrenefm Nov 15, 2026
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
1 change: 1 addition & 0 deletions packages/omamobile-device-panther/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Omarchy Mobile's first userspace package for the Google Pixel 7 (codename panthe
| Path | Installs to | What it does |
| --- | --- | --- |
| `vendor/environment.d/40-omamobile-rotation.conf` | `/usr/lib/environment.d` | `OMAMOBILE_ROTATION_HOLD=1`: Hyprland (packages/hyprland, 0002) holds the last frame across a rotation and turns the new one in as Android does. Off in the shared build until it has run on the other phones |
| `vendor/environment.d/40-omamobile-power-key.conf` | `/usr/lib/environment.d` | `OMAMOBILE_POWER_KEY_ANDROID=1`: the power key as Android's (omamobile-keys): a dark phone wakes on the press, a short press turns the panel off at once and locks behind it. Off in the shared shell until it has run on the other phones |
| `vendor/systemd/system/omamobile-speaker-protection.service.d/50-panther-default-cal.conf` | `/usr/lib/systemd/system/omamobile-speaker-protection.service.d` | `OMAMOBILE_SPK_DEFAULT_CAL=1`: a Pixel 7 with no `speaker.cal` in persist runs its speakers on the protection firmware's default calibration, as stock does (omamobile-audio 0.5.16; c9 and `verify` stay refused). A phone with `speaker.cal` still uses it; a line in `/etc/omamobile/speaker.conf` overrides it |
| `vendor/udev/rules.d/10-omamobile-storage.rules` | `/usr/lib/udev/rules.d` | Hides `sda` and every Android partition except `userdata` from desktop tools. Same rule as the Pixel 7 Pro. The initramfs stops its guard loop before `switch_root`; the kernel's read-only flags are what remain |
| `vendor/udev/rules.d/20-omamobile-gpu-always-on.rules` | `/usr/lib/udev/rules.d` | Keeps the Mali-G710 powered while Panthor drives it: powering its domain back up needs a secure call our kernel doesn't make yet. Same rule as the Pixel 7 Pro |
Expand Down
2 changes: 2 additions & 0 deletions packages/omamobile-device-panther/install
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ install -Dm644 vendor/systemd/network/20-usb-gadget.network \
"$destination/usr/lib/systemd/network/20-usb-gadget.network"
install -Dm644 vendor/environment.d/40-omamobile-rotation.conf \
"$destination/usr/lib/environment.d/40-omamobile-rotation.conf"
install -Dm644 vendor/environment.d/40-omamobile-power-key.conf \
"$destination/usr/lib/environment.d/40-omamobile-power-key.conf"
install -Dm644 vendor/systemd/system/omamobile-speaker-protection.service.d/50-panther-default-cal.conf \
"$destination/usr/lib/systemd/system/omamobile-speaker-protection.service.d/50-panther-default-cal.conf"
install -Dm644 vendor/systemd/logind.conf.d/10-omamobile-power-key.conf \
Expand Down
3 changes: 3 additions & 0 deletions packages/omamobile-device-panther/test/all
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ for f in usr/bin/reboot-to \
usr/lib/udev/rules.d/70-omamobile-dma-heap.rules \
usr/lib/systemd/network/20-usb-gadget.network \
usr/lib/environment.d/40-omamobile-rotation.conf \
usr/lib/environment.d/40-omamobile-power-key.conf \
usr/lib/systemd/system/omamobile-speaker-protection.service.d/50-panther-default-cal.conf \
usr/lib/systemd/logind.conf.d/10-omamobile-power-key.conf \
usr/lib/systemd/sleep.conf.d/10-omamobile.conf \
Expand Down Expand Up @@ -130,6 +131,8 @@ grep -q 'Address=172.16.42.1/24' "$tmp/root/usr/lib/systemd/network/20-usb-gadge
|| fail "usb0 keeps the initramfs address"
grep -qx 'OMAMOBILE_ROTATION_HOLD=1' "$tmp/root/usr/lib/environment.d/40-omamobile-rotation.conf" \
|| fail "the Pixel 7 turns on Hyprland's rotation hold"
grep -qx 'OMAMOBILE_POWER_KEY_ANDROID=1' "$tmp/root/usr/lib/environment.d/40-omamobile-power-key.conf" \
|| fail "the Pixel 7 turns on the power key as Android's"
dropin="$tmp/root/usr/lib/systemd/system/omamobile-speaker-protection.service.d/50-panther-default-cal.conf"
grep -qx '\[Service\]' "$dropin" && grep -qx 'Environment=OMAMOBILE_SPK_DEFAULT_CAL=1' "$dropin" \
|| fail "the Pixel 7 starts its speakers on the default calibration when it has no speaker.cal"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-License-Identifier: MIT
# Omarchy Mobile: the power key as Android's (omamobile-keys,
# packages/omamobile-shell): a dark phone wakes on the press, a short
# press turns the panel off at once and locks behind it.
# The order is the reverse of the shared default's on purpose: the panel
# goes off first and the lock follows behind it, where the default locks
# and then powers the panel off. That is why it stays off on the other
# phones for now; the Pixel 7 turns it on, where it has run. Read when the
# session starts.
OMAMOBILE_POWER_KEY_ANDROID=1
2 changes: 1 addition & 1 deletion packages/omamobile-device-panther/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.15
0.1.16
190 changes: 184 additions & 6 deletions packages/omamobile-shell/bin/omamobile-keys
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,13 @@ screensaver_up() {
# display itself, because on tegu that wake reports ok without powering the
# panel back on. The brightness is put back if it was saved as 0.
wake_locked() {
# The lock's wake restarts its blank timer, but on tegu it reports "ok"
# without powering the panel back on, so always turn the display on too.
# The panel first: it takes about 270 ms to come on (measured on the
# Pixel 7), and the lock's wake happens meanwhile. The lock's wake
# restarts its blank timer, but on tegu it reports "ok" without powering
# the panel back on, so the display is turned on anyway.
omarchy-brightness-display on &
omarchy-shell lock wake >/dev/null 2>&1
omarchy-brightness-display on
wait
local device
device=$(omarchy-hw-display 2>/dev/null)
sleep 0.3
Expand Down Expand Up @@ -173,13 +176,28 @@ sleep_now() {

long_press() {
touch "$state/long"
# This press already woke the phone as it went down: held, it stays lit,
# with no second wake.
[[ -f $state/woke-on-press ]] && return 0
if locked; then
wake_locked
# Lit already: nothing to wake.
screen_off && wake_locked
else
omarchy-menu toggle system
fi
}

# One press's work at a time: presses in quick succession (or a press while
# the last one is still locking and powering the panel off) ran over each
# other, a wake under a going-to-sleep. Each waits for the one before, at
# most 4 s.
serially() {
(
flock -w 4 9 || true
"$@"
) 9>"$state/action.lock"
}

# omarchy-brightness-display off only asks Hyprland to switch the display off.
# Hyprland reports it off at once (dpmsStatus), but the panel itself goes off
# only when the compositor commits it, 0.3 s later on the Pixel 8 Pro
Expand Down Expand Up @@ -218,6 +236,145 @@ wait_screen_off() {
return 0
}

short_press() {
# $1: when the key came up. The work may start later, behind the press
# before (serially), and timing it from then threw quick presses away as
# bounces (Ángel, 6-nov: "los toques rápidos no los detecta bien", quick
# presses aren't picked up well).
local up=${1:-$(now)}
# This press already woke the phone as it went down (power-down).
if [[ -f $state/woke-on-press ]] && (( up - $(<"$state/woke-on-press") < 5000 )); then
rm -f "$state/woke-on-press"
echo "$up" >"$state/last-press"
return 0
fi
# Debounce (below). A second press while the first was still locking and
# powering the panel off once read the screen as on and saved a brightness
# of 0, leaving the phone dark on the next wake: presses now run one at a
# time (serially) instead. A press a few seconds later is the wake.
# A bounce, not a press: within 0.3 s of the last. It was 0.8 s, from when
# a second press could overtake a lock still going on; presses now wait
# for each other (serially), and 0.8 s swallowed quick ones.
local now=$up last
last=$(cat "$state/last-press" 2>/dev/null || echo 0)
echo "$now" >"$state/last-press"
(( now - last < 300 )) && return 0
# The press that woke the phone from sleep, if it gets here at all:
# omamobile-sleepd has lit the PIN pad for it already.
[[ -f $state/power-wake ]] && (( now - $(<"$state/power-wake") < 1500 )) && return 0
if screensaver_up; then
omarchy-system-lock
elif locked; then
if screen_off; then
wake_locked
else
lock_dark
omarchy-brightness-display off
sleep_now
fi
elif screen_off; then
# Unlocked but dark (the lock didn't engage, or the panel was powered
# off by hand): a press wakes it instead of locking into the dark again.
wake_unlocked
else
# Off at once, as on Android: the panel powered off first, then the lock
# taken behind it. The backlight at 0 alone only dimmed a Pixel 7's OLED,
# so the lock showed dim before the screen went off (Ángel, 6-nov: "se
# atenúa, va a la pantalla de bloqueo y luego se apaga", it dims, goes to
# the lock screen and only then turns off). The brightness
# goes to 0 too, for a panel DPMS doesn't reach; it comes back below,
# once the panel is off, for the next wake.
local device level=
device=$(omarchy-hw-display 2>/dev/null)
# A press while this runs (about 2 s: the reveal, the lock, the panel
# going off) wakes the phone back at once, locked, as Android's does; it
# was queued behind it and lost (Ángel, 6-nov: slow to light, measured).
# power-down marks it; each step here looks.
now >"$state/going-off"
rm -f "$state/wake-during-off"
back_on() {
[[ -f $state/wake-during-off ]] || return 1
rm -f "$state/wake-during-off" "$state/going-off"
if [[ -n $device ]]; then
[[ -n $level ]] && brightnessctl -q -d "$device" set "$level" || brightnessctl -q -d "$device" set 40%
fi
locked || omarchy-system-lock
wake_locked
return 0
}
# First Android's fade to black (200 ms, the shell's screenOff), where
# the shell has one; then the panel off.
if [[ $(omarchy-shell shell call omamobile.home screenOff "" 2>/dev/null) == ok ]]; then
sleep 0.2
fi
back_on && return 0
hyprctl dispatch 'hl.dsp.dpms({ action = "disable" })' >/dev/null 2>&1
if [[ -n $device ]]; then
level=$(brightnessctl -d "$device" get 2>/dev/null)
[[ ${level:-0} -gt 0 ]] || level=
brightnessctl -q -d "$device" set 0
fi
omarchy-system-lock
for _ in $(seq 30); do
omarchy-shell lock status 2>/dev/null | grep -q '"secure":true' && break
sleep 0.1
done
back_on && return 0
lock_dark
omarchy-brightness-display off
# The brightness the next wake lights up with: the saved level, or 40 % when
# the press caught the panel at 0. Only once the panel is really off: DPMS
# takes it down about 0.4 s after the dispatch on a Pixel 7 (bl_power goes
# to 4 then), and putting the level back before that lit the lock screen
# for a moment (Ángel, 6-nov: "vuelve a la pantalla de bloqueo antes de
# apagar la pantalla"). At most 1 s (wait_screen_off), for a panel that
# never says so.
wait_screen_off "$device"
if [[ -n $device ]]; then
[[ -n $level ]] && brightnessctl -q -d "$device" set "$level" || brightnessctl -q -d "$device" set 40%
fi
rm -f "$state/going-off"
# A press in the last moment found the panel still going off.
if [[ -f $state/wake-during-off ]]; then
rm -f "$state/wake-during-off"
wake_locked
return 0
fi
sleep_now
fi
}

# The power key as Android's (each change above says what it does): only
# with OMAMOBILE_POWER_KEY_ANDROID=1 in the session's environment, which
# device-panther sets (environment.d), where it has run. Off, the shared
# default, the key works as before: the functions it changed are put back
# here word for word, and a press doesn't wait for the one before. These go
# once it has run on the other phones.
android_power=${OMAMOBILE_POWER_KEY_ANDROID:-}
if [[ $android_power != 1 ]]; then
serially() { "$@"; }

wake_locked() {
# The lock's wake restarts its blank timer, but on tegu it reports "ok"
# without powering the panel back on, so always turn the display on too.
omarchy-shell lock wake >/dev/null 2>&1
omarchy-brightness-display on
local device
device=$(omarchy-hw-display 2>/dev/null)
sleep 0.3
[[ -n $device ]] || return 0
[[ $(brightnessctl -d "$device" get 2>/dev/null || echo 1) -gt 0 ]] || brightnessctl -q -d "$device" set 40%
}

long_press() {
touch "$state/long"
if locked; then
wake_locked
else
omarchy-menu toggle system
fi
}

short_press() {
# Debounce: a second press within 0.8 s of the first, while it was still
# locking and powering the panel off, read the screen as on and saved a
Expand Down Expand Up @@ -272,6 +429,7 @@ short_press() {
sleep_now
fi
}
fi

case "${1:-}" in
power-down)
Expand All @@ -283,6 +441,20 @@ case "${1:-}" in
elif [[ -f $state/volume-up-held ]] && recent volume-up && voice_ptt_enabled; then
start_ptt
else
# Pressed while a press before is still turning the screen off: that
# one wakes the phone back (short_press, back_on).
# Both only with the power key as Android's (android_power).
if [[ $android_power == 1 && -f $state/going-off ]] && (( press - $(<"$state/going-off") < 5000 )); then
touch "$state/wake-during-off"
echo "$press" >"$state/woke-on-press"
# A dark phone wakes as the key goes down, as Android's does
# (it wakes on the press, not the release), so the screen answers the
# press itself. The release then has nothing left to do (short_press
# sees the mark).
elif [[ $android_power == 1 ]] && { panel_dark "$(omarchy-hw-display 2>/dev/null)" || screen_off; }; then
echo "$press" >"$state/woke-on-press"
serially wake_locked >/dev/null 2>&1 &
fi
# Long press: still the same press, still held, no chord in between.
(
sleep "$hold"
Expand Down Expand Up @@ -355,7 +527,10 @@ case "${1:-}" in
if [[ -f $state/chord ]]; then
rm -f "$state/chord"
elif [[ -f $state/long ]]; then
rm -f "$state/long"
rm -f "$state/long" "$state/woke-on-press"
elif [[ $android_power == 1 ]]; then
# One lock for every key action (serially), so no second one here.
serially short_press "$(now)"
else
# Let a second press observe the finished off transition before it
# decides whether to wake. Keep the lock out of background helpers.
Expand All @@ -374,7 +549,10 @@ case "${1:-}" in
# omamobile-sleepd after a power-key wake from sleep: Hyprland never sees
# the press that woke the phone, so light the PIN pad as that press would.
now >"$state/power-wake"
if locked && screen_off; then wake_locked; fi
if [[ $android_power != 1 ]]; then
if locked && screen_off; then wake_locked; fi
# The quick check (a file read), as the press's own wake.
elif panel_dark "$(omarchy-hw-display 2>/dev/null)" || screen_off; then serially wake_locked; fi
;;
double-tap)
# omamobile-doubletap: a double tap on the touchscreen. Only a dark
Expand Down
5 changes: 3 additions & 2 deletions packages/omamobile-shell/test/all
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,8 @@ grep -c 'Copyright (c) 2026 Simon Schubert and contributors' widgets/OWL.md >/de
grep -c 'd355bdb2789f7bd1023d88b17f8a2898dc0ffa2b' widgets/OWL.md >/dev/null || fail "the OWL guide names its source commit"
pass "install stages the package"

test/keys.sh || fail "omamobile-keys volume keys"
env -u OMAMOBILE_POWER_KEY_ANDROID test/keys.sh || fail "omamobile-keys volume keys"
OMAMOBILE_POWER_KEY_ANDROID=1 test/keys.sh || fail "omamobile-keys, with the power key as Android's"
test/home-command.sh || fail "omamobile-home"
test/reboot-command.sh || fail "omamobile-reboot"
bash test/dnd-state.sh || fail "the Do Not Disturb read on Omarchy 4.5 and 4.0"
Expand All @@ -1255,4 +1256,4 @@ elif [[ $rc != 0 ]]; then
else
pass "Back threshold feedback: once per gesture, both edges and retreat"
fi
bash test/power-overlap.sh || fail "overlapping power-key presses"
env -u OMAMOBILE_POWER_KEY_ANDROID bash test/power-overlap.sh || fail "overlapping power-key presses"
9 changes: 9 additions & 0 deletions packages/omamobile-shell/test/keys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ press() { reset; keys power-down; keys power-up; sleep 0.5; }
before() { awk -v a="$1" -v b="$2" '{ sub(/ +$/, "") } $0 == a && !x { x = NR } $0 == b && !y { y = NR } END { exit !(x && y && x < y) }' "$log"; }
echo false >"$t/locked"; echo true >"$t/dpms"
press; grep -q "omarchy-system-lock" "$log" || fail "unlocked and lit: a press locks"
# OMAMOBILE_POWER_KEY_ANDROID=1 (device-panther): Android's fade to black
# first, the shell's screenOff, then the panel off before the lock. Off, as
# before: no fade, the lock first.
if [[ ${OMAMOBILE_POWER_KEY_ANDROID:-} == 1 ]]; then
before "omarchy-shell shell call omamobile.home screenOff" "omarchy-system-lock" \
|| fail "unlocked and lit, as Android's: the fade to black first, then the lock"
else
grep -q "screenOff" "$log" && fail "unlocked and lit, shared default: no fade, as before"
fi
before "omarchy-system-lock" "omarchy-shell lock dark" && before "omarchy-shell lock dark" "omarchy-brightness-display off" \
|| fail "unlocked and lit: the new lock hears it goes dark, before the panel goes off"

Expand Down
2 changes: 1 addition & 1 deletion packages/omamobile-shell/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.132
0.2.133