From d09a960907b98f9d3617cc96425301e91a4572fa Mon Sep 17 00:00:00 2001 From: Marsel Nenaj <201385099+marselnenaj@users.noreply.github.com> Date: Sat, 7 Nov 2026 15:18:05 +0100 Subject: [PATCH 1/5] omamobile-omarchy 0.1.35: select 4.0.6 and 4.5 patch families Keep the 4.0.6 series byte-identical while porting runtime contexts to 4.5.0. Select only supported source families and include mobile migration holds. Preserve the repository pin and production updater behavior. Do not ship the new updater gate, transaction shim or approval records. Keep the merged PR431 in the legacy archive byte for byte and leave its 4.5 port to jkjoplin. Preserve upstream copyright and MIT notices; remove false fixture-extension attribution. Run the full adapter suite against the signed 4.5.0-3 package, including fuzz-zero apply/reverse, idempotence, source selection, notification functions, 16 QML parses and native lock fixtures. No device update or physical smoke result is claimed. Co-Authored-By: Codex --- packages/omamobile-omarchy/LICENSE.omarchy | 20 + packages/omamobile-omarchy/PKGBUILD | 2 +- .../bin/omamobile-omarchy-patches | 20 +- packages/omamobile-omarchy/install | 4 + ...latform-skip-the-keybindings-welcome.patch | 15 + ...ck-number-pad-for-touch-only-devices.patch | 278 ++++ ...icker-and-hold-the-desktop-for-style.patch | 76 ++ ...rsor-and-hide-the-on-screen-keyboard.patch | 158 +++ ...-the-user-returns-to-the-screensaver.patch | 40 + ...ess-panels-with-bl-power-follow-dpms.patch | 37 + ...0009-lock-ipc-wake-for-hardware-keys.patch | 24 + ...-leave-the-on-screen-keyboard-usable.patch | 63 + ...ock-and-polkit-pin-or-password-input.patch | 305 +++++ ...-omarchy-update-to-the-phone-wrapper.patch | 30 + ...ke-a-locked-display-through-the-lock.patch | 20 + ...rgency-call-button-for-touch-devices.patch | 54 + .../0015-notifications-inline-reply.patch | 232 ++++ ...he-channel-switch-and-pacman-refresh.patch | 50 + ...-to-dismiss-and-a-touch-close-button.patch | 261 ++++ ...ck-button-and-swipe-right-to-go-back.patch | 113 ++ ...tions-forget-one-notification-by-ipc.patch | 73 ++ ...hrasing-for-keyboard-and-click-hints.patch | 70 + ...-turn-the-display-off-before-suspend.patch | 53 + ...print-only-when-a-finger-is-enrolled.patch | 186 +++ ...a-glance-view-for-touch-only-devices.patch | 1058 ++++++++++++++++ ...0024-app-icons-keep-the-largest-size.patch | 39 + ...5-launch-no-toast-for-shell-surfaces.patch | 30 + .../0026-lock-battery-status.patch | 238 ++++ .../0027-lock-media-controls.patch | 623 +++++++++ ...a-stacked-logo-for-a-narrow-terminal.patch | 60 + ...ove-the-modules-in-a-narrow-terminal.patch | 0 .../bridge-4.0.4-menu-first-frame.patch | 0 ...latform-skip-the-keybindings-welcome.patch | 15 +- ...ck-number-pad-for-touch-only-devices.patch | 148 ++- ...icker-and-hold-the-desktop-for-style.patch | 47 +- ...rsor-and-hide-the-on-screen-keyboard.patch | 19 +- ...-the-user-returns-to-the-screensaver.patch | 7 +- ...ess-panels-with-bl-power-follow-dpms.patch | 7 +- ...0009-lock-ipc-wake-for-hardware-keys.patch | 9 +- ...-leave-the-on-screen-keyboard-usable.patch | 15 +- ...ock-and-polkit-pin-or-password-input.patch | 72 +- ...-omarchy-update-to-the-phone-wrapper.patch | 36 +- ...ke-a-locked-display-through-the-lock.patch | 8 +- ...rgency-call-button-for-touch-devices.patch | 8 +- .../0015-notifications-inline-reply.patch | 347 +++-- ...he-channel-switch-and-pacman-refresh.patch | 51 +- ...-to-dismiss-and-a-touch-close-button.patch | 300 +---- ...ck-button-and-swipe-right-to-go-back.patch | 50 +- ...tions-forget-one-notification-by-ipc.patch | 97 +- ...hrasing-for-keyboard-and-click-hints.patch | 5 +- ...-turn-the-display-off-before-suspend.patch | 8 +- ...print-only-when-a-finger-is-enrolled.patch | 202 +-- ...a-glance-view-for-touch-only-devices.patch | 1128 +++++++++++++++-- ...0024-app-icons-keep-the-largest-size.patch | 7 +- ...5-launch-no-toast-for-shell-surfaces.patch | 20 +- .../patches/0026-lock-battery-status.patch | 5 +- .../patches/0027-lock-media-controls.patch | 3 + ...a-stacked-logo-for-a-narrow-terminal.patch | 3 + packages/omamobile-omarchy/test/all | 8 +- packages/omamobile-omarchy/test/lock-glance | 14 + .../omamobile-omarchy/test/lock-glance.qml | 8 +- .../test/mobile-pam-preserve.py | 34 + .../test/notification-store45.cjs | 17 + packages/omamobile-omarchy/test/patches.py | 24 +- packages/omamobile-omarchy/test/port45.py | 56 + .../Quickshell/Hyprland/Hyprland.qml | 10 + .../test/qml-stubs/Quickshell/Hyprland/qmldir | 2 + .../qml-stubs/Quickshell/Io/IpcHandler.qml | 7 + .../test/qml-stubs/Quickshell/Io/Process.qml | 2 + .../qml-stubs/Quickshell/Io/SplitParser.qml | 8 + .../test/qml-stubs/Quickshell/Io/qmldir | 3 + .../Quickshell/Services/Pipewire/Pipewire.qml | 8 + .../Quickshell/Services/Pipewire/qmldir | 2 + .../test/qml-stubs/Quickshell/Singleton.qml | 3 + .../test/qml-stubs/Quickshell/qmldir | 2 + .../omamobile-omarchy/test/source-family.py | 16 + .../test/upstream45/migrations/1789764927.sh | 17 + .../test/upstream45/migrations/1791125650.sh | 28 + .../test/upstream45/migrations/1791367434.sh | 4 + .../test/upstream45/migrations/1792648436.sh | 21 + .../test/upstream45/migrations/README.md | 8 + .../test/upstream45/notifications/loader.cjs | 22 + .../test/upstream45/notifications/logic.cjs | 1089 ++++++++++++++++ 83 files changed, 7198 insertions(+), 1064 deletions(-) create mode 100644 packages/omamobile-omarchy/LICENSE.omarchy create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0001-first-run-let-a-platform-skip-the-keybindings-welcome.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0003-lock-number-pad-for-touch-only-devices.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0005-touch-swipe-the-image-picker-and-hold-the-desktop-for-style.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0006-screensaver-restore-the-cursor-and-hide-the-on-screen-keyboard.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0007-idle-lock-when-the-user-returns-to-the-screensaver.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0008-brightness-panels-with-bl-power-follow-dpms.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0009-lock-ipc-wake-for-hardware-keys.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0010-polkit-leave-the-on-screen-keyboard-usable.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0011-lock-and-polkit-pin-or-password-input.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0012-update-hand-omarchy-update-to-the-phone-wrapper.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0013-idle-wake-a-locked-display-through-the-lock.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0014-lock-emergency-call-button-for-touch-devices.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0015-notifications-inline-reply.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0016-pacman-a-phone-refuses-the-channel-switch-and-pacman-refresh.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0017-notifications-swipe-to-dismiss-and-a-touch-close-button.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0018-menu-a-back-button-and-swipe-right-to-go-back.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0019-notifications-forget-one-notification-by-ipc.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0020-notifications-touch-phrasing-for-keyboard-and-click-hints.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0021-sleep-turn-the-display-off-before-suspend.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0022-lock-fingerprint-only-when-a-finger-is-enrolled.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0023-lock-a-glance-view-for-touch-only-devices.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0024-app-icons-keep-the-largest-size.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0025-launch-no-toast-for-shell-surfaces.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0026-lock-battery-status.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0027-lock-media-controls.patch create mode 100644 packages/omamobile-omarchy/legacy-4.0.6/0028-show-logo-a-stacked-logo-for-a-narrow-terminal.patch rename packages/omamobile-omarchy/{patches => legacy-4.0.6}/0030-about-the-logo-above-the-modules-in-a-narrow-terminal.patch (100%) rename packages/omamobile-omarchy/{patches => legacy-4.0.6}/bridge-4.0.4-menu-first-frame.patch (100%) create mode 100644 packages/omamobile-omarchy/test/mobile-pam-preserve.py create mode 100644 packages/omamobile-omarchy/test/notification-store45.cjs create mode 100644 packages/omamobile-omarchy/test/port45.py create mode 100644 packages/omamobile-omarchy/test/qml-stubs/Quickshell/Hyprland/Hyprland.qml create mode 100644 packages/omamobile-omarchy/test/qml-stubs/Quickshell/Hyprland/qmldir create mode 100644 packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/IpcHandler.qml create mode 100644 packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/SplitParser.qml create mode 100644 packages/omamobile-omarchy/test/qml-stubs/Quickshell/Services/Pipewire/Pipewire.qml create mode 100644 packages/omamobile-omarchy/test/qml-stubs/Quickshell/Services/Pipewire/qmldir create mode 100644 packages/omamobile-omarchy/test/qml-stubs/Quickshell/Singleton.qml create mode 100644 packages/omamobile-omarchy/test/source-family.py create mode 100644 packages/omamobile-omarchy/test/upstream45/migrations/1789764927.sh create mode 100644 packages/omamobile-omarchy/test/upstream45/migrations/1791125650.sh create mode 100644 packages/omamobile-omarchy/test/upstream45/migrations/1791367434.sh create mode 100644 packages/omamobile-omarchy/test/upstream45/migrations/1792648436.sh create mode 100644 packages/omamobile-omarchy/test/upstream45/migrations/README.md create mode 100644 packages/omamobile-omarchy/test/upstream45/notifications/loader.cjs create mode 100644 packages/omamobile-omarchy/test/upstream45/notifications/logic.cjs diff --git a/packages/omamobile-omarchy/LICENSE.omarchy b/packages/omamobile-omarchy/LICENSE.omarchy new file mode 100644 index 000000000..f12cfa766 --- /dev/null +++ b/packages/omamobile-omarchy/LICENSE.omarchy @@ -0,0 +1,20 @@ +Copyright (c) David Heinemeier Hansson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/omamobile-omarchy/PKGBUILD b/packages/omamobile-omarchy/PKGBUILD index 9584abe80..1068e2004 100644 --- a/packages/omamobile-omarchy/PKGBUILD +++ b/packages/omamobile-omarchy/PKGBUILD @@ -9,7 +9,7 @@ url="https://github.com/derekross/omarchy-mobile" license=(MIT) depends=('omarchy>=4.0.6' bash python patch libarchive gzip util-linux sudo pacman-contrib fakeroot systemd) optdepends=('omamobile-shell: the update sheet') -checkdepends=(diffutils patch util-linux libarchive) +checkdepends=(diffutils patch util-linux libarchive nodejs qt6-declarative) install=omamobile-omarchy.install check() { diff --git a/packages/omamobile-omarchy/bin/omamobile-omarchy-patches b/packages/omamobile-omarchy/bin/omamobile-omarchy-patches index 8c081a442..4f4d58415 100755 --- a/packages/omamobile-omarchy/bin/omamobile-omarchy-patches +++ b/packages/omamobile-omarchy/bin/omamobile-omarchy-patches @@ -500,6 +500,21 @@ def reverse_recover(root, rels, owned, series_dirs, work, log): return {} +def default_series(root, packages): + """Only the two independently qualified source families have a series. + + Keep 4.0.6 available while preparing an upgrade; never apply4.5 contexts + to the currently running old package. Explicit --series remains the + offline prospective rehearsal interface. + """ + families = {v.rsplit("-", 1)[0] for _n, v, _p in packages} + if families == {"4.0.6"}: + return os.path.join(root, "usr/share/omamobile/omarchy/legacy-4.0.6") + if families == {"4.5.0"}: + return os.path.join(root, SERIES) + raise Failure("Omarchy version has no qualified mobile patch series; refusing") + + def apply(root, series_dir, log, hook=False): state_dir = os.path.join(root, STATE_DIR) os.makedirs(state_dir, exist_ok=True) @@ -517,6 +532,9 @@ def apply(root, series_dir, log, hook=False): status["omarchy"] = " ".join("%s %s" % (n, v) for n, v, _ in packages) previous = load_json(os.path.join(state_dir, "state.json")) or {} try: + if series_dir is None: + series_dir = default_series(root, packages) + status["series"] = "/" + os.path.relpath(series_dir, root) patches, series_hash = load_series(series_dir, root) except Failure as e: return fail(root, status, e, log, hook) @@ -805,7 +823,7 @@ def main(argv): if cmd == "apply": log = Log(root, quiet) try: - return apply(root, series or os.path.join(root, SERIES), log, hook) + return apply(root, series, log, hook) except Failure as e: return fail(root, {"time": now(), "log": "/" + LOG, "applied": [], "upstream": [], "omarchy": None}, e, log, hook) if cmd == "restore": diff --git a/packages/omamobile-omarchy/install b/packages/omamobile-omarchy/install index 110562919..86d11d0d2 100755 --- a/packages/omamobile-omarchy/install +++ b/packages/omamobile-omarchy/install @@ -28,4 +28,8 @@ for f in patches/*.patch; do done install -Dm644 libalpm/95-omamobile-omarchy-patches.hook "$d/usr/share/libalpm/hooks/95-omamobile-omarchy-patches.hook" install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-omarchy/LICENSE" +install -Dm644 LICENSE.omarchy "$d/usr/share/licenses/omamobile-omarchy/omarchy-MIT" install -Dm644 version "$d/usr/share/omamobile/omarchy/version" +for f in legacy-4.0.6/*.patch; do + install -Dm644 "$f" "$d/usr/share/omamobile/omarchy/legacy-4.0.6/${f##*/}" +done diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0001-first-run-let-a-platform-skip-the-keybindings-welcome.patch b/packages/omamobile-omarchy/legacy-4.0.6/0001-first-run-let-a-platform-skip-the-keybindings-welcome.patch new file mode 100644 index 000000000..d879205b4 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0001-first-run-let-a-platform-skip-the-keybindings-welcome.patch @@ -0,0 +1,15 @@ +# First run: a platform without a keyboard-first workflow (a phone) skips the +# "Learn Keybindings" welcome; omamobile-setup-user marks +# welcome-keybindings-not-applicable. Sent upstream as omacom/omarchy#15075. + +--- a/install/user/first-run/welcome.sh ++++ b/install/user/first-run/welcome.sh +@@ -1,3 +1,8 @@ ++# A platform without a keyboard-first workflow (a phone, say) opts out of the ++# keybindings introduction from its user setup: omarchy-done mark ++# welcome-keybindings-not-applicable. ++omarchy-done check welcome-keybindings-not-applicable && exit 0 ++ + # Real newlines, not a literal \n: the card renders the body as it arrives, and + # elides past three lines. + omarchy-notification-send -u critical -g  "Learn Keybindings" \ diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0003-lock-number-pad-for-touch-only-devices.patch b/packages/omamobile-omarchy/legacy-4.0.6/0003-lock-number-pad-for-touch-only-devices.patch new file mode 100644 index 000000000..131ac771a --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0003-lock-number-pad-for-touch-only-devices.patch @@ -0,0 +1,278 @@ +# Lock screen: a number pad for touch-only devices (the lock-keypad toggle), +# kept clear of an under-display fingerprint sensor, with a hint that either +# unlocks. The session lock hides every other surface, on-screen keyboards +# included, so a phone needs its own digits; a PIN is a numeric password. +# +# Against Omarchy 4.0.4 (the edge channel's aarch64 omarchy 4.0.4-2, the same +# files as tag v4.0.4) with 0000 (Commons.Color) applied. 4.0.4 has no +# "Fingerprint reader unavailable" notice, so the hunk that moved it above +# the field is gone and the hint shows whenever fingerprints are set up. +diff --git i/shell/plugins/lock/Keypad.qml w/shell/plugins/lock/Keypad.qml +new file mode 100644 +index 0000000..98ad1ad +--- /dev/null ++++ w/shell/plugins/lock/Keypad.qml +@@ -0,0 +1,73 @@ ++import QtQuick ++import qs.Commons ++import qs.Commons as Commons ++import qs.Ui ++ ++// Number pad for touch-only devices (phones, tablets), where the lock screen ++// can't count on a keyboard: the session lock hides every other surface, ++// on-screen keyboards included. Enabled by the `lock-keypad` toggle; the digits ++// go into the same password field, so a PIN is simply a numeric password. ++Item { ++ id: root ++ ++ signal digit(string value) ++ signal backspace() ++ signal enter() ++ ++ // The tallest the pad may be: on a short screen the keys shrink to fit ++ // rather than run under the field above them. ++ property real maxHeight: Infinity ++ ++ // Four rows of keys and three gaps of 0.3 keys: 4.9 keys tall. ++ readonly property int key: Math.round(Math.min(Style.space(84), (parent ? parent.width : 420) * 0.22, maxHeight / 4.9)) ++ readonly property int gap: Math.round(key * 0.3) ++ readonly property var keys: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "back", "0", "enter"] ++ readonly property var keySpec: Border.surfaceSpec("lock", "border-active", Commons.Color.lock.borderActive, 2, "border-alpha") ++ ++ implicitWidth: key * 3 + gap * 2 ++ implicitHeight: key * 4 + gap * 3 ++ width: implicitWidth ++ height: implicitHeight ++ opacity: enabled ? 1 : 0.5 ++ ++ Grid { ++ anchors.fill: parent ++ columns: 3 ++ spacing: root.gap ++ ++ Repeater { ++ model: root.keys ++ ++ delegate: BorderSurface { ++ id: keyCap ++ required property string modelData ++ ++ width: root.key ++ height: root.key ++ radius: Style.cornerRadius ++ color: tap.pressed ? Commons.Color.lock.selection : Commons.Color.lock.background ++ borderSpec: root.keySpec ++ ++ Text { ++ anchors.centerIn: parent ++ textFormat: Text.PlainText ++ text: keyCap.modelData === "back" ? "⌫" : (keyCap.modelData === "enter" ? "⏎" : keyCap.modelData) ++ color: Commons.Color.lock.text ++ font.family: Style.font.family ++ font.pixelSize: Math.round(root.key * 0.38) ++ } ++ ++ MouseArea { ++ id: tap ++ anchors.fill: parent ++ enabled: root.enabled ++ onClicked: { ++ if (keyCap.modelData === "back") root.backspace() ++ else if (keyCap.modelData === "enter") root.enter() ++ else root.digit(keyCap.modelData) ++ } ++ } ++ } ++ } ++ } ++} +diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml +index 3c5f65d..53eef73 100644 +--- i/shell/plugins/lock/LockView.qml ++++ w/shell/plugins/lock/LockView.qml +@@ -17,8 +17,16 @@ Item { + property bool loadBackground: true + property string passwordText: "" + property bool syncingPasswordText: false ++ // Touch-only devices: a number pad under the field (the lock-keypad toggle). ++ property bool keypad: false ++ // A phone with a fingerprint sensor under the display has it in the lower ++ // third of the screen, where the pad would otherwise sit: a finger on the ++ // sensor pressed a key. With fingerprints set up, the pad keeps the lower ++ // third clear, and a hint above the field says either works, as on Android. ++ readonly property bool keypadClearsSensor: keypad && fingerprintConfigured ++ readonly property int keypadBottomMargin: Math.round(height * (keypadClearsSensor ? 0.34 : 0.08)) + +- readonly property string placeholderText: "Enter Password" ++ readonly property string placeholderText: keypad ? "Enter PIN" : "Enter Password" + readonly property int fieldWidth: 381 + readonly property int fieldHeight: 67 + readonly property int outlineThickness: 3 +@@ -54,7 +62,8 @@ Item { + } + + function forcePasswordFocus() { +- passwordInput.forceActiveFocus() ++ if (keypad) keypadKeys.forceActiveFocus() ++ else passwordInput.forceActiveFocus() + } + + function clearPassword() { +@@ -115,16 +124,58 @@ Item { + + MouseArea { + anchors.fill: parent +- hoverEnabled: true ++ hoverEnabled: !root.keypad + onClicked: { root.wakeRequested(); root.forcePasswordFocus() } + onPositionChanged: root.wakeRequested() + } + ++ Item { ++ id: keypadKeys ++ Keys.onPressed: function(event) { ++ if (!numberPad.enabled) return ++ if (event.text.length === 1 && event.text >= "0" && event.text <= "9") numberPad.digit(event.text) ++ else if (event.key === Qt.Key_Backspace) numberPad.backspace() ++ else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) numberPad.enter() ++ else if (event.key === Qt.Key_Escape) root.passwordTextEdited("") ++ else return ++ event.accepted = true ++ } ++ } ++ ++ Keypad { ++ id: numberPad ++ visible: root.keypad ++ enabled: root.inputEnabled && !root.authenticatingPassword ++ anchors.horizontalCenter: parent.horizontalCenter ++ anchors.bottom: parent.bottom ++ anchors.bottomMargin: root.keypadBottomMargin ++ // what is left above it for the field, the hint and a margin ++ maxHeight: parent.height - root.keypadBottomMargin - root.fieldHeight - Style.space(40) ++ - (root.keypadClearsSensor ? keypadHint.height + Style.space(18) : 0) - Style.space(48) ++ onDigit: function(value) { ++ root.wakeRequested() ++ if (root.failureMessage.length > 0) root.clearFailureRequested() ++ root.passwordTextEdited(root.passwordText + value) ++ } ++ onBackspace: { ++ root.wakeRequested() ++ root.passwordTextEdited(root.passwordText.slice(0, -1)) ++ } ++ onEnter: { ++ var submitted = root.passwordText ++ root.passwordTextEdited("") ++ if (submitted.length > 0) root.submitPassword(submitted) ++ } ++ } ++ + BorderSurface { + id: inputField + width: root.fieldWidth + height: root.fieldHeight +- anchors.centerIn: parent ++ anchors.horizontalCenter: parent.horizontalCenter ++ anchors.verticalCenter: root.keypad ? undefined : parent.verticalCenter ++ anchors.bottom: root.keypad ? numberPad.top : undefined ++ anchors.bottomMargin: root.keypad ? Style.space(40) : 0 + color: Commons.Color.lock.background + borderSpec: root.inputBorderSpec + radius: Style.cornerRadius +@@ -141,7 +192,7 @@ Item { + anchors.leftMargin: inputField.borderLeft + 18 + root.fingerprintReserve + verticalAlignment: TextInput.AlignVCenter + horizontalAlignment: TextInput.AlignHCenter +- activeFocusOnPress: true ++ activeFocusOnPress: !root.keypad + clip: true + enabled: root.inputEnabled && !root.authenticatingPassword + readOnly: root.authenticatingPassword +@@ -216,5 +267,23 @@ Item { + verticalAlignment: Text.AlignVCenter + } + } ++ ++ // Touch-only devices with fingerprints: say that either unlocks. ++ Text { ++ id: keypadHint ++ objectName: "keypadFingerprintHint" ++ textFormat: Text.PlainText ++ anchors.bottom: inputField.top ++ anchors.bottomMargin: Style.space(18) ++ anchors.horizontalCenter: inputField.horizontalCenter ++ width: parent.width - Style.space(32) ++ visible: root.keypadClearsSensor ++ text: "Touch the fingerprint sensor or enter your PIN" ++ color: Commons.Color.lock.text ++ font.family: Style.font.family ++ font.pixelSize: Style.font.subtitle ++ wrapMode: Text.WordWrap ++ horizontalAlignment: Text.AlignHCenter ++ } + } + } +diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml +index 65fcb19..95726eb 100644 +--- i/shell/plugins/lock/Service.qml ++++ w/shell/plugins/lock/Service.qml +@@ -23,6 +23,7 @@ Item { + property bool fingerprintAuthenticating: false + property bool passwordPamConfigured: false + property bool fingerprintConfigured: false ++ property bool keypad: false + property bool previewVisible: false + property string enteredPassword: "" + property string pendingPassword: "" +@@ -127,6 +128,7 @@ Item { + } + + function beginLock() { ++ keypadToggle.reload() + if (!passwordPamConfigured) { + logEvent("lock-denied: missing-pam") + return false +@@ -267,6 +269,7 @@ Item { + color: Commons.Color.background + + LockView { ++ keypad: root.keypad + id: lockView + anchors.fill: parent + backgroundPath: root.backgroundPath +@@ -298,6 +301,7 @@ Item { + exclusionMode: ExclusionMode.Ignore + + LockView { ++ keypad: root.keypad + anchors.fill: parent + backgroundPath: root.backgroundPath + backgroundVersion: root.backgroundVersion +@@ -414,7 +418,8 @@ Item { + + Timer { + id: idleBlankTimer +- interval: 5000 ++ // Touch-only devices (the number pad) get longer to find and use it. ++ interval: root.keypad ? 10000 : 5000 + repeat: false + property double armedAt: 0 + onTriggered: { +@@ -482,6 +487,17 @@ Item { + else armBlankTimer() + } + ++ // Touch-only devices opt into the number pad: omarchy-toggle lock-keypad. ++ FileView { ++ id: keypadToggle ++ path: root.stateHome + "/omarchy/toggles/lock-keypad" ++ watchChanges: true ++ printErrors: false ++ onLoaded: root.keypad = true ++ onLoadFailed: root.keypad = false ++ onFileChanged: reload() ++ } ++ + FileView { + path: "/etc/pam.d/omarchy-lock-password" + watchChanges: true diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0005-touch-swipe-the-image-picker-and-hold-the-desktop-for-style.patch b/packages/omamobile-omarchy/legacy-4.0.6/0005-touch-swipe-the-image-picker-and-hold-the-desktop-for-style.patch new file mode 100644 index 000000000..7deb48d2b --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0005-touch-swipe-the-image-picker-and-hold-the-desktop-for-style.patch @@ -0,0 +1,76 @@ +# Touch screens: swipe through the image picker (backgrounds, themes), fit it +# to a narrow screen, and hold the desktop for the Style menu (there is no +# right button or keyboard shortcut on a phone). +# +# Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4) with 0000 (Commons.Color) +# applied: only the context of the picker's size properties differs from +# upstream main. +diff --git i/shell/plugins/background/Background.qml w/shell/plugins/background/Background.qml +index 0a53b20..546aaaf 100644 +--- i/shell/plugins/background/Background.qml ++++ w/shell/plugins/background/Background.qml +@@ -105,6 +105,15 @@ Item { + if (!bgSwitchProc.running) bgSwitchProc.running = true + } + ++ function openStyleMenu() { ++ if (!styleMenuProc.running) styleMenuProc.running = true ++ } ++ ++ Process { ++ id: styleMenuProc ++ command: ["omarchy-menu", "summon", "style"] ++ } ++ + function openThemeSwitcher() { + if (!themeSwitchProc.running) themeSwitchProc.running = true + } +@@ -313,6 +322,10 @@ Item { + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton ++ onPressAndHold: function(mouse) { ++ root.openStyleMenu() ++ mouse.accepted = true ++ } + onDoubleClicked: function(mouse) { + if (mouse.button === Qt.RightButton) root.openThemeSwitcher() + else root.openSelector() +diff --git i/shell/plugins/image-picker/ImagePicker.qml w/shell/plugins/image-picker/ImagePicker.qml +index b0554f5..0f735f6 100644 +--- i/shell/plugins/image-picker/ImagePicker.qml ++++ w/shell/plugins/image-picker/ImagePicker.qml +@@ -39,10 +39,11 @@ Item { + property color scrim: Commons.Color.imagePicker.scrim + property color selectedBorder: Commons.Color.imagePicker.selectedBorder + property color unselectedBorder: Commons.Color.imagePicker.unselectedBorder +- property int expandedWidth: 768 +- property int expandedHeight: 475 ++ // Fit narrow screens (phones): never wider than the window allows. ++ property int expandedWidth: panel.width > 0 ? Math.min(768, panel.width - 96) : 768 ++ property int expandedHeight: Math.round(475 * expandedWidth / 768) + property int sliceWidth: 108 +- property int sliceHeight: 432 ++ property int sliceHeight: Math.round(432 * expandedWidth / 768) + property int sliceSpacing: -30 + property int skewOffset: 28 + property int bottomChromeHeight: showLabels ? (filterable ? 104 : 74) : (filterable ? 60 : 30) +@@ -435,6 +436,18 @@ Item { + + Component.onCompleted: forceActiveFocus() + ++ // Swipe left or right to move through the images on touch screens. ++ DragHandler { ++ target: null ++ yAxis.enabled: false ++ property real swipeX: 0 ++ onActiveTranslationChanged: swipeX = activeTranslation.x ++ onActiveChanged: { ++ if (active) swipeX = 0 ++ else if (Math.abs(swipeX) > 40) root.selectAdjacent(swipeX < 0 ? 1 : -1) ++ } ++ } ++ + Repeater { + model: root.imageArray.length + diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0006-screensaver-restore-the-cursor-and-hide-the-on-screen-keyboard.patch b/packages/omamobile-omarchy/legacy-4.0.6/0006-screensaver-restore-the-cursor-and-hide-the-on-screen-keyboard.patch new file mode 100644 index 000000000..6183995da --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0006-screensaver-restore-the-cursor-and-hide-the-on-screen-keyboard.patch @@ -0,0 +1,158 @@ +# Screensaver on a phone: turn squeekboard off while it runs (it popped up for +# the screensaver's terminal) and back on after, once the lock is up with +# lock-after-screensaver; restore the cursor as it was (a touch device keeps +# it hidden); a tap ends it; waking it goes straight to the lock; make sure +# its window is fullscreen; a user foot config wins. +# +# The launcher turns the keyboard back on from an EXIT trap, so no way out +# of it (an early exit, a signal from the idle service or a shell restart, +# no screensaver coming up) leaves the keyboard off with nothing to restore +# it, and it leaves the setting alone when the session is already locked. +# A phone that found the keyboard off with no screensaver running and the +# marker gone (TOUCH-PLAN 0.5) is what this closes; omamobile-shell's +# omamobile-osk-guard is the safety net behind it. +# +# Against Omarchy 4.0.6 (stable 4.0.6-1). +diff --git i/bin/omarchy-launch-screensaver w/bin/omarchy-launch-screensaver +--- i/bin/omarchy-launch-screensaver ++++ w/bin/omarchy-launch-screensaver +@@ -15,6 +15,32 @@ + fi + + focused=$(omarchy-hyprland-monitor-focused) ++ ++# Touch devices: an on-screen keyboard (squeekboard) pops up for whatever ++# terminal has focus, the screensaver's included. Turn it off; the ++# screensaver turns it back on when it exits (the marker says it should). ++# A locked session leaves it alone: the screensaver can't take focus from ++# the lock and exits at once. ++osk_key="org.gnome.desktop.a11y.applications screen-keyboard-enabled" ++osk_marker="${XDG_RUNTIME_DIR:-/tmp}/omarchy-screensaver-osk-off" ++ ++# Every way out of this launcher (an early exit, a signal from the idle ++# service or a shell restart, no screensaver coming up) turns the keyboard ++# back on, unless a screensaver runs to do it when it exits. ++restore_osk_unless_running() { ++ if [[ -f $osk_marker ]] && ! pgrep -f '[o]rg.omarchy.screensaver' >/dev/null; then ++ rm -f "$osk_marker" ++ gsettings set $osk_key true ++ fi ++} ++ ++if [[ $(omarchy-shell lock isLocked 2>/dev/null) != true ]] && ++ busctl --user status sm.puri.OSK0 &>/dev/null && [[ $(gsettings get $osk_key 2>/dev/null) == true ]]; then ++ trap restore_osk_unless_running EXIT ++ trap 'exit 1' INT TERM HUP ++ touch "$osk_marker" ++ gsettings set $osk_key false ++fi + terminal=$(xdg-terminal-exec --print-id) + + case $terminal in +@@ -64,7 +90,10 @@ + hypr_exec ghostty --class=org.omarchy.screensaver --config-file="$OMARCHY_PATH/default/ghostty/screensaver" --font-size=18 -e omarchy-screensaver + ;; + *foot*) +- hypr_exec foot --app-id=org.omarchy.screensaver --config="$OMARCHY_PATH/default/foot/screensaver.ini" -e omarchy-screensaver ++ # A user copy wins, e.g. a smaller font on a narrow screen. ++ foot_config="$OMARCHY_PATH/default/foot/screensaver.ini" ++ [[ -f ~/.config/foot/screensaver.ini ]] && foot_config=~/.config/foot/screensaver.ini ++ hypr_exec foot --app-id=org.omarchy.screensaver --config="$foot_config" -e omarchy-screensaver + ;; + *kitty*) + hypr_exec kitty --class=org.omarchy.screensaver --override font_size=18 --override window_padding_width=0 -e omarchy-screensaver +diff --git i/bin/omarchy-screensaver w/bin/omarchy-screensaver +--- i/bin/omarchy-screensaver ++++ w/bin/omarchy-screensaver +@@ -6,8 +6,34 @@ + hyprctl activewindow -j | jq -e '.class == "org.omarchy.screensaver"' >/dev/null 2>&1 + } + ++# Put the cursor back the way it was: a touch device keeps it hidden. ++cursor_was_invisible=$(hyprctl getoption cursor:invisible -j 2>/dev/null | jq -r '.bool // (.int == 1)' 2>/dev/null) ++ ++restore_cursor() { ++ if [[ $cursor_was_invisible != true ]]; then ++ hyprctl eval 'hl.config({ cursor = { invisible = false } })' &>/dev/null || hyprctl keyword cursor:invisible false &>/dev/null || true ++ fi ++} ++ ++# Turn the on-screen keyboard back on if omarchy-launch-screensaver turned it off. ++# With lock-after-screensaver, wait until the lock screen is up: until then this ++# terminal still has focus and the keyboard would flash on the way out. ++restore_osk() { ++ local marker="${XDG_RUNTIME_DIR:-/tmp}/omarchy-screensaver-osk-off" ++ [[ -f $marker ]] || return 0 ++ rm -f "$marker" ++ local enable="gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true" ++ if omarchy-toggle-enabled lock-after-screensaver; then ++ # Detached: this script is about to be stopped by the lock. ++ setsid -f bash -c "for _ in \$(seq 50); do omarchy-shell lock status 2>/dev/null | grep -q '\"secure\":true' && break; sleep 0.1; done; $enable" &>/dev/null ++ else ++ $enable &>/dev/null || true ++ fi ++} ++ + exit_screensaver() { +- hyprctl eval 'hl.config({ cursor = { invisible = false } })' &>/dev/null || hyprctl keyword cursor:invisible false &>/dev/null || true ++ restore_cursor ++ restore_osk + pkill -x ttfx 2>/dev/null + pkill -f '[o]rg.omarchy.screensaver' 2>/dev/null + exit 0 +@@ -17,6 +43,9 @@ + trap exit_screensaver SIGINT SIGTERM SIGHUP SIGQUIT + + printf '\033]11;rgb:00/00/00\007' # Set background color to black ++# Report mouse clicks (and touches) as input, so a tap ends the screensaver ++# like a key press does. Turned back off on exit. ++printf '\033[?1000h' + + hyprctl eval 'hl.config({ cursor = { invisible = true } })' &>/dev/null || hyprctl keyword cursor:invisible true &>/dev/null + +@@ -33,6 +62,17 @@ + done + } + ++# The window rule makes the screensaver fullscreen, but a surface that holds ++# focus as it opens (e.g. a launcher being dismissed) can leave it a plain ++# floating window. Make sure, before measuring the terminal. ++ensure_fullscreen() { ++ local window ++ window=$(hyprctl clients -j 2>/dev/null | jq -r '[.[] | select(.class == "org.omarchy.screensaver" and .fullscreen == 0)][0].address // empty') ++ [[ -n $window ]] && hyprctl dispatch "hl.dsp.window.fullscreen({ mode = \"fullscreen\", window = \"address:$window\" })" &>/dev/null ++ return 0 ++} ++ ++ensure_fullscreen + wait_for_terminal_resize + + while true; do +@@ -41,7 +81,26 @@ + --random-effect --no-eol --no-restore-cursor & + + while pgrep -t "${tty#/dev/}" -x ttfx >/dev/null; do +- if read -n1 -t 1 || ! screensaver_in_focus; then ++ if read -n1 -t 1; then ++ # Woken by the user: devices that lock on wake (the ++ # lock-after-screensaver toggle, e.g. phones) go straight to the lock. ++ printf '\033[?1000l' ++ if omarchy-toggle-enabled lock-after-screensaver; then ++ # The lock stops this screensaver itself, before exit_screensaver. ++ restore_cursor ++ restore_osk ++ # Bring the lock up first and let this screensaver stand in front of it ++ # until it's there (it takes a moment to settle); omarchy-system-lock ++ # then stops the screensaver. Otherwise the desktop shows in between. ++ omarchy-shell lock lock >/dev/null 2>&1 ++ for _ in $(seq 30); do ++ omarchy-shell lock status 2>/dev/null | grep -q '"secure":true' && break ++ sleep 0.1 ++ done ++ omarchy-system-lock ++ fi ++ exit_screensaver ++ elif ! screensaver_in_focus; then + exit_screensaver + fi + done diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0007-idle-lock-when-the-user-returns-to-the-screensaver.patch b/packages/omamobile-omarchy/legacy-4.0.6/0007-idle-lock-when-the-user-returns-to-the-screensaver.patch new file mode 100644 index 000000000..4afb85828 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0007-idle-lock-when-the-user-returns-to-the-screensaver.patch @@ -0,0 +1,40 @@ +# Lock as soon as the user returns to the screensaver (lock-after-screensaver). +# Refreshed against Omarchy 4.0.6 (edge 4.0.6-1) so it applies without fuzz; +# the hunk lands where the fuzzed one did, before the main idle monitor. +diff --git i/shell/plugins/services/idle/Service.qml w/shell/plugins/services/idle/Service.qml +index 8fb45a6..d694ab9 100644 +--- i/shell/plugins/services/idle/Service.qml ++++ w/shell/plugins/services/idle/Service.qml +@@ -266,6 +266,32 @@ Item { + // With both timeouts at 0 the monitor stops reporting, so nothing else would end a running cycle. + onIdleTimersEnabledChanged: if (!idleTimersEnabled) cancelIdleCycle("idle-timers-disabled") + ++ // Devices that lock on wake (the lock-after-screensaver toggle, e.g. phones) ++ // lock as soon as the user comes back to the screensaver. Starting the ++ // screensaver counts as activity for the main monitor, so it can't tell; this ++ // one only runs while the screensaver is on screen, goes idle after 2 s, and ++ // its next activity is the user: any tap, swipe or key, even ones the ++ // screensaver's terminal never sees. ++ IdleMonitor { ++ id: screensaverWakeMonitor ++ enabled: root.idleEnabled && root.screensaverWindowCount > 0 ++ timeout: 2 ++ respectInhibitors: false ++ property bool settled: false ++ onEnabledChanged: settled = false ++ onIsIdleChanged: { ++ if (isIdle) { ++ settled = true ++ } else if (settled) { ++ settled = false ++ root.logEvent("screensaver-wake", "user returned") ++ // Lock first and stop the screensaver only once the lock is up, so ++ // the desktop doesn't show in between. ++ root.runProcess(lockProcess, "lock-on-wake", "omarchy-toggle-enabled lock-after-screensaver || exit 0; omarchy-shell lock lock >/dev/null; for _ in $(seq 30); do omarchy-shell lock status | grep -q '\"secure\":true' && break; sleep 0.1; done; omarchy-system-lock") ++ } ++ } ++ } ++ + IdleMonitor { + id: idleMonitor + enabled: root.idleEnabled && root.idleTimersEnabled diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0008-brightness-panels-with-bl-power-follow-dpms.patch b/packages/omamobile-omarchy/legacy-4.0.6/0008-brightness-panels-with-bl-power-follow-dpms.patch new file mode 100644 index 000000000..922444404 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0008-brightness-panels-with-bl-power-follow-dpms.patch @@ -0,0 +1,37 @@ +# Brightness: panels whose backlight driver can power them down follow DPMS +# through bl_power (4 off, 0 on): on the phone, DPMS alone doesn't reach a +# panel run from the bootloader's framebuffer. Only where the user may write +# bl_power (the device package's udev rule). +# +# Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4). +diff --git i/bin/omarchy-brightness-display w/bin/omarchy-brightness-display +index 5a3e534..3c754bb 100755 +--- i/bin/omarchy-brightness-display ++++ w/bin/omarchy-brightness-display +@@ -82,12 +82,26 @@ if (( $# == 0 )); then + exit + fi + ++# Panels whose backlight driver can power them down follow DPMS (bl_power: 4 is ++# off, 0 is on). Phones on a bootloader framebuffer need it: DPMS there doesn't ++# reach the panel. Only where the device lets this user write bl_power. ++panel_power() { ++ local device bl ++ device="$(omarchy-hw-display 2>/dev/null)" || return 0 ++ bl="${OMARCHY_BACKLIGHT_PATH:-/sys/class/backlight}/$device/bl_power" ++ [[ -w $bl ]] && echo "$1" >"$bl" 2>/dev/null ++ return 0 ++} ++ + step="$1" + + if [[ $step == "off" ]]; then + hyprctl dispatch 'hl.dsp.dpms({ action = "disable" })' >/dev/null 2>&1 ++ panel_power 4 + exit 0 + elif [[ $step == "on" ]]; then ++ # Before the check below: Hyprland can show a lit display whose panel is off. ++ panel_power 0 + # Skip the dispatch when every active display is already lit: a redundant + # DPMS enable right after system resume forces another modeset, which blanks + # the panel for a beat (visible flash at the unlock screen). diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0009-lock-ipc-wake-for-hardware-keys.patch b/packages/omamobile-omarchy/legacy-4.0.6/0009-lock-ipc-wake-for-hardware-keys.patch new file mode 100644 index 000000000..1cc9b0d69 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0009-lock-ipc-wake-for-hardware-keys.patch @@ -0,0 +1,24 @@ +# Lock: a "wake" IPC call that lights the locked display and re-arms its +# blank timer, as input on the lock screen does, for hardware keys (the +# phone's power button, through omamobile-keys). +# +# Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4). +diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml +index ccd496a..113b40d 100644 +--- i/shell/plugins/lock/Service.qml ++++ w/shell/plugins/lock/Service.qml +@@ -848,6 +848,14 @@ Item { + return "ok" + } + ++ // Wake the locked display the way input on the lock screen does: light ++ // it and re-arm the blank timer (a phone's power button). ++ function wake(): string { ++ if (!root.currentlyLocked()) return "unlocked" ++ root.runWake() ++ return "ok" ++ } ++ + function isLocked(): string { + return root.currentlyLocked() ? "true" : "false" + } diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0010-polkit-leave-the-on-screen-keyboard-usable.patch b/packages/omamobile-omarchy/legacy-4.0.6/0010-polkit-leave-the-on-screen-keyboard-usable.patch new file mode 100644 index 000000000..419dc7856 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0010-polkit-leave-the-on-screen-keyboard-usable.patch @@ -0,0 +1,63 @@ +# Polkit prompt usable with an on-screen keyboard: on the top layer with +# OnDemand focus and normal exclusion, so squeekboard is drawn above it, gets +# its touches and keeps its reserved area; the field is re-focused after a +# wrong password so the keyboard shows again (FINGERPRINT-PLAN.md). +# +# Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4). +diff --git i/shell/plugins/polkit/PolkitAgent.qml w/shell/plugins/polkit/PolkitAgent.qml +index acd6514c..e98356dd 100644 +--- i/shell/plugins/polkit/PolkitAgent.qml ++++ w/shell/plugins/polkit/PolkitAgent.qml +@@ -103,8 +103,16 @@ Item { + if (!dialogVisible) return + // In fingerprint mode there is no field to type into — park focus on the + // key catcher so Escape still cancels; otherwise focus the password field. +- if (fingerprintMode) keyCatcher.forceActiveFocus() +- else passwordInput.forceActiveFocus() ++ if (fingerprintMode) { ++ keyCatcher.forceActiveFocus() ++ return ++ } ++ // A field that already has focus gets no new focus-in, so the input ++ // method (an on-screen keyboard) is not asked to show again: after a ++ // wrong password the field was read-only for a moment, the keyboard hid, ++ // and tapping the field did not bring it back. Move focus off and back. ++ if (passwordInput.activeFocus) keyCatcher.forceActiveFocus() ++ passwordInput.forceActiveFocus() + } + + function submitResponse() { +@@ -149,7 +157,11 @@ Item { + id: errorTimer + interval: 1200 + repeat: false +- onTriggered: root.errorFlash = false ++ onTriggered: { ++ root.errorFlash = false ++ // writable again: re-focus so an on-screen keyboard shows again ++ Qt.callLater(root.refocus) ++ } + } + + SequentialAnimation { +@@ -225,9 +237,17 @@ Item { + anchors { top: true; bottom: true; left: true; right: true } + color: "transparent" + WlrLayershell.namespace: "omarchy-polkit" +- WlrLayershell.layer: WlrLayer.Overlay +- WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive +- exclusionMode: ExclusionMode.Ignore ++ // Top, not Overlay: an on-screen keyboard (squeekboard) is a top-layer ++ // surface that maps when the field takes focus, after this one, so it is ++ // drawn above the prompt; on the overlay layer the prompt covered it. ++ WlrLayershell.layer: WlrLayer.Top ++ // OnDemand still takes the keyboard when the prompt maps. Exclusive would ++ // also send every touch to this surface, so an on-screen keyboard (a ++ // touch-only device's only way to type the password) could not be used. ++ WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand ++ // Normal: stay out of other surfaces' exclusive zones, such as the area ++ // an on-screen keyboard reserves. ++ exclusionMode: ExclusionMode.Normal + + Rectangle { + anchors.fill: parent diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0011-lock-and-polkit-pin-or-password-input.patch b/packages/omamobile-omarchy/legacy-4.0.6/0011-lock-and-polkit-pin-or-password-input.patch new file mode 100644 index 000000000..acf09eb32 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0011-lock-and-polkit-pin-or-password-input.patch @@ -0,0 +1,305 @@ +# PIN or password, the user's choice (on 0003 and 0010). The lock starts on +# the number pad for a PIN and on the text field with the on-screen keyboard +# for a password (the credential-password toggle); ABC/123 in the field swaps +# them. In pad mode the lock folds squeekboard (sm.puri.OSK0 SetVisible +# false) at lock, after each attempt and on 123, without touching the field, +# its focus or the PIN. The polkit prompt asks squeekboard for its digit +# layout for a PIN, with a 123/ABC switch, and a tap refocuses the field. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), which has 0000's Commons.Color fix: +# with the series, LockView.qml is byte for byte the phone's tested file +# (4c72b5be..., F16b). +diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml +index 53eef73..1f1b3b0 100644 +--- i/shell/plugins/lock/LockView.qml ++++ w/shell/plugins/lock/LockView.qml +@@ -1,5 +1,7 @@ + import QtQuick + import QtQuick.Effects ++import Quickshell ++import Quickshell.Io + import qs.Commons + import qs.Commons as Commons + import qs.Ui +@@ -24,9 +26,18 @@ Item { + // sensor pressed a key. With fingerprints set up, the pad keeps the lower + // third clear, and a hint above the field says either works, as on Android. + readonly property bool keypadClearsSensor: keypad && fingerprintConfigured ++ // A password rather than a PIN (the credential-password toggle): the lock ++ // starts on the text field and the on-screen keyboard instead of the pad. ++ // The ABC/123 switch in the field swaps either way, so a password with ++ // letters and digits can always be typed. ++ property bool passwordFirst: false ++ property bool switchedInput: false ++ readonly property bool padShown: keypad && (passwordFirst === switchedInput) ++ readonly property real inputSwitchReserve: keypad ? Math.round(inputSwitch.implicitWidth + 12) : 0 ++ readonly property real fieldSideReserve: Math.max(fingerprintReserve, inputSwitchReserve) + readonly property int keypadBottomMargin: Math.round(height * (keypadClearsSensor ? 0.34 : 0.08)) + +- readonly property string placeholderText: keypad ? "Enter PIN" : "Enter Password" ++ readonly property string placeholderText: padShown ? "Enter PIN" : "Enter Password" + readonly property int fieldWidth: 381 + readonly property int fieldHeight: 67 + readonly property int outlineThickness: 3 +@@ -62,8 +73,53 @@ Item { + } + + function forcePasswordFocus() { +- if (keypad) keypadKeys.forceActiveFocus() +- else passwordInput.forceActiveFocus() ++ if (padShown) { ++ keypadKeys.forceActiveFocus() ++ return ++ } ++ // A field that already has focus gets no new focus-in, so an on-screen ++ // keyboard that hid (a failed attempt disables the field) is not asked ++ // back. Move focus off and back. ++ if (keypad && passwordInput.activeFocus) keypadKeys.forceActiveFocus() ++ passwordInput.forceActiveFocus() ++ } ++ ++ function switchInput() { ++ switchedInput = !switchedInput ++ wakeRequested() ++ Qt.callLater(forcePasswordFocus) ++ } ++ ++ onAuthenticatingPasswordChanged: { ++ if (!authenticatingPassword && keypad && !padShown) Qt.callLater(forcePasswordFocus) ++ if (!authenticatingPassword && padShown) foldTimer.restart() ++ } ++ ++ // A number-pad lock wants no on-screen keyboard, but one can show over the ++ // lock (it is allowed there for the ABC switch) when the field's input ++ // method wakes up: at lock and after each attempt. Fold it then ++ // (squeekboard's sm.puri.OSK0; harmless without it). Nothing here touches ++ // the field, its focus or the PIN. ++ function foldKeyboard() { ++ Quickshell.execDetached(["busctl", "--user", "call", "sm.puri.OSK0", "/sm/puri/OSK0", ++ "sm.puri.OSK0", "SetVisible", "b", "false"]) ++ } ++ onPadShownChanged: if (padShown) foldTimer.restart() ++ Timer { ++ id: foldTimer ++ interval: 400 ++ // only on a lock taking input (not the style preview's copy) ++ running: root.padShown && root.inputEnabled ++ onTriggered: if (root.padShown && root.inputEnabled) root.foldKeyboard() ++ } ++ ++ FileView { ++ path: Quickshell.env("HOME") + "/.local/state/omarchy/toggles/credential-password" ++ watchChanges: true ++ printErrors: false ++ onLoaded: root.passwordFirst = true ++ onLoadFailed: root.passwordFirst = false ++ onFileChanged: reload() + } + + function clearPassword() { +@@ -144,7 +200,7 @@ Item { + + Keypad { + id: numberPad +- visible: root.keypad ++ visible: root.padShown + enabled: root.inputEnabled && !root.authenticatingPassword + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom +@@ -173,9 +229,14 @@ Item { + width: root.fieldWidth + height: root.fieldHeight + anchors.horizontalCenter: parent.horizontalCenter +- anchors.verticalCenter: root.keypad ? undefined : parent.verticalCenter +- anchors.bottom: root.keypad ? numberPad.top : undefined +- anchors.bottomMargin: root.keypad ? Style.space(40) : 0 ++ // Placed with y, not anchors that come and go: the ABC/123 switch ++ // changes the layout while the lock is up, and a field anchored at both ++ // ends for a moment kept the squashed height. Above the pad; without ++ // it (a password, the on-screen keyboard below) high on the screen; ++ // centred on a computer. ++ y: root.padShown ? numberPad.y - Style.space(40) - height ++ : root.keypad ? Math.round(parent.height * 0.22) ++ : Math.round((parent.height - height) / 2) + color: Commons.Color.lock.background + borderSpec: root.inputBorderSpec + radius: Style.cornerRadius +@@ -187,12 +248,12 @@ Item { + anchors.topMargin: inputField.borderTop + // Reserve the fingerprint icon's width on both sides so the centered + // dots stay symmetric and never slide under the icon as they grow. +- anchors.rightMargin: inputField.borderRight + 18 + root.fingerprintReserve ++ anchors.rightMargin: inputField.borderRight + 18 + root.fieldSideReserve + anchors.bottomMargin: inputField.borderBottom +- anchors.leftMargin: inputField.borderLeft + 18 + root.fingerprintReserve ++ anchors.leftMargin: inputField.borderLeft + 18 + root.fieldSideReserve + verticalAlignment: TextInput.AlignVCenter + horizontalAlignment: TextInput.AlignHCenter +- activeFocusOnPress: !root.keypad ++ activeFocusOnPress: !root.padShown + clip: true + enabled: root.inputEnabled && !root.authenticatingPassword + readOnly: root.authenticatingPassword +@@ -249,6 +310,33 @@ Item { + elide: Text.ElideRight + } + ++ // ABC / 123 on touch-only devices: the number pad or the text field ++ // with the on-screen keyboard. Inside the field's left edge, opposite ++ // the fingerprint icon. ++ Text { ++ id: inputSwitch ++ objectName: "inputSwitch" ++ textFormat: Text.PlainText ++ anchors.left: parent.left ++ anchors.leftMargin: inputField.borderLeft + 18 ++ anchors.verticalCenter: parent.verticalCenter ++ visible: root.keypad ++ text: root.padShown ? "ABC" : "123" ++ color: Commons.Color.lock.text ++ font.family: Style.font.family ++ font.pixelSize: Math.round(root.fieldFontSize * 0.8) ++ font.bold: true ++ ++ MouseArea { ++ // a thumb-sized target around the label ++ anchors.centerIn: parent ++ width: Math.max(parent.width + 24, 56) ++ height: inputField.height ++ enabled: root.inputEnabled && !root.authenticatingPassword ++ onClicked: root.switchInput() ++ } ++ } ++ + // Fingerprint hint pinned inside the field's right edge when a sensor is + // enrolled, so the user knows they can touch to unlock instead of typing. + // Matches hyprlock, which draws its fingerprint icon in the same spot. +@@ -278,7 +366,8 @@ Item { + anchors.horizontalCenter: inputField.horizontalCenter + width: parent.width - Style.space(32) + visible: root.keypadClearsSensor +- text: "Touch the fingerprint sensor or enter your PIN" ++ text: root.padShown ? "Touch the fingerprint sensor or enter your PIN" ++ : "Touch the fingerprint sensor or enter your password" + color: Commons.Color.lock.text + font.family: Style.font.family + font.pixelSize: Style.font.subtitle +diff --git i/shell/plugins/polkit/PolkitAgent.qml w/shell/plugins/polkit/PolkitAgent.qml +index 82c2848..36dc118 100644 +--- i/shell/plugins/polkit/PolkitAgent.qml ++++ w/shell/plugins/polkit/PolkitAgent.qml +@@ -39,6 +39,16 @@ Item { + // to the password even when a sensor is enrolled. Refreshed per request. + property bool laptopClosed: false + property int shakeOffset: 0 ++ // Touch-only devices (the lock-keypad toggle) get a 123/ABC switch by the ++ // field. The field asks the on-screen keyboard for its digit layout when ++ // the credential is a PIN, and its full layout when it is a password (the ++ // credential-password toggle); the switch swaps for this prompt. ++ property bool touchKeypad: false ++ property bool passwordFirst: false ++ property bool switchedInput: false ++ readonly property bool digitsInput: touchKeypad && (passwordFirst === switchedInput) ++ // Omarchy's toggles, where its toggle tools and the lock look ++ readonly property string togglesDir: Quickshell.env("HOME") + "/.local/state/omarchy/toggles" + + readonly property bool dialogVisible: polkitAgent.isActive || closing + // We show one method at a time. Fingerprint owns the dialog while PAM is +@@ -93,6 +103,7 @@ Item { + closeTimer.stop() + closing = false + submitted = false ++ switchedInput = false + passwordInput.text = "" + refreshLidState() + syncFromFlow() +@@ -170,6 +181,24 @@ Item { + NumberAnimation { target: root; property: "shakeOffset"; to: 8; duration: 50; easing.type: Easing.InOutQuad } + NumberAnimation { target: root; property: "shakeOffset"; to: 0; duration: 55; easing.type: Easing.OutQuad } + } ++ FileView { ++ path: root.togglesDir + "/lock-keypad" ++ watchChanges: true ++ printErrors: false ++ onLoaded: root.touchKeypad = true ++ onLoadFailed: root.touchKeypad = false ++ onFileChanged: reload() ++ } ++ ++ FileView { ++ path: root.togglesDir + "/credential-password" ++ watchChanges: true ++ printErrors: false ++ onLoaded: root.passwordFirst = true ++ onLoadFailed: root.passwordFirst = false ++ onFileChanged: reload() ++ } ++ + FileView { + path: "/etc/pam.d/polkit-1" + watchChanges: true +@@ -324,7 +353,7 @@ Item { + } + + Item { +- width: parent.width - Style.space(40) ++ width: parent.width - Style.space(40) - (inputSwitch.visible ? inputSwitch.width + parent.spacing : 0) + height: root.fieldHeight + + TextInput { +@@ -333,6 +362,8 @@ Item { + verticalAlignment: TextInput.AlignVCenter + activeFocusOnPress: true + clip: true ++ // Digits: the on-screen keyboard's number layout for a PIN. ++ inputMethodHints: root.digitsInput ? Qt.ImhDigitsOnly : Qt.ImhNone + selectionColor: Util.alpha(root.accent, 0.45) + selectedTextColor: root.foreground + font.family: root.fontFamily +@@ -357,7 +388,7 @@ Item { + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter +- text: root.errorFlash ? "Wrong" : (root.submitted ? "Checking..." : "Enter password") ++ text: root.errorFlash ? "Wrong" : (root.submitted ? "Checking..." : (root.digitsInput ? "Enter PIN" : "Enter password")) + color: root.errorFlash ? Commons.Color.polkit.textError : root.foreground + opacity: root.errorFlash ? 1 : 0.36 + font.family: root.fontFamily +@@ -379,7 +410,36 @@ Item { + anchors.fill: parent + acceptedButtons: Qt.LeftButton + enabled: passwordInput.visible +- onClicked: passwordInput.forceActiveFocus() ++ // refocus, not just focus: a tap brings a hidden on-screen ++ // keyboard back ++ onClicked: root.refocus() ++ } ++ } ++ ++ // 123 / ABC: which on-screen keyboard layout the field asks for ++ Item { ++ id: inputSwitch ++ visible: root.touchKeypad ++ width: Style.space(44) ++ height: root.fieldHeight ++ ++ Text { ++ anchors.centerIn: parent ++ textFormat: Text.PlainText ++ text: root.digitsInput ? "ABC" : "123" ++ color: root.accent ++ font.family: root.fontFamily ++ font.pixelSize: Style.font.subtitle ++ font.bold: true ++ } ++ ++ MouseArea { ++ anchors.fill: parent ++ onClicked: { ++ root.switchedInput = !root.switchedInput ++ // a new focus-in sends the new content type to the keyboard ++ Qt.callLater(root.refocus) ++ } + } + } + } diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0012-update-hand-omarchy-update-to-the-phone-wrapper.patch b/packages/omamobile-omarchy/legacy-4.0.6/0012-update-hand-omarchy-update-to-the-phone-wrapper.patch new file mode 100644 index 000000000..889da8840 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0012-update-hand-omarchy-update-to-the-phone-wrapper.patch @@ -0,0 +1,30 @@ +# Phone only, not for upstream: "omarchy update" hands over to omamobile-update +# (packages/omamobile-omarchy), which runs this same script back with +# OMAMOBILE_UPDATE=1 and Omarchy's own steps, minus the ones that don't belong +# on a phone (Snapper, the AUR, the kernel-reboot prompt and orphan removal, +# which ask through gum) and with boot-related migrations held for review. So +# the command AGENTS.md tells people to use, the menu's Update > Omarchy and +# the bar's update button all take the phone's path. The patch is re-applied +# after every Omarchy upgrade like the rest of the series; when it can't be, +# Omarchy's update runs unwrapped, as before. Escape hatch: +# OMAMOBILE_UPDATE=1 omarchy-update. +# +# Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4). +diff --git i/bin/omarchy-update w/bin/omarchy-update +--- i/bin/omarchy-update ++++ w/bin/omarchy-update +@@ -7,6 +7,14 @@ + + set -e + ++# Omarchy Mobile: a phone updates through omamobile-update, which runs this ++# same flow with the phone's exclusions (no snapshot, AUR or reboot prompt; ++# boot-related migrations held) and reports to the shell's update sheet. It ++# calls back in with OMAMOBILE_UPDATE=1. ++if [[ -z ${OMAMOBILE_UPDATE:-} && -x /usr/bin/omamobile-update ]]; then ++ exec /usr/bin/omamobile-update "$@" ++fi ++ + if [[ -z ${OMARCHY_UPDATE_LOGGED:-} ]]; then + script_command=$(printf '%q ' "$0" "$@") + exec env OMARCHY_UPDATE_LOGGED=1 script -qefc "$script_command" "/tmp/omarchy-update.log" diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0013-idle-wake-a-locked-display-through-the-lock.patch b/packages/omamobile-omarchy/legacy-4.0.6/0013-idle-wake-a-locked-display-through-the-lock.patch new file mode 100644 index 000000000..0fe310e1f --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0013-idle-wake-a-locked-display-through-the-lock.patch @@ -0,0 +1,20 @@ +# Idle: activity that ends an idle cycle wakes a locked display through the +# lock (the wake IPC from 0009), so its blank timer runs again. Lit by +# omarchy-system-wake alone, the panel stayed on behind the lock until the +# next unlock: a day of a lit screen on the phone. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0007. +diff --git i/shell/plugins/services/idle/Service.qml w/shell/plugins/services/idle/Service.qml +--- i/shell/plugins/services/idle/Service.qml ++++ w/shell/plugins/services/idle/Service.qml +@@ -119,7 +119,9 @@ + lockTimer.stop() + screensaverLaunchGraceTimer.stop() + +- if (root.idledThisCycle) runProcess(wakeProcess, "wake", "omarchy-system-wake") ++ // A locked display is lit through the lock, which re-arms its blank timer; ++ // lit here alone, it stayed on behind the lock until the next unlock. ++ if (root.idledThisCycle) runProcess(wakeProcess, "wake", "[[ $(omarchy-shell lock wake 2>/dev/null) == ok ]] || omarchy-system-wake") + + root.idledThisCycle = false + root.screensaverStartedThisCycle = false diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0014-lock-emergency-call-button-for-touch-devices.patch b/packages/omamobile-omarchy/legacy-4.0.6/0014-lock-emergency-call-button-for-touch-devices.patch new file mode 100644 index 000000000..1e715673d --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0014-lock-emergency-call-button-for-touch-devices.patch @@ -0,0 +1,54 @@ +# Lock: an "Emergency call" button on touch-only devices, under the number +# pad (or the field), as every phone's lock screen has. It asks the phone +# shell's call plugin (omamobile.call) to show what an emergency call can +# do on this phone, over the lock; until emergency calling is tested on a +# carrier (TELEPHONY-APPS-PLAN §3.3) that is the warning that it doesn't +# work yet, never a dialpad. The lock stays as it is. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003 and 0011. +diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml +--- i/shell/plugins/lock/LockView.qml ++++ w/shell/plugins/lock/LockView.qml +@@ -374,5 +374,42 @@ + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + } ++ ++ // Touch-only devices (phones): "Emergency call", under the number pad ++ // or the field. It asks the phone shell's call plugin (omamobile.call) ++ // to show what an emergency call can do on this phone, over the lock; ++ // the lock itself stays as it is. Without that plugin the call does ++ // nothing. ++ Item { ++ id: emergencyButton ++ objectName: "lockEmergencyCall" ++ visible: root.keypad ++ anchors.horizontalCenter: parent.horizontalCenter ++ anchors.top: numberPad.visible ? numberPad.bottom : inputField.bottom ++ anchors.topMargin: Style.space(20) ++ width: emergencyLabel.implicitWidth + Style.space(40) ++ height: Math.max(Style.space(44), emergencyLabel.implicitHeight + Style.space(16)) ++ ++ Text { ++ id: emergencyLabel ++ anchors.centerIn: parent ++ textFormat: Text.PlainText ++ text: "Emergency call" ++ color: Commons.Color.lock.text ++ opacity: emergencyTap.pressed ? 0.6 : 0.9 ++ font.family: Style.font.family ++ font.pixelSize: Style.font.subtitle ++ font.bold: true ++ } ++ ++ MouseArea { ++ id: emergencyTap ++ anchors.fill: parent ++ onClicked: { ++ root.wakeRequested() ++ Quickshell.execDetached(["omarchy-shell", "shell", "call", "omamobile.call", "emergency", ""]) ++ } ++ } ++ } + } + } diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0015-notifications-inline-reply.patch b/packages/omamobile-omarchy/legacy-4.0.6/0015-notifications-inline-reply.patch new file mode 100644 index 000000000..89ec9a5f9 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0015-notifications-inline-reply.patch @@ -0,0 +1,232 @@ +# Notifications: inline reply (the freedesktop `inline-reply` action and +# NotificationReplied signal, which Quickshell implements). The server +# advertises it, and a toast whose sender asked for it gets a Reply button +# that opens a field with Send and Cancel; Send hands the text to the sender +# and dismisses the toast. While a field is open the toast's countdown stops +# and the toast surface takes keyboard focus on demand, so an on-screen +# keyboard can type into it. Stored history rows can't be answered and get +# no button. Messages apps use it to reply to a text without opening the +# app (TELEPHONY-APPS-PLAN §7.2). +# +# Against Omarchy 4.0.6 (edge 4.0.6-1). +diff --git i/shell/plugins/notifications/Service.qml w/shell/plugins/notifications/Service.qml +--- i/shell/plugins/notifications/Service.qml ++++ w/shell/plugins/notifications/Service.qml +@@ -314,6 +314,52 @@ Item { + removePopup(index, "dismiss") + } + ++ // The live notification behind a popup row, or null. A restored row has ++ // none (see removePopup). ++ function liveRefAt(index) { ++ if (index < 0 || index >= popupModel.count) return null ++ var entry = popupModel.get(index) ++ if (!entry || entry.originalId < 0 || isRestoredRow(entry)) return null ++ var ref = liveRefs[entry.originalId] ++ try { ++ return ref && ref.tracked ? ref : null ++ } catch (e) { ++ return null ++ } ++ } ++ ++ // The reply field's placeholder for a popup whose sender asked for an ++ // inline reply, or "" when it can't take one. ++ function replyPlaceholderAt(index) { ++ var ref = liveRefAt(index) ++ if (!ref || !ref.hasInlineReply) return "" ++ return String(ref.inlineReplyPlaceholder || "") || "Reply" ++ } ++ ++ // Popups with the reply field open. While any is, the popup surface takes ++ // keyboard focus so the field can be typed into. ++ property int openReplies: 0 ++ ++ // Send the reply to its sender (NotificationReplied), then take the toast ++ // off the screen. A sender that has meanwhile closed the notification ++ // gets nothing; the popup opens its app instead, so the reply isn't lost ++ // silently. ++ function sendReply(index, text) { ++ var ref = liveRefAt(index) ++ if (!ref || !ref.hasInlineReply) { ++ invokePopupDefault(index) ++ return ++ } ++ try { ++ ref.sendInlineReply(text) ++ } catch (e) { ++ console.warn("inline reply failed:", e) ++ invokePopupDefault(index) ++ return ++ } ++ dismissPopup(index) ++ } ++ + function expirePopup(index) { + removePopup(index, "expire") + } +@@ -936,6 +982,7 @@ Item { + bodyMarkupSupported: true + bodyHyperlinksSupported: true + persistenceSupported: true ++ inlineReplySupported: true + + onNotification: function(notification) { + service.handleNotification(notification) +@@ -960,7 +1007,9 @@ Item { + + WlrLayershell.namespace: "omarchy-notifications" + WlrLayershell.layer: WlrLayer.Overlay +- WlrLayershell.keyboardFocus: WlrKeyboardFocus.None ++ // Passive, except while a reply field is open (OnDemand, as the ++ // polkit prompt uses, so an on-screen keyboard can type into it). ++ WlrLayershell.keyboardFocus: service.openReplies > 0 ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None + exclusionMode: ExclusionMode.Ignore + color: "transparent" + +@@ -1012,7 +1061,19 @@ Item { + + readonly property real lifetime: service.durationFor(cardSlot.urgency, cardSlot.expireTimeout) + property real remainingLifetime: 1.0 +- readonly property bool ticking: cardSlot.lifetime > 0 && !card.hovered ++ readonly property bool ticking: cardSlot.lifetime > 0 && !card.hovered && !cardSlot.replying ++ ++ // Inline reply. The placeholder is looked up again whenever the ++ // row's content changes, as an update can add or drop the action. ++ readonly property string replyPlaceholder: { ++ cardSlot.summary ++ cardSlot.body ++ return service.replyPlaceholderAt(cardSlot.index) ++ } ++ property bool replying: false ++ onReplyingChanged: service.openReplies += replying ? 1 : -1 ++ onReplyPlaceholderChanged: if (replyPlaceholder.length === 0) replying = false ++ Component.onDestruction: if (replying) service.openReplies -= 1 + + // A client updating this notification in place rewrites the row + // under the card (see refreshPopup). New text deserves a full look, +@@ -1052,8 +1113,22 @@ Item { + fontFamily: service.shell && service.shell.bar ? service.shell.bar.fontFamily : "" + glyph: cardSlot.glyph + ++ replyPlaceholder: cardSlot.replyPlaceholder ++ replying: cardSlot.replying ++ + onCloseRequested: service.dismissPopup(cardSlot.index) + onCardClicked: service.invokePopupDefault(cardSlot.index) ++ onReplyRequested: cardSlot.replying = true ++ onReplyCancelled: { ++ cardSlot.replying = false ++ // A fresh countdown, so the toast doesn't vanish the ++ // moment the field closes. ++ cardSlot.remainingLifetime = 1.0 ++ } ++ onReplySent: function(text) { ++ cardSlot.replying = false ++ service.sendReply(cardSlot.index, text) ++ } + } + } + } +diff --git i/shell/plugins/notifications/components/NotificationCard.qml w/shell/plugins/notifications/components/NotificationCard.qml +--- i/shell/plugins/notifications/components/NotificationCard.qml ++++ w/shell/plugins/notifications/components/NotificationCard.qml +@@ -33,8 +33,33 @@ BorderSurface { + + readonly property bool hovered: hoverTracker.hovered + ++ // Inline reply (the freedesktop `inline-reply` action): the popup container ++ // sets the sender's placeholder text while the live notification takes a ++ // reply. The history panel leaves it empty: a stored notification can't be ++ // answered. ++ property string replyPlaceholder: "" ++ // The reply field is open. The container keeps the toast on screen and ++ // gives its surface keyboard focus meanwhile. ++ property bool replying: false ++ + signal closeRequested() + signal cardClicked() ++ signal replyRequested() ++ signal replySent(string text) ++ signal replyCancelled() ++ ++ function sendReply() { ++ var text = replyField.text ++ if (text.trim().length === 0) return ++ root.replySent(text) ++ } ++ ++ // A field that opens gets focus, so an on-screen keyboard shows; one that ++ // closes forgets what was typed. ++ onReplyingChanged: { ++ if (replying) Qt.callLater(function() { replyField.forceActiveFocus() }) ++ else replyField.text = "" ++ } + // Prefer per-notification media/avatar data, then fall back to the app icon. + // The `check` flag avoids Qt's missing-texture placeholder for unknown names. + readonly property string smallIconSource: image.length > 0 ? image : iconSource(appIcon) +@@ -82,7 +107,9 @@ BorderSurface { + onClicked: function(mouse) { + if (mouse.button === Qt.RightButton) { + root.closeRequested() +- } else { ++ } else if (!root.replying) { ++ // A tap beside the open reply field must not open the app and ++ // throw the reply away. + root.cardClicked() + } + } +@@ -192,6 +219,53 @@ BorderSurface { + } + } + } ++ ++ // Reply, then a field with Send and Cancel, each tall enough to tap on ++ // a touch screen. ++ RowLayout { ++ id: replyRow ++ readonly property real controlHeight: Style.space(40) ++ Layout.fillWidth: true ++ Layout.leftMargin: Style.space(12) ++ Layout.rightMargin: Style.space(12) ++ Layout.bottomMargin: Style.space(10) ++ visible: root.replyPlaceholder.length > 0 ++ spacing: Style.space(8) ++ ++ TextField { ++ id: replyField ++ objectName: "notificationReplyField" ++ Layout.fillWidth: true ++ visible: root.replying ++ Layout.preferredHeight: replyRow.controlHeight ++ placeholderText: root.replyPlaceholder ++ foreground: Commons.Color.notifications.text ++ onAccepted: root.sendReply() ++ Keys.onEscapePressed: root.replyCancelled() ++ } ++ ++ Item { ++ Layout.fillWidth: true ++ visible: !root.replying ++ } ++ ++ Button { ++ visible: root.replying ++ text: "Cancel" ++ Layout.preferredHeight: replyRow.controlHeight ++ foreground: Commons.Color.notifications.text ++ onClicked: root.replyCancelled() ++ } ++ ++ Button { ++ objectName: "notificationReplyButton" ++ Layout.preferredHeight: replyRow.controlHeight ++ text: root.replying ? "Send" : "Reply" ++ bordered: true ++ foreground: Commons.Color.notifications.text ++ onClicked: root.replying ? root.sendReply() : root.replyRequested() ++ } ++ } + } + + } diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0016-pacman-a-phone-refuses-the-channel-switch-and-pacman-refresh.patch b/packages/omamobile-omarchy/legacy-4.0.6/0016-pacman-a-phone-refuses-the-channel-switch-and-pacman-refresh.patch new file mode 100644 index 000000000..726b6c144 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0016-pacman-a-phone-refuses-the-channel-switch-and-pacman-refresh.patch @@ -0,0 +1,50 @@ +# Phone only, not for upstream: omarchy-channel-set and omarchy-refresh-pacman +# refuse on a phone and point at RELEASES.md section 5.4. Both copy Omarchy's +# x86_64 pacman.conf and mirrorlist over the phone's (no [omamobile], no Arch +# Linux ARM) and then upgrade everything from them; the menu offers that as +# Update > Channel, and omarchy-reinstall-pkgs calls the refresh too +# (TOUCH-PLAN 0.2). omamobile-update, which this package installs, is the +# phone's test, as in 0012. omamobile-setup-user hides Update > Channel too; +# this keeps a terminal from doing the same. +# +# Against Omarchy 4.0.6 (stable 4.0.6-1). +diff --git i/bin/omarchy-channel-set w/bin/omarchy-channel-set +--- i/bin/omarchy-channel-set ++++ w/bin/omarchy-channel-set +@@ -6,6 +6,16 @@ + + set -euo pipefail + ++# Omarchy Mobile: a phone's pacman.conf carries [omamobile] and Arch Linux ++# ARM, which the channel's x86_64 pacman.conf (omarchy-refresh-pacman) drops. ++if [[ -x /usr/bin/omamobile-update ]]; then ++ echo "omarchy-channel-set: not on an Omarchy Mobile phone. It would replace this phone's" >&2 ++ echo "pacman.conf with Omarchy's x86_64 one (no [omamobile], no Arch Linux ARM) and upgrade" >&2 ++ echo "everything from it. The phone follows Omarchy's stable channel; update it with" >&2 ++ echo "'omarchy update'. See docs/RELEASES.md section 5.4 in derekross/omarchy-mobile." >&2 ++ exit 1 ++fi ++ + usage() { echo "Usage: omarchy-channel-set [stable|rc|edge|dev]"; } + fail() { echo "Error: $*" >&2; exit 1; } + +diff --git i/bin/omarchy-refresh-pacman w/bin/omarchy-refresh-pacman +--- i/bin/omarchy-refresh-pacman ++++ w/bin/omarchy-refresh-pacman +@@ -3,6 +3,16 @@ + # omarchy:summary=Overwrite the package configuration for /etc/pacman with the Omarchy default of using its dedicated mirrors and repositories, then update all packages. + # omarchy:requires-sudo=true + ++# Omarchy Mobile: a phone's pacman.conf carries [omamobile] and Arch Linux ++# ARM, which Omarchy's x86_64 pacman.conf and mirrorlist would replace. ++if [[ -x /usr/bin/omamobile-update ]]; then ++ echo "omarchy-refresh-pacman: not on an Omarchy Mobile phone. It would replace this phone's" >&2 ++ echo "pacman.conf and mirrorlist with Omarchy's x86_64 ones (no [omamobile], no Arch Linux" >&2 ++ echo "ARM) and upgrade everything from them. Update the phone with 'omarchy update'." >&2 ++ echo "See docs/RELEASES.md section 5.4 in derekross/omarchy-mobile." >&2 ++ exit 1 ++fi ++ + sudo cp -f /etc/pacman.conf /etc/pacman.conf.bak + sudo cp -f /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak + diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0017-notifications-swipe-to-dismiss-and-a-touch-close-button.patch b/packages/omamobile-omarchy/legacy-4.0.6/0017-notifications-swipe-to-dismiss-and-a-touch-close-button.patch new file mode 100644 index 000000000..cd2462d33 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0017-notifications-swipe-to-dismiss-and-a-touch-close-button.patch @@ -0,0 +1,261 @@ +# Notifications: swipe to dismiss, and a close button on touch screens. On a +# touch screen a tap runs the toast's default action and there is no right +# button, so a toast could only be got rid of by letting it launch something, +# and a critical one (Omarchy's first-run invitations) never expires. A +# sideways swipe now moves the card with the finger: let go past 35% of its +# width, or flick it, and it flies off that side and closes as a right-click +# does; short of that it springs back. The drag starts only past a threshold, +# so a tap still runs the default action, and it is off while a reply is +# being typed. When Hyprland lists a touch screen, each toast also gets a +# close glyph with a 44 px target in its top-right corner; a seat with only a +# mouse shows none, so desktops look as before. Hover pauses the countdown +# for a mouse or stylus only (a finger doesn't hover), and a card being +# swiped doesn't expire under the finger. Right-click still closes. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1) with 0015 (inline reply) applied. +diff --git i/shell/plugins/notifications/Service.qml w/shell/plugins/notifications/Service.qml +--- i/shell/plugins/notifications/Service.qml ++++ w/shell/plugins/notifications/Service.qml +@@ -455,6 +455,29 @@ + + Process { id: focusAppProc; running: false } + ++ // Whether the seat has a touch screen, asked of Hyprland once at startup. ++ // Toasts then show a close button: a tap runs the default action, and a ++ // finger has no right button to dismiss with. A seat with only a mouse ++ // keeps the toasts as they were. ++ property bool touchScreen: false ++ ++ Process { ++ id: touchScreenProc ++ command: ["hyprctl", "-j", "devices"] ++ running: false ++ stdout: StdioCollector { ++ waitForEnd: true ++ onStreamFinished: { ++ try { ++ var touch = JSON.parse(text || "{}").touch ++ service.touchScreen = Array.isArray(touch) && touch.length > 0 ++ } catch (e) { ++ service.touchScreen = false ++ } ++ } ++ } ++ } ++ + Process { + id: ensureDirsProc + command: ["mkdir", "-p", service.stateDir, service.popupStateDir, service.historyDir, service.imagesDir] +@@ -880,6 +903,7 @@ + + Component.onCompleted: { + ensureDirsProc.running = true ++ touchScreenProc.running = true + // Once mkdir has had a tick, load the existing settings file. FileView + // surfaces an empty string when the file doesn't exist; loadSettings + // handles that path. +@@ -1061,7 +1085,7 @@ + + readonly property real lifetime: service.durationFor(cardSlot.urgency, cardSlot.expireTimeout) + property real remainingLifetime: 1.0 +- readonly property bool ticking: cardSlot.lifetime > 0 && !card.hovered && !cardSlot.replying ++ readonly property bool ticking: cardSlot.lifetime > 0 && !card.held && !cardSlot.replying + + // Inline reply. The placeholder is looked up again whenever the + // row's content changes, as an update can add or drop the action. +@@ -1115,6 +1139,7 @@ + + replyPlaceholder: cardSlot.replyPlaceholder + replying: cardSlot.replying ++ closeButtonShown: service.touchScreen + + onCloseRequested: service.dismissPopup(cardSlot.index) + onCardClicked: service.invokePopupDefault(cardSlot.index) +diff --git i/shell/plugins/notifications/components/NotificationCard.qml w/shell/plugins/notifications/components/NotificationCard.qml +--- i/shell/plugins/notifications/components/NotificationCard.qml ++++ w/shell/plugins/notifications/components/NotificationCard.qml +@@ -32,6 +32,22 @@ + property string fontFamily: "" + + readonly property bool hovered: hoverTracker.hovered ++ // The card is under the user's hand: a mouse over it, or a finger ++ // swiping it. The popup container pauses the countdown meanwhile. ++ readonly property bool held: hovered || swipeHandler.active ++ ++ // Touch: a horizontal swipe dismisses (swipeEnabled), and a close button ++ // shows in the top-right corner (closeButtonShown), as a tap runs the ++ // default action and a touch screen has no right button. The container ++ // shows the button when the seat has a touch screen, so a mouse-only ++ // desktop looks and behaves as before. ++ property bool swipeEnabled: true ++ property bool closeButtonShown: false ++ // How far the card has been swiped sideways, in pixels. ++ property real swipeOffset: 0 ++ // Release speed of the last swipe, pixels per second. ++ property real swipeVelocity: 0 ++ property bool dismissing: false + + // Inline reply (the freedesktop `inline-reply` action): the popup container + // sets the sender's placeholder text while the live notification takes a +@@ -77,6 +93,23 @@ + readonly property color accentColor: urgency === 2 ? Commons.Color.urgent : (urgency === 0 ? dimColor : Commons.Color.notifications.countdown) + readonly property var cardBorderSpec: Border.surfaceSpec("notifications", "border", Commons.Color.notifications.border, Math.max(1, Style.space(2))) + ++ // A swipe ends: past 35% of the width, or flicked fast enough the same ++ // way, the card flies off that side and closes; otherwise it springs back. ++ function finishSwipe() { ++ var distance = Math.abs(root.swipeOffset) ++ var sameWay = root.swipeVelocity * root.swipeOffset > 0 ++ var flung = sameWay && Math.abs(root.swipeVelocity) >= Style.space(900) && distance >= root.width * 0.1 ++ if (root.width > 0 && (distance >= root.width * 0.35 || flung)) { ++ root.dismissing = true ++ swipeAnimation.to = (root.swipeOffset < 0 ? -1 : 1) * (root.width + Style.space(24)) ++ swipeAnimation.dismiss = true ++ } else { ++ swipeAnimation.to = 0 ++ swipeAnimation.dismiss = false ++ } ++ swipeAnimation.restart() ++ } ++ + function sanitizeBody(s) { + return NotificationLogic.sanitizeBody(s, app, appIcon) + } +@@ -92,13 +125,23 @@ + implicitWidth: Style.space(380) + // Add vertical border insets so mainColumn (inset by border on top/left/right) + // doesn't push content under the bottom edge. +- implicitHeight: mainColumn.implicitHeight + borderTop + borderBottom ++ implicitHeight: Math.max(mainColumn.implicitHeight, closeButtonShown ? closeButton.height : 0) + borderTop + borderBottom + radius: cornerRadius + color: Commons.Color.notifications.background + borderSpec: cardBorderSpec + clip: true + +- HoverHandler { id: hoverTracker } ++ // The swipe moves the card sideways and fades it as it goes. ++ transform: Translate { x: root.swipeOffset } ++ opacity: 1 - 0.6 * Math.min(1, Math.abs(root.swipeOffset) / Math.max(1, root.width)) ++ ++ // A mouse or stylus resting on the card pauses its countdown. A finger ++ // doesn't hover, so touch is left out: a toast that was touched must not ++ // count as hovered and stop expiring. ++ HoverHandler { ++ id: hoverTracker ++ acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad | PointerDevice.Stylus ++ } + + MouseArea { + anchors.fill: parent +@@ -115,6 +158,61 @@ + } + } + ++ // Swipe to dismiss. Only sideways movement past the threshold starts it, ++ // so a tap still runs the default action and a right-click still closes. ++ // Off while a reply is being typed, so selecting text can't throw the ++ // reply away. ++ DragHandler { ++ id: swipeHandler ++ target: null ++ yAxis.enabled: false ++ dragThreshold: Style.space(12) ++ enabled: root.swipeEnabled && !root.replying && !root.dismissing ++ onActiveChanged: { ++ if (active) { ++ swipeAnimation.stop() ++ root.swipeVelocity = 0 ++ } else { ++ root.finishSwipe() ++ } ++ } ++ onActiveTranslationChanged: { ++ if (!active) return ++ root.swipeOffset = activeTranslation.x ++ root.swipeVelocity = centroid.velocity.x ++ } ++ } ++ ++ SequentialAnimation { ++ id: swipeAnimation ++ property real to: 0 ++ property bool dismiss: false ++ NumberAnimation { ++ target: root ++ property: "swipeOffset" ++ to: swipeAnimation.to ++ duration: swipeAnimation.dismiss ? 140 : 200 ++ easing.type: swipeAnimation.dismiss ? Easing.InQuad : Easing.OutBack ++ } ++ ScriptAction { ++ script: { ++ if (!swipeAnimation.dismiss) return ++ root.closeRequested() ++ // A container that keeps the card (nothing removes it) gets it back. ++ swipeResetTimer.restart() ++ } ++ } ++ } ++ ++ Timer { ++ id: swipeResetTimer ++ interval: 400 ++ onTriggered: { ++ root.dismissing = false ++ root.swipeOffset = 0 ++ } ++ } ++ + ColumnLayout { + id: mainColumn + // Inset by the card border so the content doesn't paint over the card's +@@ -131,7 +229,8 @@ + RowLayout { + Layout.fillWidth: true + Layout.leftMargin: Style.space(12) +- Layout.rightMargin: Style.space(12) ++ // Text stays clear of the close button's touch target. ++ Layout.rightMargin: root.closeButtonShown ? closeButton.width : Style.space(12) + Layout.topMargin: root.singleLineToast ? Style.space(7) : Style.space(10) + Layout.bottomMargin: root.singleLineToast ? Style.space(7) : Style.space(10) + spacing: root.collapseRedundantIcon ? 0 : (root.compactGlyph ? Style.space(8) : Style.space(12)) +@@ -268,4 +367,39 @@ + } + } + ++ // Close button: a small glyph with a 44 px touch target in the top-right ++ // corner, inside the border. ++ MouseArea { ++ id: closeButton ++ objectName: "notificationCloseButton" ++ visible: root.closeButtonShown ++ anchors.top: parent.top ++ anchors.right: parent.right ++ anchors.topMargin: root.borderTop ++ anchors.rightMargin: root.borderRight ++ width: Style.space(44) ++ height: Style.space(44) ++ cursorShape: Qt.PointingHandCursor ++ Accessible.role: Accessible.Button ++ Accessible.name: "Dismiss notification" ++ onClicked: root.closeRequested() ++ ++ Rectangle { ++ anchors.centerIn: parent ++ width: Style.space(28) ++ height: width ++ radius: width / 2 ++ color: Commons.Color.notifications.text ++ opacity: closeButton.pressed ? 0.18 : 0 ++ } ++ ++ Text { ++ textFormat: Text.PlainText ++ anchors.centerIn: parent ++ text: "󰅖" ++ color: root.dimColor ++ font.family: root.fontFamily ++ font.pixelSize: Style.font.icon ++ } ++ } + } diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0018-menu-a-back-button-and-swipe-right-to-go-back.patch b/packages/omamobile-omarchy/legacy-4.0.6/0018-menu-a-back-button-and-swipe-right-to-go-back.patch new file mode 100644 index 000000000..410f8cf80 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0018-menu-a-back-button-and-swipe-right-to-go-back.patch @@ -0,0 +1,113 @@ +# Menu: a back button in the header and swipe right to go back. Below the +# top level, going up was Backspace, Left or Escape-and-reopen, none of which +# a touch screen has. The header now shows a chevron (a 44 px target) that +# calls goBack(), and a swipe right on the card does the same: the card +# follows the finger at half speed and goes back once the finger has +# travelled a quarter of its width (at least 64 px) or flicks. The drag +# starts only past a threshold and only sideways, and not while the list +# scrolls, so taps still pick rows and vertical scrolling is untouched. +# Neither shows nor acts at the top level, in dmenu mode or while the +# uninstall question is open. The keys work as before. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), before the menu-first-frame bridge. +diff --git i/shell/plugins/menu/Menu.qml w/shell/plugins/menu/Menu.qml +--- i/shell/plugins/menu/Menu.qml ++++ w/shell/plugins/menu/Menu.qml +@@ -1066,6 +1066,50 @@ + + MouseArea { anchors.fill: parent; onClicked: {} } + ++ // Touch back: a swipe right on the card goes up a level, as Backspace ++ // does. Only sideways movement past the threshold starts it, so a ++ // tap still picks a row, and a list that is scrolling keeps the ++ // finger. ++ readonly property bool canGoBack: root.activeMenu !== "root" && !root.dmenuActive && !root.deleteConfirmOpen ++ property real swipeOffset: 0 ++ property real swipeVelocity: 0 ++ transform: Translate { x: card.swipeOffset } ++ ++ DragHandler { ++ id: backSwipe ++ target: null ++ yAxis.enabled: false ++ dragThreshold: Style.space(12) ++ enabled: card.canGoBack && !resultList.moving ++ onActiveChanged: { ++ if (active) { ++ backSwipeSettle.stop() ++ card.swipeVelocity = 0 ++ return ++ } ++ // The finger's travel (the card follows at half speed). ++ var distance = card.swipeOffset * 2 ++ var flung = card.swipeVelocity >= Style.space(900) && distance >= Style.space(24) ++ if (distance >= Math.max(Style.space(64), card.width * 0.25) || flung) root.goBack() ++ backSwipeSettle.restart() ++ } ++ onActiveTranslationChanged: { ++ if (!active) return ++ // The card follows the finger at half speed, and only rightwards. ++ card.swipeOffset = Math.max(0, activeTranslation.x) / 2 ++ card.swipeVelocity = centroid.velocity.x ++ } ++ } ++ ++ NumberAnimation { ++ id: backSwipeSettle ++ target: card ++ property: "swipeOffset" ++ to: 0 ++ duration: 160 ++ easing.type: Easing.OutCubic ++ } ++ + Item { + id: keyCatcher + anchors.fill: parent +@@ -1151,9 +1195,46 @@ + radius: root.cornerRadius + color: "transparent" + ++ // Back, for touch: shown below the top level, does what ++ // Backspace does. A 44 px target, overhanging the header's ++ // height into the margins around it. ++ MouseArea { ++ id: backButton ++ objectName: "menuBackButton" ++ visible: card.canGoBack ++ anchors.left: parent.left ++ anchors.verticalCenter: parent.verticalCenter ++ width: Style.space(44) ++ height: Math.max(parent.height, Style.space(44)) ++ hoverEnabled: true ++ cursorShape: Qt.PointingHandCursor ++ Accessible.role: Accessible.Button ++ Accessible.name: "Back" ++ onClicked: root.goBack() ++ ++ Rectangle { ++ anchors.centerIn: parent ++ width: Style.space(32) ++ height: width ++ radius: root.cornerRadius ++ color: root.selectedBackground ++ opacity: backButton.pressed ? 0.9 : (backButton.containsMouse ? 0.5 : 0) ++ } ++ ++ Text { ++ textFormat: Text.PlainText ++ anchors.centerIn: parent ++ text: "󰅁" ++ color: root.foreground ++ font.family: root.fontFamily ++ font.pixelSize: Style.font.heading ++ } ++ } ++ + Text { + textFormat: Text.PlainText + anchors.left: parent.left ++ anchors.leftMargin: backButton.visible ? backButton.width : 0 + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + text: root.filterText || (root.dmenuActive ? (root.dmenuPrompt + "…") : ((root.item(root.activeMenu) ? (root.item(root.activeMenu).title || root.item(root.activeMenu).label) : "Go") + "…")) diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0019-notifications-forget-one-notification-by-ipc.patch b/packages/omamobile-omarchy/legacy-4.0.6/0019-notifications-forget-one-notification-by-ipc.patch new file mode 100644 index 000000000..e718492ef --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0019-notifications-forget-one-notification-by-ipc.patch @@ -0,0 +1,73 @@ +# Notifications: forget one notification by IPC. Omarchy Mobile's quick +# settings list the toasts on screen and the history under the sheet, and a +# sideways swipe on a row there takes away that one notification. The +# service has calls for all toasts (dismissAll), all history (clear) and +# toasts by summary text, but none for one entry, and every way a toast +# leaves the screen moves its file into history, so a toast swiped away in +# the shade would come straight back as a history row. Deleting a history +# file from outside isn't safe either: archives, trims and replays run on the +# service's serialized file queue, and a move still queued for that +# notification would put the file back. `forget -.json` now +# closes a toast with that file name (a history replay of it too) at its +# sender without archiving it, then deletes the history entry and its image +# copies on the same queue, after anything already queued. A name that isn't +# a notification file name does nothing. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1) with 0015 and 0017 applied. +diff --git i/shell/plugins/notifications/Service.qml w/shell/plugins/notifications/Service.qml +--- i/shell/plugins/notifications/Service.qml ++++ w/shell/plugins/notifications/Service.qml +@@ -376,9 +376,11 @@ + // The popup is leaving the screen — for any reason — so its file must not + // survive to the next shell restart. It becomes the newest history entry + // instead. Rows that never had a file (a history replay, the empty-history +- // placeholder) archive to nothing, which the move tolerates. ++ // placeholder) archive to nothing, which the move tolerates. A forgotten ++ // popup (forgetNotification) leaves no history entry: its file goes. + if (entry) { +- archivePopupFileFor(entry) ++ if (reason === "forget") deletePopupFileFor(entry) ++ else archivePopupFileFor(entry) + if (restored) delete restoredPopups[NotificationLogic.popupFileName(entry)] + } + popupModel.remove(index) +@@ -398,6 +400,26 @@ + while (popupModel.count > 0) dismissPopup(0) + } + ++ // Forget one notification for good, named by its file (-.json, ++ // popupFileName): a toast on screen with that name, a history replay of it ++ // included, closes at its sender without moving into history, and the ++ // history entry and its image copies are deleted. The delete runs on the ++ // file queue, after any archive already queued for the same notification, ++ // so a toast that has just left the screen can't come back as history. ++ function forgetNotification(name) { ++ var file = String(name || "") ++ if (!/^[0-9]+-[0-9]+\.json$/.test(file)) return "none" ++ for (var i = popupModel.count - 1; i >= 0; i--) { ++ var row = popupModel.get(i) ++ if (row && row.originalId >= 0 && NotificationLogic.popupFileName(row) === file) ++ removePopup(i, "forget") ++ } ++ enqueuePopupFileJob(["bash", "-c", ++ "rm -f \"$1/$3\" \"$2/${3%.json}\"-*", "--", ++ historyDir, imagesDir, file]) ++ return "ok" ++ } ++ + // Run the popup's click action, then dismiss. Omarchy's own toasts carry the + // action as an argv vector in the `execArgv` role (see execArgvFromHints), + // which the persistence files preserve, so restored toasts stay clickable. +@@ -993,6 +1015,12 @@ + return hit ? "ok" : "none" + } + ++ // Forget one notification, toast or history entry, by its file name ++ // (`forget 1760000000000-3.json`); the rest of the history stays. ++ function forget(name: string): string { ++ return service.forgetNotification(name) ++ } ++ + function ping(): string { return "ok" } + } + diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0020-notifications-touch-phrasing-for-keyboard-and-click-hints.patch b/packages/omamobile-omarchy/legacy-4.0.6/0020-notifications-touch-phrasing-for-keyboard-and-click-hints.patch new file mode 100644 index 000000000..2f30027af --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0020-notifications-touch-phrasing-for-keyboard-and-click-hints.patch @@ -0,0 +1,70 @@ +# Notifications: platform phrasing. Omarchy's notifications say "click" and +# give "Super + ..." shortcuts, which a phone can't follow: the screenshot +# toast reads "Edit with Super + Alt + , (or click this)". On a touch platform +# omarchy-notification-send rewords them as it sends: "Edit with ... (or +# click this)" becomes "Tap to view" (the phone's screenshot editor is an +# image viewer, Omarchy Mobile's omamobile-screenshot-open), "Open with ... +# (or click this)" "Tap to open", a leading "Click to" becomes +# "Tap to", Voxtype's "Hold F9 ..." points at the Dictation tile, a +# parenthesised Super hint is removed, and a body line that is only a Super +# hint is dropped. Anything else passes through as written, and a desktop +# sends exactly what it did before. The phone is detected by +# /usr/bin/omamobile-update, as in 0016; OMARCHY_NOTIFICATION_PHRASING= +# touch|desktop overrides it. The welcome toast's two Super lines would be +# dropped too, but 0001 skips that toast on a phone. +# +# Against Omarchy 4.0.6 (stable 4.0.6-1). +diff --git i/bin/omarchy-notification-send w/bin/omarchy-notification-send +--- i/bin/omarchy-notification-send ++++ w/bin/omarchy-notification-send +@@ -136,6 +136,50 @@ + fi + done + ++# Platform phrasing. On a touch platform a notification is tapped, not ++# clicked, and there is no keyboard to follow a "Super + ..." hint, so the ++# phrasings that assume either are reworded; any other text passes through as ++# written. A phone running Omarchy Mobile is detected by its omamobile-update; ++# OMARCHY_NOTIFICATION_PHRASING=touch|desktop overrides the detection. ++phrasing=${OMARCHY_NOTIFICATION_PHRASING:-} ++if [[ -z $phrasing ]]; then ++ phrasing=desktop ++ [[ -x /usr/bin/omamobile-update ]] && phrasing=touch ++fi ++ ++touch_phrasing() { ++ local -n text=$1 ++ local hint_re='^(.*) \([^)]*Super \+[^)]*\)(.*)$' line kept=() drop_lines=$2 ++ ++ case $text in ++ "Edit with "*" (or click this)") text="Tap to view" ;; ++ "Open with "*" (or click this)") text="Tap to open" ;; ++ "Hold F9 to dictate (or toggle with Super + Ctrl + X).") text="Use the Dictation tile in quick settings." ;; ++ "Click to "*) text="Tap to ${text#Click to }" ;; ++ esac ++ text=${text//" (or click this)"/} ++ ++ # "Do this (or press Super + X)." -> "Do this." ++ while [[ $text =~ $hint_re ]]; do ++ text=${BASH_REMATCH[1]}${BASH_REMATCH[2]} ++ done ++ ++ # A body line that is only a keyboard hint ("Start it with Super + Space") ++ # has nothing to offer on a touch screen: drop it. ++ if ((drop_lines)) && [[ $text == *"Super + "* ]]; then ++ while IFS= read -r line; do ++ [[ $line == *"Super + "* ]] || kept+=("$line") ++ done <<<"$text" ++ text=$(printf '%s\n' "${kept[@]}") ++ ((${#kept[@]})) || text="" ++ fi ++} ++ ++if [[ $phrasing == touch ]]; then ++ touch_phrasing headline 0 ++ touch_phrasing description 1 ++fi ++ + case $urgency in + low) urgency_byte=0 ;; + normal) urgency_byte=1 ;; diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0021-sleep-turn-the-display-off-before-suspend.patch b/packages/omamobile-omarchy/legacy-4.0.6/0021-sleep-turn-the-display-off-before-suspend.patch new file mode 100644 index 000000000..cc9bfac30 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0021-sleep-turn-the-display-off-before-suspend.patch @@ -0,0 +1,53 @@ +# Sleep: turn the display off before suspend, once the session is secure. +# A phone's panel stays lit through suspend-to-idle: its display driver +# doesn't power it down for system sleep. A suspend that didn't come from +# the power key (upower's critical action, the system menu) began with the +# lock screen lit, so the phone slept behind a lit lock screen, drained the +# battery the suspend was meant to save, and couldn't charge from a 500 mA +# port. Only panels whose backlight this user may power down (bl_power), the +# panels patch 0008 makes follow DPMS, so laptops are unchanged. Bounded by +# what is left of the lock's budget, so a stuck Hyprland can't hold the +# suspend. A power-key wake lights the display again (omamobile-keys wake). +# It also tells the lock the display went dark (omarchy-shell lock dark, +# patch 0023), so the glance is up on the next wake. +# +# Against Omarchy 4.0.6 (4.0.6-1). +diff --git i/bin/omarchy-system-sleep-lock w/bin/omarchy-system-sleep-lock +index d471cea..b278615 100755 +--- i/bin/omarchy-system-sleep-lock ++++ w/bin/omarchy-system-sleep-lock +@@ -104,6 +104,25 @@ report_unsecured() { + exit 1 + } + ++# A phone's panel stays lit through suspend-to-idle (its display driver doesn't ++# power it down for system sleep), so a suspend that began with the screen on ++# slept behind a lit lock screen and drained the battery it was meant to save. ++# Once the session is secure, turn the display off within what is left of the ++# budget; a power-key wake lights it again. Only panels whose backlight this ++# user may power down (bl_power), the same panels brightness follows DPMS on. ++display_off() { ++ local device remaining seconds ++ device=$(omarchy-hw-display 2>/dev/null) || return 0 ++ [[ -w ${OMARCHY_BACKLIGHT_PATH:-/sys/class/backlight}/$device/bl_power ]] || return 0 ++ remaining=$(remaining_ms) ++ (( remaining > 0 )) || return 0 ++ printf -v seconds '%d.%03d' $((remaining / 1000)) $((remaining % 1000)) ++ # The lock's glance view (patch 0023) goes back to the glance whenever the ++ # display goes dark; tell it, as omamobile-keys and omamobile-sleepd do. ++ timeout --kill-after=0.1s "$seconds" omarchy-shell lock dark >/dev/null 2>&1 || true ++ timeout --kill-after=0.1s "$seconds" omarchy-brightness-display off >/dev/null 2>&1 || true ++} ++ + # Request the lock before touching monitor state, so a stuck Hyprland IPC call + # cannot consume the window before Quickshell has begun securing the session. + request_lock +@@ -113,7 +132,7 @@ sync_clamshell + # inside the reserve derive_budget_ms already held back for logind. + while (( $(remaining_ms) > 0 )); do + case $(lock_state) in +- secure) exit 0 ;; ++ secure) display_off; exit 0 ;; + locking) ;; + *) request_lock ;; + esac diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0022-lock-fingerprint-only-when-a-finger-is-enrolled.patch b/packages/omamobile-omarchy/legacy-4.0.6/0022-lock-fingerprint-only-when-a-finger-is-enrolled.patch new file mode 100644 index 000000000..13c9da150 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0022-lock-fingerprint-only-when-a-finger-is-enrolled.patch @@ -0,0 +1,186 @@ +# Lock: fingerprint only when a finger is enrolled. A backport of the probe +# half of upstream Omarchy's 879d6583d ("Fix fingerprint enrollment and +# lock-screen recovery", omacom/omarchy#7158, on quattro for 4.5; no stable +# release has it). The lock and omarchy-apply-lock took +# fprintd-list "$USER" | grep -qi finger as "fingerprint is set up", which +# also matches "User ... has no fingers enrolled ...". On a phone with +# omamobile-fingerprint installed (it ships the PAM file) and nothing +# enrolled, the lock then started a pam_fprintd attempt that failed at once +# (PAM_AUTHINFO_UNAVAIL) and retried every 250 ms for as long as it was up: +# 130,164 attempts in one night, about 55-62 mA (#170). +# +# As upstream: the probe is LC_ALL=C fprintd-list "$USER" 2>&1, and +# FingerprintModel.classifyProbe() reads it: "yes" only for an enrolled-print +# row (" - #0: ..."), "no" for "has no fingers enrolled" (or no PAM file or +# fprintd-list), "unknown" otherwise. Unknown never turns fingerprint off; it +# is asked again after 1 s, doubling to 40 s, while the lock is up. +# omarchy-apply-lock matches the same row, removes the PAM file only on a +# definite "no", and keeps it when the probe fails. +# +# Not taken: the rest of 879d6583d (the attempt backoff and the "reader +# unavailable" notice, the fprintd resume hook and its stop-timeout drop-in, +# the enrollment script changes), so a phone with a finger enrolled behaves +# as before: retries after a mismatch stay at 250 ms. FingerprintModel.js +# holds only upstream's probe functions, copied unchanged. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003 and 0009. Drop it once the +# phone's Omarchy has 879d6583d (the 4.5 line); its Service.qml and +# omarchy-apply-lock differ from 4.0.6's, so this will not apply there. +diff --git i/bin/omarchy-apply-lock w/bin/omarchy-apply-lock +--- i/bin/omarchy-apply-lock ++++ w/bin/omarchy-apply-lock +@@ -40,16 +40,24 @@ + account include system-local-login + EOF + +-if [[ -x /usr/bin/fprintd-list ]] && +- /usr/bin/fprintd-list "$target_user" 2>/dev/null | grep -qi finger; then ++# Keep the privileged probe pinned to /usr/bin; failure is not empty enrollment. ++if [[ -x /usr/bin/fprintd-list ]]; then ++ fingerprint_status=$(/usr/bin/fprintd-list "$target_user" 2>&1 || true) ++else ++ fingerprint_status="no" ++fi ++ ++if grep -qE '^[[:space:]]*-[[:space:]]*#[0-9]+:' <<< "$fingerprint_status"; then + echo "Configuring lock screen fingerprint authentication..." + as_root tee /etc/pam.d/omarchy-lock-fingerprint >/dev/null <<'EOF' + #%PAM-1.0 + auth required pam_fprintd.so + account include system-local-login + EOF +-else ++elif [[ $fingerprint_status == "no" ]] || grep -qi 'has no fingers enrolled' <<< "$fingerprint_status"; then + as_root rm -f /etc/pam.d/omarchy-lock-fingerprint ++else ++ echo "Could not check fingerprint enrollment; keeping the existing configuration." >&2 + fi + + # omarchy-shell can't reach a running shell during chroot install. The echo +diff --git i/shell/plugins/lock/FingerprintModel.js w/shell/plugins/lock/FingerprintModel.js +new file mode 100644 +--- /dev/null ++++ w/shell/plugins/lock/FingerprintModel.js +@@ -0,0 +1,33 @@ ++// The probe half of upstream's FingerprintModel.js (879d6583d): what ++// fprintd-list's answer means, and how often to ask again when it had none. ++var MATCH_RETRY_MS = 250 ++var ERROR_RETRY_BASE_MS = 1000 ++// Leave enough idle time for fprintd to exit and clear a wedged claim. ++var FPRINTD_IDLE_EXIT_MS = 30000 ++var ERROR_RETRY_CAP_MS = 40000 ++ ++function retryDelayMs(streak) { ++ if (streak <= 0) return MATCH_RETRY_MS ++ var delay = ERROR_RETRY_BASE_MS * Math.pow(2, streak - 1) ++ return Math.min(delay, ERROR_RETRY_CAP_MS) ++} ++ ++// A failed probe is unknown, so it cannot disable authentication for the lock. ++function classifyProbe(text) { ++ var s = String(text || "").trim() ++ if (/^[ \t]*-[ \t]*#[0-9]+:/m.test(s)) return "yes" ++ if (s === "no") return "no" ++ if (/has no fingers enrolled/i.test(s)) return "no" ++ return "unknown" ++} ++ ++if (typeof module !== "undefined") { ++ module.exports = { ++ MATCH_RETRY_MS: MATCH_RETRY_MS, ++ ERROR_RETRY_BASE_MS: ERROR_RETRY_BASE_MS, ++ ERROR_RETRY_CAP_MS: ERROR_RETRY_CAP_MS, ++ FPRINTD_IDLE_EXIT_MS: FPRINTD_IDLE_EXIT_MS, ++ classifyProbe: classifyProbe, ++ retryDelayMs: retryDelayMs ++ } ++} +diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml +--- i/shell/plugins/lock/Service.qml ++++ w/shell/plugins/lock/Service.qml +@@ -5,6 +5,7 @@ + import Quickshell.Wayland + import qs.Commons + import qs.Commons as Commons ++import "FingerprintModel.js" as FingerprintModel + + Item { + id: root +@@ -23,6 +24,7 @@ + property bool fingerprintAuthenticating: false + property bool passwordPamConfigured: false + property bool fingerprintConfigured: false ++ property int fingerprintProbeStreak: 0 + property bool keypad: false + property bool previewVisible: false + property string enteredPassword: "" +@@ -119,6 +121,32 @@ + if (!fingerprintCheckProc.running) fingerprintCheckProc.running = true + } + ++ // Only definitive enrollment results may disable authentication. ++ function applyFingerprintProbe(text) { ++ var status = FingerprintModel.classifyProbe(text) ++ if (status === "unknown") { ++ if (fingerprintConfigured) return ++ fingerprintProbeStreak += 1 ++ if (lockRequested) { ++ fingerprintRecheckTimer.interval = FingerprintModel.retryDelayMs(fingerprintProbeStreak) ++ fingerprintRecheckTimer.restart() ++ } ++ return ++ } ++ fingerprintProbeStreak = 0 ++ fingerprintRecheckTimer.stop() ++ fingerprintConfigured = status === "yes" ++ if (lockRequested && fingerprintConfigured) { ++ // A pending retry already owns the next attempt. ++ if (!fingerprintRetryTimer.running) startFingerprint() ++ } else if (!fingerprintConfigured) { ++ // abort() delivers no completion signal, so close the attempt here. ++ if (fingerprintPam.active) fingerprintPam.abort() ++ fingerprintAuthenticating = false ++ fingerprintRetryTimer.stop() ++ } ++ } ++ + function logEvent(event) { + lastEvent = event + lastEventAt = new Date().toISOString() +@@ -132,6 +160,8 @@ + failedAttempts = 0 + authenticatingPassword = false + fingerprintAuthenticating = false ++ fingerprintProbeStreak = 0 ++ fingerprintRecheckTimer.stop() + fingerprintRetryTimer.stop() + if (passwordPam.active) passwordPam.abort() + if (fingerprintPam.active) fingerprintPam.abort() +@@ -390,15 +420,21 @@ + } + } + ++ // Keep fprintd errors distinguishable from an explicit empty enrollment. + Process { + id: fingerprintCheckProc +- command: ["bash", "-c", "if [[ -f /etc/pam.d/omarchy-lock-fingerprint ]] && command -v fprintd-list >/dev/null 2>&1 && fprintd-list \"$USER\" 2>/dev/null | grep -qi finger; then echo yes; else echo no; fi"] ++ command: ["bash", "-c", "if [[ -f /etc/pam.d/omarchy-lock-fingerprint ]] && command -v fprintd-list >/dev/null 2>&1; then LC_ALL=C fprintd-list \"$USER\" 2>&1; else echo no; fi"] + stdout: StdioCollector { id: fingerprintCheckStdout; waitForEnd: true } +- onExited: { +- root.fingerprintConfigured = String(fingerprintCheckStdout.text || "").trim() === "yes" +- if (root.lockRequested && root.fingerprintConfigured) root.startFingerprint() +- else if (!root.fingerprintConfigured && fingerprintPam.active) fingerprintPam.abort() +- } ++ onExited: root.applyFingerprintProbe(fingerprintCheckStdout.text) ++ } ++ ++ // Retries a probe that could not reach fprintd, paced like the attempt ++ // retries so a daemon that stays unreachable is asked about ever less often. ++ Timer { ++ id: fingerprintRecheckTimer ++ interval: FingerprintModel.ERROR_RETRY_BASE_MS ++ repeat: false ++ onTriggered: root.refreshFingerprintStatus() + } + + Process { diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0023-lock-a-glance-view-for-touch-only-devices.patch b/packages/omamobile-omarchy/legacy-4.0.6/0023-lock-a-glance-view-for-touch-only-devices.patch new file mode 100644 index 000000000..8f08ea8b7 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0023-lock-a-glance-view-for-touch-only-devices.patch @@ -0,0 +1,1058 @@ +# Lock: a glance view on touch-only devices (the lock-keypad toggle), as a +# phone's lock screen opens: the time, the date, the home screen's last +# weather reading and the newest notifications, over the lock's blurred +# wallpaper. Only a swipe up (a clear drag, 8 % of the height, or a quick +# flick, from anywhere, a card included) or a typed key (kept in the field) +# moves to the PIN view, which is the lock as before plus a small clock. A +# tap never does: a tap on a card opens it to more of its text (summary up +# to 2 lines, body up to 4) and runs nothing, a second tap closes it, and a +# tap elsewhere does nothing. The first 12 px of a drag decide its way: +# mostly sideways on a card swipes it as a toast swipes (0017's +# finishSwipe: past 35 % or a flick it flies off), and that one notification +# is forgotten through the notifications service's forget call (0019), the +# call the phone's shade makes, so it leaves the history and the shade too, +# and the next one moves up; mostly vertical is the swipe up. It comes back +# whenever the lock is shown, the +# screen is woken (the wake call from 0009) or the screen goes dark: the +# lock's own blank, or a new "dark" call for what blanks it from outside +# (the phone's power button, and sleep). With an empty field and no input it +# also comes back after 15 s, counted on the wall clock so that a sleep in +# between can't freeze it. A touch on a dark screen, and one within 400 ms +# of a wake, only wakes it, and open cards close again. Only one view shows +# outside the short change; the other is hidden, so nothing of the PIN view +# renders or takes touches under the glance. Fingerprint unlock is untouched +# and works from both. +# +# The cards are Omarchy's NotificationCard, static as the history uses it, +# one per notification, newest first, as many as fit above the hint (up to +# three), then a line for the rest ("N more from A and B", "N more from A, +# B and 2 others"), with three new card properties: summaryLines, bodyLines +# and a detail label (the age, "2m"). +# Read (the forget is the one change) from the notifications plugin's +# persisted toasts and history +# (~/.local/state/omarchy/notifications/*.json, history/*.json): the same +# notifications the phone's shade lists, the newest ten with no age limit, +# Omarchy's own messages (omarchy-action, shown as Omarchy) and notify-send +# included. While do-not-disturb is on (notifications.json "dnd"), only what +# still toasts shows: Omarchy's own messages and a critical notify-send. +# The toggle lock-hide-notification-text shows the app name and "Unlock to +# read" instead of the text. Weather comes from +# ~/.local/state/omamobile/weather.json, written by the phone shell's +# omamobile-weather service, and is hidden when absent or over 3 h old; the +# lock makes no network calls. The clock is 12- or 24-hour as the phone bar +# and the home screen's clock decide, from the bar's clockFormat (shell.json, +# read at once whatever the lock shows, on every change and whenever the +# glance comes back; a failed read keeps the last), else the bar's default +# (HH:mm), never the session's C/POSIX locale. The big glance time is built +# without AM/PM (Qt's "h" without a marker counts to 23), the small clock +# over the PIN view keeps it. On a computer the lock is unchanged. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003, 0009, 0011, 0014, 0017 +# and 0019. +diff --git i/shell/plugins/lock/LockGlance.js w/shell/plugins/lock/LockGlance.js +new file mode 100644 +--- /dev/null ++++ w/shell/plugins/lock/LockGlance.js +@@ -0,0 +1,164 @@ ++.pragma library ++.import "../notifications/NotificationLogic.js" as NotificationLogic ++ ++// What the phone's lock shows at a glance (LockGlance.qml): the clock's ++// 12- or 24-hour choice, the notifications grouped by app, and the weather ++// line. Plain functions of their inputs, so the test can drive them. ++ ++// Up to this many notifications get a card; the rest fold into one line. ++var MAX_CARDS = 3 ++// The notifications the lock sums up are the ones the phone's notification ++// shade lists: the newest ten of the toasts on screen and the history, ++// which the notifications service trims to ten (historyLimit), with no age ++// limit and no app left out. ++var SHADE_LIMIT = 10 ++// NotificationUrgency.Critical, for the do-not-disturb rule. ++var CRITICAL = 2 ++// A weather reading older than this is not shown. ++var WEATHER_MAX_AGE_MS = 3 * 60 * 60 * 1000 ++ ++// The bar's own default time format (omamobile-shell's bar, without a ++// clockFormat): the lock's clock agrees with it. ++var BAR_DEFAULT_FORMAT = "HH:mm" ++ ++// 12- or 24-hour, decided as the phone bar and the home screen's clock decide ++// (omamobile-shell, HomeModel.systemTimeFormat) from the bar's clockFormat ++// (shell.json bar.clockFormat): quoted literals ignored, an AM/PM marker or ++// "h" without "H" means 12-hour. Without one, the bar's default (24-hour), ++// never the session's Qt locale, which is C/POSIX for the shell. ++function twelveHour(barFormat) { ++ var f = String(barFormat || BAR_DEFAULT_FORMAT).replace(/'[^']*'/g, "") ++ return /a/i.test(f) || (/h/.test(f) && !/H/.test(f)) ++} ++ ++// The bar's clockFormat from shell.json's text: "" when it has none, null ++// when the text can't be read (a write caught half done), which keeps the ++// last one. ++function barClockFormat(text) { ++ var shell ++ try { shell = JSON.parse(String(text || "")) } catch (e) { return null } ++ if (!shell || typeof shell !== "object") return null ++ return shell.bar && shell.bar.clockFormat ? String(shell.bar.clockFormat) : "" ++} ++ ++// The small clock over the PIN view: a Qt format, with AM/PM in 12-hour. ++function timeFormat(twelve) { ++ return twelve ? "h:mm AP" : "HH:mm" ++} ++ ++// The large glance time, without AM/PM. Built here, not as the Qt format ++// "h:mm": without an AM/PM marker in the same format Qt counts "h" from 0 ++// to 23, so a 12-hour bar got a 24-hour lock ("14:02"). ++function glanceTime(date, twelve) { ++ var d = date instanceof Date ? date : new Date(date) ++ var h = d.getHours() ++ var mm = (d.getMinutes() < 10 ? "0" : "") + d.getMinutes() ++ if (twelve) return (h % 12 || 12) + ":" + mm ++ return (h < 10 ? "0" : "") + h + ":" + mm ++} ++ ++function age(timestamp, now) { ++ var minutes = Math.floor(Math.max(0, Number(now) - Number(timestamp || 0)) / 60000) ++ if (minutes < 1) return "now" ++ if (minutes < 60) return minutes + "m" ++ return Math.floor(minutes / 60) + "h" ++} ++ ++ ++// The name a card goes by: Omarchy's own messages (omarchy-action) ++// as Omarchy, a bare notify-send or a nameless sender as Notifications. ++function appName(app) { ++ var name = String(app || "").trim() ++ if (name === "omarchy-action") return "Omarchy" ++ if (!name || name === "notify-send") return "Notifications" ++ return name ++} ++ ++// The shade's rows (see SHADE_LIMIT; a row with neither summary nor body is ++// skipped, as there) from the persisted popup and history files (the ++// notifications plugin's state, one JSON line each, read together). ++function shadeRows(raw) { ++ var rows = NotificationLogic.historyRows(raw, [], 1, 1000) ++ var out = [] ++ for (var i = 0; i < rows.length && out.length < SHADE_LIMIT; i++) { ++ var e = rows[i] ++ if (!String(e.summary || "").trim() && !String(e.body || "").trim()) continue ++ out.push(e) ++ } ++ return out ++} ++ ++// The file names (NotificationLogic.popupFileName) of every notification ++// the files hold, as a set. ++function fileNames(raw) { ++ var rows = NotificationLogic.historyRows(raw, [], 1, 1000) ++ var out = {} ++ for (var i = 0; i < rows.length; i++) out[NotificationLogic.popupFileName(rows[i])] = true ++ return out ++} ++ ++// Those rows as cards, one per notification, newest first. While ++// do-not-disturb is on, only what would still toast: Omarchy's own ++// messages, and a critical notify-send (NotificationLogic.shouldBypassDnd). ++// hideText shows the app name and "Unlock to read" instead of the text, and ++// no sender picture. The detail beside the summary is the age ("2m"). ++function cards(raw, now, hideText, dnd) { ++ var rows = shadeRows(raw) ++ var out = [] ++ for (var i = 0; i < rows.length; i++) { ++ var e = rows[i] ++ if (dnd && !NotificationLogic.shouldBypassDnd({ appName: e.app, urgency: e.urgency }, CRITICAL)) continue ++ var name = appName(e.app) ++ out.push({ ++ app: name, ++ appIcon: e.appIcon, ++ image: hideText ? "" : e.image, ++ glyph: e.glyph, ++ urgency: e.urgency, ++ timestamp: e.timestamp, ++ summary: hideText ? name : (String(e.summary || "").trim() || name), ++ body: hideText ? "Unlock to read" : NotificationLogic.sanitizeBody(e.body, e.app, e.appIcon), ++ detail: age(e.timestamp, now), ++ file: NotificationLogic.popupFileName(e) ++ }) ++ } ++ return out ++} ++ ++// The line under the cards for the notifications without one: "5 more from ++// Mail and GitHub", "5 more from Mail, GitHub and 2 others", each app named ++// once, newest first. ++function moreText(rest) { ++ if (!rest || rest.length === 0) return "" ++ var names = [] ++ for (var i = 0; i < rest.length; i++) { ++ var app = String(rest[i].app || "") ++ if (app && names.indexOf(app) < 0) names.push(app) ++ } ++ if (names.length === 0) return rest.length + " more" ++ var from = names.length <= 2 ? names.join(" and ") ++ : names.slice(0, 2).join(", ") + " and " + (names.length - 2) + (names.length === 3 ? " other" : " others") ++ return rest.length + " more from " + from ++} ++ ++// notifications.json's do-not-disturb flag: silenced notifications make no ++// toast, so the lock shows only what still toasts (cards). ++function doNotDisturb(raw) { ++ var parsed = NotificationLogic.parseSettings(raw) ++ return parsed.dnd === true ++} ++ ++// The home screen weather widget's last reading, which omamobile-shell ++// keeps in ~/.local/state/omamobile/weather.json: ++// {"at": , "temperature": 12, "unit": "°C", "text": "Partly cloudy"} ++// Shown as "12°, partly cloudy"; nothing when absent, unreadable or older ++// than WEATHER_MAX_AGE_MS. The lock itself never asks the network. ++function weatherLine(raw, now) { ++ var w ++ try { w = JSON.parse(String(raw || "")) } catch (e) { return "" } ++ if (!w || typeof w.temperature !== "number" || !isFinite(w.temperature)) return "" ++ var at = Number(w.at || 0) ++ if (!(at > 0) || Number(now) - at > WEATHER_MAX_AGE_MS || at - Number(now) > 5 * 60 * 1000) return "" ++ var text = String(w.text || "").trim() ++ return Math.round(w.temperature) + "°" + (text ? ", " + text.charAt(0).toLowerCase() + text.slice(1) : "") ++} +diff --git i/shell/plugins/lock/LockGlance.qml w/shell/plugins/lock/LockGlance.qml +new file mode 100644 +--- /dev/null ++++ w/shell/plugins/lock/LockGlance.qml +@@ -0,0 +1,628 @@ ++import QtQuick ++import Quickshell ++import Quickshell.Io ++import qs.Commons ++import qs.Commons as Commons ++import qs.Ui ++import "../notifications/components" ++import "LockGlance.js" as Glance ++ ++// The lock's glance view on touch-only devices (the lock-keypad toggle): ++// the time, the date, the weather, the newest notifications and a hint, ++// over the lock's own blurred wallpaper. A tap on a card opens it to more ++// of its text, a sideways swipe dismisses it (as in the shade); only a swipe up or a typed key moves to the PIN view, which ++// is the lock as before plus a small clock; with no input it comes back after ++// 15 s, and whenever the lock is shown, the screen goes dark (any way: the ++// lock's own blank, the power button, sleep) or the screen is woken. The ++// touch that wakes a dark screen only wakes it. Fingerprint unlock runs ++// underneath either view, untouched. ++// ++// Read-only: the notifications plugin's persisted toasts and history, its ++// do-not-disturb flag, the lock-hide-notification-text toggle, the bar's ++// clock format and the home screen's last weather reading. Nothing here ++// acts on a notification or asks the network. ++// ++// On a computer (keypad off) it shows nothing and reads nothing but the ++// bar's clock format. ++Item { ++ id: glance ++ ++ // The LockView this sits in. ++ property var lock: null ++ // Where the PIN view's own content starts (its hint or field), for the ++ // small clock above it. ++ property real pinTop: height * 0.2 ++ ++ readonly property bool active: !!lock && lock.keypad ++ property bool shown: true ++ readonly property bool showing: active && shown ++ // 1 with the glance up, 0 with the PIN view; animated in between. The ++ // view not in use is hidden (visible: false) once the change is over. ++ property real progress: showing ? 1 : 0 ++ Behavior on progress { NumberAnimation { duration: 220; easing.type: Easing.OutCubic } } ++ ++ readonly property string home: Quickshell.env("HOME") ++ property bool hideText: false ++ property bool doNotDisturb: false ++ property string barClockFormat: "" ++ property string notificationsRaw: "" ++ property string weatherRaw: "" ++ readonly property double now: clock.date.getTime() ++ readonly property bool twelveHour: Glance.twelveHour(barClockFormat) ++ // Swiped away: hidden at once by file name, until a read no longer finds ++ // the file (the service's forget runs on its file queue), as the shade ++ // does. A mark the files still show after 15 s lapses (a forget that never ++ // happened), and the card comes back. ++ property var dismissed: ({}) ++ readonly property var cards: active ? Glance.cards(notificationsRaw, now, hideText, doNotDisturb) ++ .filter(function(c) { return !glance.dismissed[c.file] }) : [] ++ readonly property var shownCards: cards.slice(0, Glance.MAX_CARDS) ++ // How many of those cards fit above the hint (refit). ++ property int fitCount: Glance.MAX_CARDS ++ readonly property string moreText: Glance.moreText(cards.slice(Math.min(fitCount, shownCards.length))) ++ // The cards opened to more of their text, by notification file name; ++ // all closed again whenever the glance comes back. ++ property var expanded: ({}) ++ readonly property string weatherText: active ? Glance.weatherLine(weatherRaw, now) : "" ++ // Where the under-display sensor's part of the screen starts (LockView's ++ // keypadClearsSensor): the hint sits just below it, the cards above. ++ readonly property real sensorTop: lock && lock.keypadClearsSensor ? height - lock.keypadBottomMargin : height ++ property double lastActivity: Date.now() ++ property bool polling: true ++ // A touch on a dark screen only wakes it, as on a phone, and so does one ++ // within this long of a wake (the rest of that touch, or a finger already ++ // on its way). ++ property int wakeGuardMs: 400 ++ property double wakeGuardUntil: 0 ++ ++ visible: active ++ ++ function show() { ++ if (!active || (lock && lock.authenticatingPassword)) return ++ shown = true ++ expanded = ({}) ++ shellFile.reload() ++ if (lock.passwordText.length > 0) lock.passwordTextEdited("") ++ noteActivity() ++ refresh() ++ glance.forceActiveFocus() ++ if (lock.inputEnabled) lock.foldKeyboard() ++ } ++ ++ function reveal() { ++ if (!showing) return ++ shown = false ++ pendingFocus = true ++ lock.wakeRequested() ++ } ++ ++ // The PIN view's field takes focus once it is shown again (an item that ++ // is not visible can't), which brings up the on-screen keyboard for a ++ // password as before. ++ property bool pendingFocus: false ++ onProgressChanged: { ++ if (pendingFocus && progress < 1) { ++ pendingFocus = false ++ Qt.callLater(lock.forcePasswordFocus) ++ } ++ } ++ ++ function noteActivity() { ++ lastActivity = Date.now() ++ idleTimer.since = lastActivity ++ if (!active) return ++ if (!polling) { ++ polling = true ++ refresh() ++ } ++ } ++ ++ function armWakeGuard() { ++ wakeGuardUntil = Date.now() + wakeGuardMs ++ } ++ ++ // Whether a touch that starts now only wakes the screen; a dark one is ++ // lit through the lock, as any touch on the lock lights it. ++ function wakeTouch() { ++ if (lock.displayDark) { ++ armWakeGuard() ++ lock.wakeRequested() ++ return true ++ } ++ return Date.now() < wakeGuardUntil ++ } ++ ++ function refresh() { ++ if (active && !notificationsProc.running) notificationsProc.running = true ++ } ++ ++ function refit() { ++ var avail = cardsArea.height ++ var gap = cardsColumn.spacing ++ var moreHeight = moreLabel.implicitHeight + gap ++ var used = 0 ++ var n = 0 ++ for (var i = 0; i < cardsRepeater.count; i++) { ++ var item = cardsRepeater.itemAt(i) ++ if (!item) break ++ var h = item.implicitHeight + (n > 0 ? gap : 0) ++ var needMore = i + 1 < cards.length ++ if (used + h + (needMore ? moreHeight : 0) > avail) break ++ used += h ++ n++ ++ } ++ fitCount = n ++ } ++ ++ onShownCardsChanged: Qt.callLater(refit) ++ ++ // A card swiped off its side: that one notification is forgotten through ++ // the notifications service's forget call (omamobile-omarchy patch 0019), ++ // the call the phone's shade makes, so it leaves the toasts, the history ++ // and the shade too. Nothing of the notification runs. ++ property var forgetQueue: [] ++ function dismiss(file) { ++ if (!file || dismissed[file]) return ++ var marks = {} ++ for (var k in dismissed) marks[k] = dismissed[k] ++ marks[file] = Date.now() ++ dismissed = marks ++ forgetQueue = forgetQueue.concat([file]) ++ noteActivity() ++ Qt.callLater(runForget) ++ } ++ ++ function runForget() { ++ if (forgetProc.running || forgetQueue.length === 0) return ++ forgetProc.command = ["sh", "-c", ++ "dir=$1; shift; for name; do qs ipc -p \"$dir\" call notifications forget \"$name\"; done; exit 0", ++ "sh", Quickshell.shellDir].concat(forgetQueue) ++ forgetQueue = [] ++ forgetProc.running = true ++ } ++ ++ function pruneDismissed(raw) { ++ var present = Glance.fileNames(raw) ++ var marks = {} ++ var any = false ++ for (var k in dismissed) { ++ if (!present[k]) continue ++ if (Date.now() - dismissed[k] > 15000) continue ++ marks[k] = dismissed[k] ++ any = true ++ } ++ dismissed = any ? marks : ({}) ++ } ++ ++ function toggleCard(file) { ++ var next = {} ++ for (var k in expanded) next[k] = expanded[k] ++ if (next[file]) delete next[file] ++ else next[file] = true ++ expanded = next ++ noteActivity() ++ } ++ ++ // The card under a point of the glance, or null. ++ function cardAt(item, x, y) { ++ for (var i = 0; i < cardsRepeater.count; i++) { ++ var card = cardsRepeater.itemAt(i) ++ if (!card || !card.visible) continue ++ var p = item.mapToItem(card, x, y) ++ if (p.x >= 0 && p.y >= 0 && p.x <= card.width && p.y <= card.height) return card ++ } ++ return null ++ } ++ onHeightChanged: Qt.callLater(refit) ++ ++ // A typed key on the glance moves to the PIN view and keeps the key: a ++ // digit (or, for a password, any character) goes into the field. ++ Keys.onPressed: function(event) { ++ if (!showing) return ++ var t = event.text ++ var printable = t.length === 1 && t.charCodeAt(0) >= 32 && !(event.modifiers & Qt.ControlModifier) ++ if (printable && lock.inputEnabled && !lock.authenticatingPassword ++ && (!lock.padShown || (t >= "0" && t <= "9"))) { ++ if (lock.failureMessage.length > 0) lock.clearFailureRequested() ++ lock.passwordTextEdited(lock.passwordText + t) ++ } else if (!printable && event.key !== Qt.Key_Return && event.key !== Qt.Key_Enter ++ && event.key !== Qt.Key_Up && event.key !== Qt.Key_Space) { ++ return ++ } ++ reveal() ++ event.accepted = true ++ } ++ ++ Connections { ++ target: glance.lock ++ enabled: glance.active ++ function onInputEnabledChanged() { if (glance.lock.inputEnabled) glance.show() } ++ function onWakeSerialChanged() { glance.armWakeGuard(); glance.show() } ++ function onBlankSerialChanged() { glance.show() } ++ function onDisplayDarkChanged() { if (!glance.lock.displayDark) glance.armWakeGuard() } ++ function onWakeRequested() { glance.noteActivity() } ++ // Text that reaches the field another way still shows the PIN view. ++ function onPasswordTextChanged() { if (glance.showing && glance.lock.passwordText.length > 0) glance.reveal() } ++ } ++ ++ Component.onCompleted: if (active) { refresh(); Qt.callLater(function() { if (glance.showing) glance.forceActiveFocus() }) } ++ onActiveChanged: if (active) refresh() ++ ++ // Back to the glance after 15 s on the PIN view with nothing typed, ++ // counted on the wall clock as the lock's blank timer is: a countdown ++ // frozen by sleep would otherwise pick up where it stopped after resume. ++ Timer { ++ id: idleTimer ++ objectName: "lockGlanceIdle" ++ property int returnAfter: 15000 ++ // When the PIN view last had input, or the countdown began. ++ property double since: 0 ++ interval: 1000 ++ repeat: true ++ running: glance.active && !glance.shown && glance.lock.passwordText.length === 0 && !glance.lock.authenticatingPassword ++ onRunningChanged: if (running) since = Date.now() ++ onTriggered: { ++ if (!(since > 0)) since = Date.now() ++ else if (Date.now() - since >= returnAfter) glance.show() ++ } ++ } ++ ++ // The notification files have no change signal to watch, so they are read ++ // again every few seconds while the lock is in use, and not while it sits ++ // dark: the lock blanks the screen 10 s after the last input. ++ Timer { ++ id: pollTimer ++ interval: 5000 ++ repeat: true ++ running: glance.active && glance.polling ++ onTriggered: { ++ if (Date.now() - glance.lastActivity > 20000) glance.polling = false ++ else glance.refresh() ++ } ++ } ++ ++ SystemClock { ++ id: clock ++ precision: SystemClock.Minutes ++ } ++ ++ Process { ++ id: notificationsProc ++ command: ["bash", "-c", "shopt -s nullglob; set -- \"$1\"*.json \"$1\"history/*.json; (($#)) && awk 1 \"$@\" 2>/dev/null; true", ++ "--", glance.home + "/.local/state/omarchy/notifications/"] ++ stdout: StdioCollector { ++ waitForEnd: true ++ onStreamFinished: { ++ glance.notificationsRaw = String(text || "") ++ glance.pruneDismissed(glance.notificationsRaw) ++ } ++ } ++ } ++ ++ Process { ++ id: forgetProc ++ onExited: { ++ glance.runForget() ++ glance.refresh() ++ } ++ } ++ ++ FileView { ++ path: glance.active ? glance.home + "/.local/state/omarchy/toggles/lock-hide-notification-text" : "" ++ watchChanges: true ++ printErrors: false ++ onLoaded: glance.hideText = true ++ onLoadFailed: glance.hideText = false ++ onFileChanged: reload() ++ } ++ ++ FileView { ++ path: glance.active ? glance.home + "/.local/state/omarchy/notifications.json" : "" ++ watchChanges: true ++ printErrors: false ++ onLoaded: glance.doNotDisturb = Glance.doNotDisturb(text()) ++ onLoadFailed: glance.doNotDisturb = false ++ onFileChanged: reload() ++ } ++ ++ FileView { ++ path: glance.active ? glance.home + "/.local/state/omamobile/weather.json" : "" ++ watchChanges: true ++ printErrors: false ++ onLoaded: glance.weatherRaw = text() ++ onLoadFailed: glance.weatherRaw = "" ++ onFileChanged: reload() ++ } ++ ++ FileView { ++ // The bar's clock format, read whatever the lock shows, at once (a small ++ // file), again on every change and each time the glance comes back. A ++ // read that fails (shell.json being replaced) keeps the last format. ++ id: shellFile ++ path: glance.home + "/.config/omarchy/shell.json" ++ blockLoading: true ++ watchChanges: true ++ printErrors: false ++ onLoaded: { ++ var format = Glance.barClockFormat(text()) ++ if (format !== null) glance.barClockFormat = format ++ } ++ onFileChanged: reload() ++ } ++ ++ // ---------------------------------------------------------------- PIN view ++ ++ // The time, small, above the PIN view's hint or field. ++ Text { ++ id: pinClock ++ objectName: "lockPinClock" ++ textFormat: Text.PlainText ++ anchors.horizontalCenter: parent.horizontalCenter ++ y: Math.max(Style.space(24), glance.pinTop - Style.space(22) - height) ++ visible: glance.progress < 1 ++ opacity: 1 - glance.progress ++ text: Qt.formatDateTime(clock.date, Glance.timeFormat(glance.twelveHour)) ++ color: Commons.Color.lock.text ++ font.family: Style.font.family ++ font.pixelSize: Style.font.display ++ } ++ ++ // ---------------------------------------------------------------- glance ++ ++ Item { ++ id: glanceLayer ++ objectName: "lockGlanceView" ++ anchors.fill: parent ++ visible: glance.progress > 0 ++ enabled: glance.showing ++ opacity: glance.progress ++ ++ Item { ++ id: content ++ anchors.fill: parent ++ // Follows a swipe a little, and rises as the PIN view comes in. ++ transform: Translate { ++ y: Math.min(0, swipe.dragY) * 0.4 - Style.space(40) * (1 - glance.progress) ++ } ++ ++ Column { ++ id: header ++ anchors.horizontalCenter: parent.horizontalCenter ++ y: Math.round(parent.height * 0.113) ++ width: Math.min(Style.space(380), parent.width - Style.space(32)) ++ spacing: 0 ++ ++ Text { ++ id: timeLabel ++ objectName: "lockGlanceTime" ++ width: parent.width ++ horizontalAlignment: Text.AlignHCenter ++ textFormat: Text.PlainText ++ text: Glance.glanceTime(clock.date, glance.twelveHour) ++ color: Commons.Color.lock.text ++ font.family: Style.font.family ++ font.weight: Font.Light ++ font.pixelSize: Math.round(Style.font.displayLarge * 3.7) ++ fontSizeMode: Text.HorizontalFit ++ minimumPixelSize: Style.font.display ++ } ++ ++ Text { ++ objectName: "lockGlanceDate" ++ width: parent.width ++ topPadding: Style.space(14) ++ horizontalAlignment: Text.AlignHCenter ++ textFormat: Text.PlainText ++ text: Qt.formatDate(clock.date, "dddd, MMMM d") ++ color: Commons.Color.lock.text ++ font.family: Style.font.family ++ font.pixelSize: Style.font.heading ++ elide: Text.ElideRight ++ } ++ ++ Text { ++ objectName: "lockGlanceWeather" ++ width: parent.width ++ topPadding: Style.space(6) ++ visible: glance.weatherText.length > 0 ++ horizontalAlignment: Text.AlignHCenter ++ textFormat: Text.PlainText ++ text: glance.weatherText ++ color: Commons.Color.lock.placeholder ++ font.family: Style.font.family ++ font.pixelSize: Style.font.title ++ elide: Text.ElideRight ++ } ++ } ++ ++ // Between the header and the hint; the cards that don't fit fold ++ // into the "more" line. ++ Item { ++ id: cardsArea ++ anchors.horizontalCenter: parent.horizontalCenter ++ y: header.y + header.height + Style.space(40) ++ width: header.width ++ height: Math.max(0, hint.y - Style.space(24) - y) ++ onHeightChanged: Qt.callLater(glance.refit) ++ ++ Column { ++ id: cardsColumn ++ objectName: "lockGlanceCards" ++ width: parent.width ++ spacing: Style.space(10) ++ ++ Repeater { ++ id: cardsRepeater ++ model: glance.shownCards ++ ++ NotificationCard { ++ required property var modelData ++ required property int index ++ objectName: "lockGlanceCard" ++ width: cardsColumn.width ++ visible: index < glance.fitCount ++ app: modelData.app ++ appIcon: modelData.appIcon ++ image: modelData.image ++ glyph: modelData.glyph ++ urgency: modelData.urgency ++ timestamp: modelData.timestamp ++ summary: modelData.summary ++ body: modelData.body ++ detail: modelData.detail ++ readonly property bool open: !!glance.expanded[modelData.file] ++ summaryLines: open ? 2 : 1 ++ bodyLines: open ? 4 : 1 ++ cornerRadius: Style.cornerRadius ++ fontFamily: Style.font.family ++ swipeEnabled: false ++ closeButtonShown: false ++ // No actions from the lock: a tap opens or closes the card ++ // (the glance's touch area below does it; this is the same ++ // for a click that reaches the card), and a card swiped off ++ // its side (the touch area moves it, the card's own ++ // finishSwipe from patch 0017 decides) is forgotten. ++ onCardClicked: glance.toggleCard(modelData.file) ++ onCloseRequested: glance.dismiss(modelData.file) ++ onImplicitHeightChanged: Qt.callLater(glance.refit) ++ } ++ } ++ ++ Text { ++ id: moreLabel ++ objectName: "lockGlanceMore" ++ width: parent.width ++ visible: glance.moreText.length > 0 ++ topPadding: Style.space(2) ++ horizontalAlignment: Text.AlignHCenter ++ textFormat: Text.PlainText ++ text: glance.moreText ++ color: Commons.Color.lock.placeholder ++ font.family: Style.font.family ++ font.pixelSize: Style.font.subtitle ++ elide: Text.ElideRight ++ } ++ ++ Text { ++ objectName: "lockGlanceQuiet" ++ width: parent.width ++ visible: glance.cards.length === 0 ++ horizontalAlignment: Text.AlignHCenter ++ textFormat: Text.PlainText ++ text: "No new notifications" ++ color: Commons.Color.lock.placeholder ++ font.family: Style.font.family ++ font.pixelSize: Style.font.title ++ } ++ } ++ } ++ ++ Text { ++ id: hint ++ objectName: "lockGlanceHint" ++ anchors.horizontalCenter: parent.horizontalCenter ++ width: parent.width - Style.space(32) ++ // Where the PIN view has its emergency call: above the sensor's ++ // fingerprint mark, or near the bottom without fingerprints. ++ y: glance.lock && glance.lock.keypadClearsSensor ? glance.sensorTop + Style.space(26) ++ : parent.height - (glance.lock ? glance.lock.keypadBottomMargin : 0) - height ++ textFormat: Text.PlainText ++ text: glance.lock && glance.lock.fingerprintConfigured ? "Touch the fingerprint sensor or swipe up" : "Swipe up to unlock" ++ color: Commons.Color.lock.text ++ font.family: Style.font.family ++ font.pixelSize: Style.font.subtitle ++ wrapMode: Text.WordWrap ++ horizontalAlignment: Text.AlignHCenter ++ } ++ } ++ ++ // Over everything, cards included. The first 12 px of a drag decide its ++ // way: mostly sideways on a card swipes that card (off its side, past ++ // 35 % or a flick, dismisses it); mostly vertical is the swipe up to the ++ // PIN view (a clear drag, 8 % of the height, or a quick flick), from a ++ // card too. A tap on a card opens or closes it, a tap anywhere else does ++ // nothing, and a touch that wakes a dark screen only wakes it. ++ MouseArea { ++ id: swipe ++ objectName: "lockGlanceSwipe" ++ anchors.fill: parent ++ property real startY: 0 ++ property real startX: 0 ++ property double startAt: 0 ++ property real dragY: 0 ++ // This touch woke the screen (glance.wakeTouch): it does nothing else. ++ property bool wakeOnly: false ++ // "", "x" (a card swipe) or "y" (toward the PIN view), from the first ++ // 12 px of movement. ++ property string axis: "" ++ property var swipeCard: null ++ property real lastX: 0 ++ property double lastAt: 0 ++ property real velocityX: 0 ++ onPressed: function(mouse) { ++ wakeOnly = glance.wakeTouch() ++ startY = mouse.y ++ startX = mouse.x ++ startAt = Date.now() ++ lastX = mouse.x ++ lastAt = startAt ++ velocityX = 0 ++ dragY = 0 ++ axis = "" ++ swipeCard = null ++ } ++ onPositionChanged: function(mouse) { ++ if (wakeOnly) return ++ var dx = mouse.x - startX ++ var dy = mouse.y - startY ++ if (!axis && Math.max(Math.abs(dx), Math.abs(dy)) >= Style.space(12)) { ++ axis = Math.abs(dx) > Math.abs(dy) ? "x" : "y" ++ if (axis === "x") { ++ var card = glance.cardAt(swipe, startX, startY) ++ swipeCard = card && !card.dismissing ? card : null ++ } ++ } ++ if (axis === "y") dragY = dy ++ if (axis === "x" && swipeCard) { ++ var t = Date.now() ++ if (t > lastAt) velocityX = (mouse.x - lastX) * 1000 / (t - lastAt) ++ lastX = mouse.x ++ lastAt = t ++ swipeCard.swipeOffset = dx ++ swipeCard.swipeVelocity = velocityX ++ } ++ } ++ onReleased: function(mouse) { ++ var moved = mouse.y - startY ++ dragY = 0 ++ if (wakeOnly) { ++ wakeOnly = false ++ return ++ } ++ if (axis === "x") { ++ if (swipeCard) swipeCard.finishSwipe() ++ swipeCard = null ++ return ++ } ++ var quick = Date.now() - startAt < 300 && moved < -Style.space(24) ++ if (axis === "y" && (moved < -glance.height * 0.08 || quick)) { ++ glance.reveal() ++ return ++ } ++ if (Math.abs(moved) < Style.space(12) && Math.abs(mouse.x - startX) < Style.space(12)) { ++ var card = glance.cardAt(swipe, mouse.x, mouse.y) ++ if (card) glance.toggleCard(card.modelData.file) ++ } ++ } ++ onCanceled: { ++ dragY = 0 ++ wakeOnly = false ++ if (swipeCard) { ++ swipeCard.swipeVelocity = 0 ++ swipeCard.swipeOffset = 0 ++ } ++ swipeCard = null ++ } ++ } ++ } ++} +diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml +--- i/shell/plugins/lock/LockView.qml ++++ w/shell/plugins/lock/LockView.qml +@@ -31,6 +31,16 @@ + // The ABC/123 switch in the field swaps either way, so a password with + // letters and digits can always be typed. + property bool passwordFirst: false ++ // The glance view (LockGlance.qml) over the PIN view on touch-only ++ // devices: the PIN view's parts fade in as it goes, and are hidden while it ++ // is up. The lock bumps wakeSerial when the screen is woken and ++ // blankSerial when it goes dark, and each brings the glance back; while ++ // displayDark, a touch only wakes the screen. ++ property int wakeSerial: 0 ++ property int blankSerial: 0 ++ property bool displayDark: false ++ readonly property real pinOpacity: 1 - glance.progress ++ readonly property bool pinVisible: glance.progress < 1 + property bool switchedInput: false + readonly property bool padShown: keypad && (passwordFirst === switchedInput) + readonly property real inputSwitchReserve: keypad ? Math.round(inputSwitch.implicitWidth + 12) : 0 +@@ -73,6 +83,10 @@ + } + + function forcePasswordFocus() { ++ if (glance.showing) { ++ glance.forceActiveFocus() ++ return ++ } + if (padShown) { + keypadKeys.forceActiveFocus() + return +@@ -200,7 +214,8 @@ + + Keypad { + id: numberPad +- visible: root.padShown ++ visible: root.padShown && root.pinVisible ++ opacity: root.pinOpacity + enabled: root.inputEnabled && !root.authenticatingPassword + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom +@@ -226,6 +241,8 @@ + + BorderSurface { + id: inputField ++ visible: root.pinVisible ++ opacity: root.pinOpacity + width: root.fieldWidth + height: root.fieldHeight + anchors.horizontalCenter: parent.horizontalCenter +@@ -365,7 +382,8 @@ + anchors.bottomMargin: Style.space(18) + anchors.horizontalCenter: inputField.horizontalCenter + width: parent.width - Style.space(32) +- visible: root.keypadClearsSensor ++ visible: root.keypadClearsSensor && root.pinVisible ++ opacity: root.pinOpacity + text: root.padShown ? "Touch the fingerprint sensor or enter your PIN" + : "Touch the fingerprint sensor or enter your password" + color: Commons.Color.lock.text +@@ -383,9 +401,10 @@ + Item { + id: emergencyButton + objectName: "lockEmergencyCall" +- visible: root.keypad ++ visible: root.keypad && root.pinVisible ++ opacity: root.pinOpacity + anchors.horizontalCenter: parent.horizontalCenter +- anchors.top: numberPad.visible ? numberPad.bottom : inputField.bottom ++ anchors.top: root.padShown ? numberPad.bottom : inputField.bottom + anchors.topMargin: Style.space(20) + width: emergencyLabel.implicitWidth + Style.space(40) + height: Math.max(Style.space(44), emergencyLabel.implicitHeight + Style.space(16)) +@@ -411,5 +430,12 @@ + } + } + } ++ ++ LockGlance { ++ id: glance ++ anchors.fill: parent ++ lock: root ++ pinTop: root.keypadClearsSensor ? keypadHint.y : inputField.y ++ } + } + } +diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml +--- i/shell/plugins/lock/Service.qml ++++ w/shell/plugins/lock/Service.qml +@@ -31,6 +31,15 @@ + property int failedAttempts: 0 + property string backgroundPath: "" + property int backgroundVersion: 0 ++ // Bumped by the wake call (a phone's power button): the lock's glance view ++ // comes back each time the screen is woken. ++ property int wakeSerial: 0 ++ // Bumped whenever the locked display goes dark: the lock's own blank, or ++ // the dark call (a phone's power button, sleep). The glance view comes ++ // back each time, and displayDark holds until the display is lit through ++ // the lock again, so the touch that wakes a dark screen only wakes it. ++ property int blankSerial: 0 ++ property bool displayDark: false + property string lastEvent: "init" + property string lastEventAt: "" + property bool strandedLock: false +@@ -178,14 +187,22 @@ + } + + function runWake() { ++ displayDark = false + if (!wakeProcess.running) wakeProcess.running = true + if (lockRequested) armBlankTimer() + } + + function runBlank() { ++ markDark() + if (!blankProcess.running) blankProcess.running = true + } + ++ function markDark() { ++ if (!lockRequested) return ++ blankSerial += 1 ++ displayDark = true ++ } ++ + function submitPassword(value) { + var password = String(value || "") + if (!lockRequested || authenticatingPassword || password.length === 0) return +@@ -280,6 +297,9 @@ + + LockView { + keypad: root.keypad ++ wakeSerial: root.wakeSerial ++ blankSerial: root.blankSerial ++ displayDark: root.displayDark + id: lockView + anchors.fill: parent + backgroundPath: root.backgroundPath +@@ -548,10 +568,21 @@ + // it and re-arm the blank timer (a phone's power button). + function wake(): string { + if (!root.currentlyLocked()) return "unlocked" ++ root.wakeSerial += 1 + root.runWake() + return "ok" + } + ++ // The locked display went dark some other way than the lock's own blank ++ // (a phone's power button, or just before sleep): back to the glance ++ // view, and the touch that next wakes the screen only wakes it. The ++ // display itself is left as it is. ++ function dark(): string { ++ if (!root.currentlyLocked()) return "unlocked" ++ root.markDark() ++ return "ok" ++ } ++ + function isLocked(): string { + return root.currentlyLocked() ? "true" : "false" + } +diff --git i/shell/plugins/notifications/components/NotificationCard.qml w/shell/plugins/notifications/components/NotificationCard.qml +--- i/shell/plugins/notifications/components/NotificationCard.qml ++++ w/shell/plugins/notifications/components/NotificationCard.qml +@@ -27,6 +27,11 @@ + property int urgency: 1 + property double timestamp: 0 + property int cornerRadius: 0 ++ // A static summary (a phone's lock screen) keeps each card short, and ++ // says beside the summary how many there are and how old ("2 new, 5m"). ++ property int summaryLines: 2 ++ property int bodyLines: 3 ++ property string detail: "" + + // System monospace font injected by the container. + property string fontFamily: "" +@@ -300,7 +305,7 @@ + font.bold: true + wrapMode: Text.WordWrap + elide: Text.ElideRight +- maximumLineCount: 2 ++ maximumLineCount: root.summaryLines + } + + Text { +@@ -314,9 +319,19 @@ + font.pixelSize: Style.font.title + wrapMode: Text.WordWrap + elide: Text.ElideRight +- maximumLineCount: 3 ++ maximumLineCount: root.bodyLines + } + } ++ ++ Text { ++ textFormat: Text.PlainText ++ Layout.alignment: Qt.AlignTop ++ visible: root.detail.length > 0 ++ text: root.detail ++ color: root.dimColor ++ font.family: root.fontFamily ++ font.pixelSize: Style.font.bodySmall ++ } + } + + // Reply, then a field with Send and Cancel, each tall enough to tap on diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0024-app-icons-keep-the-largest-size.patch b/packages/omamobile-omarchy/legacy-4.0.6/0024-app-icons-keep-the-largest-size.patch new file mode 100644 index 000000000..f8ad213c4 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0024-app-icons-keep-the-largest-size.patch @@ -0,0 +1,39 @@ +# App icons: the icon index keeps the largest size per name, not the first +# file found. The scan lists SVGs first, then PNGs in directory order, and +# kept the first hit, so a raster-only app such as Chromium (16 to 256 px +# PNGs, no SVG) resolved to its 32x32 file, drawn soft on a phone's home +# screen at 64 logical (192 physical) pixels. An SVG or a "scalable" path +# still wins over any size; then the larger NxN directory (@Nx scaled). +# Candidate for upstream Omarchy. +diff --git i/shell/services/AppLibrary.qml w/shell/services/AppLibrary.qml +--- i/shell/services/AppLibrary.qml ++++ w/shell/services/AppLibrary.qml +@@ -136,6 +136,17 @@ + ].join(' ') + } + ++ // The size an icon path was drawn for: "scalable" or an SVG beats any ++ // size, then the larger NxN directory wins, so a raster-only app (Chromium ++ // ships 16 to 256 px PNGs) isn't drawn from its 32 px file at a home ++ // screen's 192 physical pixels. Pixmaps and unsized paths come last. ++ function iconPathSize(path) { ++ if (/\.svg$/.test(path) || path.indexOf("/scalable/") >= 0) return 100000 ++ var m = /\/(\d+)x\d+(@\d+x)?\//.exec(path) ++ if (!m) return 0 ++ return parseInt(m[1], 10) * (m[2] ? parseInt(m[2].slice(1), 10) : 1) ++ } ++ + function indexIconLine(path) { + var value = String(path || "").trim() + if (value.length === 0) return +@@ -143,7 +154,9 @@ + var file = slash >= 0 ? value.slice(slash + 1) : value + var dot = file.lastIndexOf(".") + var name = dot > 0 ? file.slice(0, dot) : file +- if (name.length > 0 && root.pendingIconIndex[name] === undefined) ++ if (name.length === 0) return ++ var known = root.pendingIconIndex[name] ++ if (known === undefined || iconPathSize(value) > iconPathSize(known)) + root.pendingIconIndex[name] = value + } + diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0025-launch-no-toast-for-shell-surfaces.patch b/packages/omamobile-omarchy/legacy-4.0.6/0025-launch-no-toast-for-shell-surfaces.patch new file mode 100644 index 000000000..faabb29e4 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0025-launch-no-toast-for-shell-surfaces.patch @@ -0,0 +1,30 @@ +# App launch: no "Launching ..." toast for a desktop entry that runs +# omarchy-shell. Such an entry opens a shell surface (on the phone the +# Updates entry summons the update sheet), never a toplevel, so the toast +# waited for a window that never came and sat over the sheet's buttons +# until its timeout. Every other launch keeps the toast. Candidate for +# upstream Omarchy. +diff --git i/shell/services/AppLibrary.qml w/shell/services/AppLibrary.qml +--- i/shell/services/AppLibrary.qml ++++ w/shell/services/AppLibrary.qml +@@ -74,10 +74,19 @@ + if (!iconIndexScan.running) iconIndexScan.running = true + } + ++ // An entry that runs omarchy-shell opens a shell surface (a panel or a ++ // sheet), never a window, so the launch toast would wait for a toplevel ++ // that doesn't come and cover the surface until it times out. ++ function launchesShellSurface(id) { ++ var entry = DesktopEntries.byId(id) ++ var command = entry && entry.command ? entry.command : [] ++ return command.length > 0 && String(command[0]).replace(/^.*\//, "") === "omarchy-shell" ++ } ++ + function launch(desktopId, name) { + var id = String(desktopId || "") + if (!id) return +- root.beginLaunchFeedback(name) ++ if (!root.launchesShellSurface(id)) root.beginLaunchFeedback(name) + // Start gtk-launch inside a scope under app-graphical.slice so apps do not + // inherit wayland-wm@.service. Keeping gtk-launch as the desktop-entry + // resolver supports IDs with spaces and entries that UWSM rejects. diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0026-lock-battery-status.patch b/packages/omamobile-omarchy/legacy-4.0.6/0026-lock-battery-status.patch new file mode 100644 index 000000000..daae350e2 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0026-lock-battery-status.patch @@ -0,0 +1,238 @@ +# Lock: the battery on the lock screen, top right, as the phone's status bar +# shows it: the bar's Nerd Font battery glyph at the level (the glyph carries +# a bolt while charging, a plug when full, exactly as the bar's does; no +# second bolt) and the percentage. On every omamobile device with a battery, +# over the glance view and the PIN view alike; a device with no battery (a +# desktop test box) shows nothing, never "No battery". +# +# Read from the kernel's power supplies (LockBattery.js): the first present +# Battery whose scope is not Device gives the percentage (a paired keyboard, +# mouse or controller is a Battery too, hid-…-battery, scope Device, and +# sorts before the phone's max170xx_battery; the gauges set no scope, so +# they read as empty and count; scope is read before capacity, which can +# wake a HID device); charging is any charger supply (Mains, USB, USB_C, +# USB_PD, Wireless) online, or that same battery, no other, saying Charging +# or Full. The charger's online flag is the signal +# that holds: the fuel gauge says Discharging whenever the net current is +# negative, even with the charger plugged in, and UPower's OnBattery follows +# the battery's state, so the bar's `!UPower.onBattery` can miss it (and +# Quickshell's UPower exposes no line-power Online to ask instead). One +# bash process every 15 s while the display is lit, one at each wake, none +# while it is dark. A reading that hangs is cut by timeout(1) and a 4 s +# stale timer, and clears the state; the bolt is dropped when the display +# goes dark so a wake never paints a stale one before its own reading. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003, 0009, 0011, 0014, 0023. +diff --git i/shell/plugins/lock/LockBattery.js w/shell/plugins/lock/LockBattery.js +new file mode 100644 +--- /dev/null ++++ w/shell/plugins/lock/LockBattery.js +@@ -0,0 +1,61 @@ ++// The lock's battery reading, from the kernel's power supplies ++// (/sys/class/power_supply). The first battery that is present and whose ++// scope is not Device gives the percentage: a paired keyboard, mouse or ++// game controller is a Battery supply too (hid-…-battery, ++// ps-controller-battery-…), present, with scope Device, and sorts before ++// the phone's gauge (max170xx_battery); the gauges set no scope, so it ++// reads as empty and they count. Charging is any charger supply (Mains, ++// USB, USB_C, USB_PD, Wireless) online, or that same battery, no other, ++// saying Charging or Full. The charger's online flag is the truthful ++// signal: a fuel gauge reports Discharging whenever the net current is ++// negative, even with the charger plugged in. ++ ++// One line per supply: type, present, capacity, status, online, scope, ++// tab-separated. Type and scope are read first, and a Device-scope battery ++// is skipped before its capacity is read (a read that can wake a HID device). ++var COMMAND = "shopt -s nullglob; for d in \"$1\"/*/; do t= sc= p= c= s= o=; " + ++ "read -r t 2>/dev/null < \"$d/type\"; read -r sc 2>/dev/null < \"$d/scope\"; " + ++ "[ \"$t\" = Battery ] && [ \"$sc\" = Device ] && continue; " + ++ "read -r p 2>/dev/null < \"$d/present\"; read -r c 2>/dev/null < \"$d/capacity\"; " + ++ "read -r s 2>/dev/null < \"$d/status\"; read -r o 2>/dev/null < \"$d/online\"; " + ++ "printf '%s\\t%s\\t%s\\t%s\\t%s\\t%s\\n' \"$t\" \"$p\" \"$c\" \"$s\" \"$o\" \"$sc\"; done" ++ ++var CHARGERS = ["Mains", "USB", "USB_C", "USB_PD", "Wireless"] ++ ++function parse(text) { ++ var out = { present: false, percent: -1, charging: false, full: false } ++ var lines = String(text || "").split("\n") ++ for (var i = 0; i < lines.length; i++) { ++ var f = lines[i].split("\t") ++ if (f.length < 5) continue ++ var type = f[0], present = f[1], capacity = f[2], status = f[3], online = f[4], scope = f[5] || "" ++ if (type === "Battery" && present !== "0" && scope !== "Device") { ++ // The first such battery is the one; its status alone says Charging or ++ // Full, a peripheral's never does. ++ if (!out.present && /^[0-9]+$/.test(capacity)) { ++ out.present = true ++ out.percent = Math.max(0, Math.min(100, parseInt(capacity, 10))) ++ if (status === "Charging" || status === "Full") out.charging = true ++ if (status === "Full") out.full = true ++ } ++ } else if (CHARGERS.indexOf(type) >= 0 && online === "1") { ++ out.charging = true ++ } ++ } ++ return out ++} ++ ++// The status bar's glyphs (omamobile.bar StatusModel.batteryIcon): a battery ++// at the level, with a bolt while charging, a plug when full. ++function icon(percent, charging, full) { ++ if (percent < 0) return "" ++ if (full) return "󰂅" ++ var chargingIcons = ["󰢜", "󰂆", "󰂇", "󰂈", "󰢝", "󰂉", "󰢞", "󰂊", "󰂋", "󰂅"] ++ var defaultIcons = ["󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"] ++ var index = Math.max(0, Math.min(9, Math.floor(percent / 10))) ++ return charging ? chargingIcons[index] : defaultIcons[index] ++} ++ ++if (typeof module !== "undefined") { ++ module.exports = { COMMAND: COMMAND, parse: parse, icon: icon } ++} +diff --git i/shell/plugins/lock/LockBattery.qml w/shell/plugins/lock/LockBattery.qml +new file mode 100644 +--- /dev/null ++++ w/shell/plugins/lock/LockBattery.qml +@@ -0,0 +1,122 @@ ++import QtQuick ++import Quickshell.Io ++import qs.Commons ++import qs.Commons as Commons ++import "LockBattery.js" as Battery ++ ++// The battery on the lock, as the status bar shows it: the bar's battery ++// glyph (which carries the bolt while charging, the plug when full) and the ++// percentage. Read from the kernel's power supplies (LockBattery.js; a ++// peripheral's Device-scope battery never counts) every 15 s while the ++// display is lit, and at each wake. Nothing at all without a battery. ++Item { ++ id: battery ++ ++ // Polled while lit; a bump of wakeSerial reads at once. ++ property bool lit: true ++ property int wakeSerial: 0 ++ ++ property bool present: false ++ property int percent: -1 ++ property bool charging: false ++ property bool full: false ++ readonly property bool low: present && percent <= 10 && !charging ++ ++ visible: present ++ implicitWidth: row.implicitWidth ++ implicitHeight: row.implicitHeight ++ ++ function refresh() { ++ if (supplies.running) return ++ supplies.running = true ++ stale.restart() ++ } ++ ++ function clear() { ++ present = false ++ percent = -1 ++ charging = false ++ full = false ++ } ++ ++ onLitChanged: { ++ if (lit) { ++ refresh() ++ } else { ++ // Dark: the charger may go while nobody looks. Keep the level, drop ++ // the bolt, so the next wake never paints a stale one; the wake's ++ // reading puts it back if the charger is still there. ++ charging = false ++ full = false ++ } ++ } ++ onWakeSerialChanged: refresh() ++ Component.onCompleted: refresh() ++ ++ Timer { ++ interval: 15000 ++ repeat: true ++ running: battery.lit ++ onTriggered: battery.refresh() ++ } ++ ++ // A reading that never comes back (a sysfs read that hangs) must not hold ++ // the last state up: after the deadline the process is stopped and the ++ // state cleared; the next tick or wake reads again. ++ Timer { ++ id: stale ++ interval: 4000 ++ onTriggered: { ++ if (!supplies.running) return ++ supplies.running = false ++ battery.clear() ++ } ++ } ++ ++ Process { ++ id: supplies ++ // timeout(1) ends a bash stuck on a sysfs read before the stale timer ++ // would; a failed or killed run clears the state as an empty one does. ++ command: ["timeout", "-k", "1", "3", "bash", "-c", Battery.COMMAND, "--", "/sys/class/power_supply"] ++ stdout: StdioCollector { ++ waitForEnd: true ++ onStreamFinished: { ++ stale.stop() ++ var s = Battery.parse(String(text || "")) ++ battery.present = s.present ++ battery.percent = s.percent ++ battery.charging = s.charging ++ battery.full = s.full ++ } ++ } ++ onExited: function(exitCode, exitStatus) { ++ stale.stop() ++ if (exitCode !== 0) battery.clear() ++ } ++ } ++ ++ Row { ++ id: row ++ spacing: Style.space(6) ++ ++ Text { ++ objectName: "lockBatteryIcon" ++ anchors.verticalCenter: parent.verticalCenter ++ textFormat: Text.PlainText ++ text: Battery.icon(battery.percent, battery.charging, battery.full) ++ color: battery.low ? Commons.Color.lock.textError : Commons.Color.lock.text ++ font.family: Style.font.family ++ font.pixelSize: Math.round(Style.font.title * 1.2) ++ } ++ ++ Text { ++ objectName: "lockBatteryPercent" ++ anchors.verticalCenter: parent.verticalCenter ++ textFormat: Text.PlainText ++ text: battery.percent + "%" ++ color: battery.low ? Commons.Color.lock.textError : Commons.Color.lock.text ++ font.family: Style.font.family ++ font.pixelSize: Style.font.title ++ } ++ } ++} +diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml +--- i/shell/plugins/lock/LockView.qml ++++ w/shell/plugins/lock/LockView.qml +@@ -437,5 +437,16 @@ Item { + lock: root + pinTop: root.keypadClearsSensor ? keypadHint.y : inputField.y + } ++ ++ // The battery, top right, over the glance and the PIN view alike; shown ++ // only on a device that has one. ++ LockBattery { ++ objectName: "lockBattery" ++ anchors.top: parent.top ++ anchors.right: parent.right ++ anchors.margins: Style.space(24) ++ lit: !root.displayDark ++ wakeSerial: root.wakeSerial ++ } + } + } diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0027-lock-media-controls.patch b/packages/omamobile-omarchy/legacy-4.0.6/0027-lock-media-controls.patch new file mode 100644 index 000000000..44f47da71 --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0027-lock-media-controls.patch @@ -0,0 +1,623 @@ +# Lock: media controls, as a phone has them, for whatever plays or is +# paused (MPRIS, Quickshell.Services.Mpris): on the glance a card above the +# notifications, in their palette, with the album art, the title, the +# artist, the app's name, how far the track has played, and previous, +# play/pause and next; on the PIN view a single row above the small clock, +# in the lock's palette, only when the PIN view has the room (with +# fingerprints set up the pad reaches up to the clock, and the row is left +# out rather than crowd it). No player, nothing. +# +# Transport only: no tap opens the app (no MPRIS Raise, nothing started), +# no seeking, no choosing another player. On the glance the touch area over +# everything hands a tap on a control to it (LockMedia.buttonAt); a tap +# elsewhere on the card does nothing, a swipe up from it still goes to the +# PIN view, and the touch that wakes a dark screen only wakes it. +# +# Which player: one that plays or is paused and has a title; playing +# before paused, then the one that started or changed track last; Omarchy's +# media service's proxy rule (MediaModel.isProxyPlayer: playerctld only +# repeats another player) from its own MediaModel.js. The same order as +# the phone shade's media card (omamobile-shell's MediaModel.js). +# +# Privacy: the lock loads local art only (a file the player wrote, or a +# data: image); a cover on the network (https://) would be a request from +# the locked phone nobody asked for, so the app's icon stands in. With the +# lock-hide-notification-text toggle on, the app's name and "Playing" or +# "Paused" stand in for the track, and no art shows. The position is asked +# for once a second while a player plays and the display is lit, never +# while it is dark. On a computer (keypad off) nothing shows. +# +# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0023 and 0026. +diff --git i/shell/plugins/lock/LockGlance.qml w/shell/plugins/lock/LockGlance.qml +--- i/shell/plugins/lock/LockGlance.qml ++++ w/shell/plugins/lock/LockGlance.qml +@@ -22,6 +22,11 @@ + // clock format and the home screen's last weather reading. Nothing here + // acts on a notification or asks the network. + // ++// While a player plays or is paused, media controls (LockMedia.qml) sit ++// above the cards on the glance, and in a row above the small clock on the ++// PIN view when it has the room: previous, play/pause and next, nothing ++// more (no app, no seeking). ++// + // On a computer (keypad off) it shows nothing and reads nothing but the + // bar's clock format. + Item { +@@ -137,8 +142,8 @@ + } + + function refit() { +- var avail = cardsArea.height + var gap = cardsColumn.spacing ++ var avail = cardsArea.height - (glanceMedia.visible ? glanceMedia.implicitHeight + gap : 0) + var moreHeight = moreLabel.implicitHeight + gap + var used = 0 + var n = 0 +@@ -286,6 +291,13 @@ + precision: SystemClock.Minutes + } + ++ // The player the media controls show; its position asked for only while ++ // the lock is lit. ++ LockMediaSource { ++ id: mediaSource ++ ticking: glance.active && !!glance.lock && !glance.lock.displayDark ++ } ++ + Process { + id: notificationsProc + command: ["bash", "-c", "shopt -s nullglob; set -- \"$1\"*.json \"$1\"history/*.json; (($#)) && awk 1 \"$@\" 2>/dev/null; true", +@@ -367,6 +379,25 @@ + font.pixelSize: Style.font.display + } + ++ // Media controls in one row under the battery, above the small clock; ++ // left out when the PIN view has no room for them there. ++ LockMedia { ++ id: pinMedia ++ objectName: "lockPinMedia" ++ anchors.horizontalCenter: parent.horizontalCenter ++ y: Style.space(72) ++ width: Math.min(Style.space(380), parent.width - Style.space(32)) ++ height: implicitHeight ++ compact: true ++ textColor: Commons.Color.lock.text ++ player: glance.active ? mediaSource.player : null ++ hideText: glance.hideText ++ readonly property bool fits: y + implicitHeight + Style.space(12) <= pinClock.y ++ visible: !!player && fits && glance.progress < 1 ++ opacity: 1 - glance.progress ++ onActivity: glance.lock.wakeRequested() ++ } ++ + // ---------------------------------------------------------------- glance + + Item { +@@ -451,6 +482,18 @@ + width: parent.width + spacing: Style.space(10) + ++ LockMedia { ++ id: glanceMedia ++ objectName: "lockGlanceMedia" ++ width: cardsColumn.width ++ height: implicitHeight ++ player: glance.active ? mediaSource.player : null ++ hideText: glance.hideText ++ onActivity: glance.noteActivity() ++ onImplicitHeightChanged: Qt.callLater(glance.refit) ++ onVisibleChanged: Qt.callLater(glance.refit) ++ } ++ + Repeater { + id: cardsRepeater + model: glance.shownCards +@@ -508,6 +551,7 @@ + width: parent.width + visible: glance.cards.length === 0 + horizontalAlignment: Text.AlignHCenter ++ topPadding: glanceMedia.visible ? Style.space(14) : 0 + textFormat: Text.PlainText + text: "No new notifications" + color: Commons.Color.lock.placeholder +@@ -610,6 +654,12 @@ + return + } + if (Math.abs(moved) < Style.space(12) && Math.abs(mouse.x - startX) < Style.space(12)) { ++ // A media control's tap; elsewhere on the media card, nothing. ++ var control = glanceMedia.visible ? glanceMedia.buttonAt(swipe, mouse.x, mouse.y) : null ++ if (control) { ++ glanceMedia.run(control.action) ++ return ++ } + var card = glance.cardAt(swipe, mouse.x, mouse.y) + if (card) glance.toggleCard(card.modelData.file) + } +diff --git i/shell/plugins/lock/LockMedia.js w/shell/plugins/lock/LockMedia.js +new file mode 100644 +--- /dev/null ++++ w/shell/plugins/lock/LockMedia.js +@@ -0,0 +1,124 @@ ++// What the lock's media controls show: which MPRIS player, what it says and ++// which art may load. Pure functions over objects with MprisPlayer's ++// property names, so Node can test them. The order is the phone shade's ++// (omamobile-shell's MediaModel.js): only a player that plays or is paused ++// and has a title; playing before paused; among those the one that started ++// or changed track last; playerctld (a proxy that repeats another player, ++// Omarchy's media service's isProxyPlayer) only when nothing else is there. ++// ++// The lock loads local art only: a file the player wrote, or a data: image. ++// Art on the network (Spotify's https:// covers, a browser's) would be a ++// request from the locked phone that nobody asked for, so the app's icon ++// stands in. ++ ++// MprisPlaybackState.Enum: Stopped, Playing, Paused ++var PLAYING = 1 ++var PAUSED = 2 ++ ++function str(value) { ++ return value === undefined || value === null ? "" : String(value) ++} ++ ++function key(player) { ++ if (!player) return "" ++ return str(player.dbusName || player.desktopEntry || player.identity) ++} ++ ++function playing(player) { ++ return !!player && (!!player.isPlaying || player.playbackState === PLAYING) ++} ++ ++function showable(player) { ++ if (!player || !str(player.trackTitle)) return false ++ return playing(player) || player.playbackState === PAUSED ++} ++ ++// isProxy(player) -> bool: Omarchy's MediaModel.isProxyPlayer. ++function pick(players, order, isProxy) { ++ var list = [] ++ var all = players || [] ++ for (var i = 0; i < all.length; i++) if (showable(all[i])) list.push(all[i]) ++ if (list.length === 0) return null ++ if (isProxy) { ++ var real = list.filter(function(p) { return !isProxy(p) }) ++ if (real.length > 0) list = real ++ } ++ var rank = order || {} ++ list.sort(function(a, b) { ++ if (playing(a) !== playing(b)) return playing(a) ? -1 : 1 ++ return (rank[key(b)] || 0) - (rank[key(a)] || 0) ++ }) ++ return list[0] ++} ++ ++function appName(player) { ++ if (!player) return "" ++ var identity = str(player.identity) ++ if (identity) return identity ++ var entry = str(player.desktopEntry) ++ if (entry) return entry ++ return str(player.dbusName).replace(/^org\.mpris\.MediaPlayer2\./, "").replace(/\.instance[0-9_]+$/, "") ++} ++ ++function artist(player) { ++ if (!player) return "" ++ var a = str(player.trackArtist) ++ if (a) return a ++ var list = player.trackArtists ++ if (list && list.length) { ++ var out = [] ++ for (var i = 0; i < list.length; i++) if (str(list[i])) out.push(str(list[i])) ++ return out.join(", ") ++ } ++ return "" ++} ++ ++// Local art only; "" for the app's icon. ++function artSource(url) { ++ var u = str(url).trim() ++ if (!u) return "" ++ if (u.charAt(0) === "/") return "file://" + u.split("/").map(encodeURIComponent).join("/") ++ var lower = u.toLowerCase() ++ if (lower.indexOf("file:///") === 0) return u ++ if (lower.indexOf("data:image/") === 0) return u ++ return "" ++} ++ ++function hasTimeline(player) { ++ return !!player && !!player.positionSupported && !!player.lengthSupported ++ && Number(player.length) > 0 && isFinite(Number(player.length)) ++} ++ ++function fraction(position, length) { ++ var l = Number(length) ++ if (!(l > 0) || !isFinite(l)) return 0 ++ return Math.max(0, Math.min(1, (Number(position) || 0) / l)) ++} ++ ++function canPlayPause(player) { ++ return !!player && (!!player.canTogglePlaying || !!player.canPlay || !!player.canPause) ++} ++ ++// The lines the controls show: with the lock's hide-notification-text ++// toggle on, the app and whether it plays, never the track. ++function lines(player, hideText) { ++ if (!player) return { title: "", detail: "" } ++ if (hideText) return { title: appName(player), detail: playing(player) ? "Playing" : "Paused" } ++ var a = artist(player) ++ return { title: str(player.trackTitle), detail: a } ++} ++ ++function accessibleName(player, hideText) { ++ if (!player) return "" ++ var l = lines(player, hideText) ++ var parts = [l.title, hideText ? "" : l.detail, hideText ? "" : appName(player)].filter(function(p) { return !!p }) ++ return (playing(player) ? "Playing: " : "Paused: ") + parts.join(", ") ++} ++ ++if (typeof module !== "undefined") { ++ module.exports = { ++ PLAYING: PLAYING, PAUSED: PAUSED, key: key, playing: playing, showable: showable, pick: pick, ++ appName: appName, artist: artist, artSource: artSource, hasTimeline: hasTimeline, fraction: fraction, ++ canPlayPause: canPlayPause, lines: lines, accessibleName: accessibleName ++ } ++} +diff --git i/shell/plugins/lock/LockMedia.qml w/shell/plugins/lock/LockMedia.qml +new file mode 100644 +--- /dev/null ++++ w/shell/plugins/lock/LockMedia.qml +@@ -0,0 +1,297 @@ ++import QtQuick ++import Quickshell ++import qs.Commons ++import qs.Commons as Commons ++import qs.Ui ++import "LockMedia.js" as Media ++ ++// Media controls on the lock: the art (local only, LockMedia.js; else the ++// app's icon), the track and the app's name, how far it has played, and ++// previous, play/pause and next. Transport only: nothing here opens the ++// app, seeks, picks another player or reaches anything past the lock. ++// With the lock-hide-notification-text toggle on, the app's name and ++// "Playing" or "Paused" stand in for the track, and no art shows. ++// ++// On the glance it is a card above the notifications, in their palette ++// (the glance's touch area over it hands its taps to buttonAt); on the PIN ++// view, `compact`, a single row in the lock's palette with its own touch. ++BorderSurface { ++ id: media ++ ++ property var player: null ++ property bool compact: false ++ property bool hideText: false ++ property color textColor: Commons.Color.notifications.text ++ // Called before a control acts (the lock counts it as activity). ++ signal activity() ++ ++ readonly property int touchSize: Math.max(44, Style.space(44)) ++ readonly property int inner: Style.space(compact ? 8 : 14) ++ readonly property int artSize: compact ? touchSize : Math.max(56, Style.space(56)) ++ readonly property bool isPlaying: Media.playing(player) ++ readonly property var shown: Media.lines(player, hideText) ++ readonly property string artUrl: player && !hideText ? Media.artSource(player.trackArtUrl) : "" ++ readonly property var desktopEntry: { ++ if (!player) return null ++ var names = [player.desktopEntry, player.identity] ++ for (var i = 0; i < names.length; i++) { ++ var n = String(names[i] || "") ++ if (!n) continue ++ var e = typeof DesktopEntries.heuristicLookup === "function" ? DesktopEntries.heuristicLookup(n) : DesktopEntries.byId(n) ++ if (e) return e ++ } ++ return null ++ } ++ readonly property string iconSource: { ++ var icon = desktopEntry && desktopEntry.icon ? String(desktopEntry.icon) : "" ++ if (!icon) return "" ++ if (icon.charAt(0) === "/") return "file://" + icon ++ return Quickshell.iconPath(icon, true) ++ } ++ ++ visible: !!player ++ implicitHeight: !player ? 0 : compact ? artSize + inner * 2 : column.implicitHeight + inner * 2 ++ radius: Style.cornerRadius ++ color: compact ? Commons.Color.lock.background : Commons.Color.notifications.background ++ borderSpec: compact ? Border.surfaceSpec("lock", "border", Commons.Color.lock.border, Math.max(1, Style.space(2)), "border-alpha") ++ : Border.surfaceSpec("notifications", "border", Commons.Color.notifications.border, Math.max(1, Style.space(2))) ++ ++ Accessible.role: Accessible.Grouping ++ Accessible.name: Media.accessibleName(player, hideText) ++ ++ // The control under a point of `item`, if it can act; the glance's touch ++ // area asks this for a tap. ++ function buttonAt(item, x, y) { ++ var buttons = [previousButton, playButton, nextButton] ++ for (var i = 0; i < buttons.length; i++) { ++ var b = buttons[i] ++ if (!b.visible || !b.enabled) continue ++ var p = item.mapToItem(b, x, y) ++ if (p.x >= 0 && p.y >= 0 && p.x <= b.width && p.y <= b.height) return b ++ } ++ return null ++ } ++ ++ function run(action) { ++ var p = player ++ if (!p) return false ++ activity() ++ if (action === "previous" && p.canGoPrevious) p.previous() ++ else if (action === "next" && p.canGoNext) p.next() ++ else if (action === "playPause" && Media.canPlayPause(p)) { ++ if (p.isPlaying && p.canPause) p.pause() ++ else if (!p.isPlaying && p.canPlay) p.play() ++ else p.togglePlaying() ++ } else return false ++ return true ++ } ++ ++ // ---- art, or the app's icon, or Omarchy's media glyph ++ BorderSurface { ++ id: artFrame ++ objectName: "lockMediaArt" ++ x: media.inner ++ y: media.inner ++ width: media.artSize ++ height: media.artSize ++ radius: Style.cornerRadius ++ clip: true ++ color: Style.normalFillFor(media.textColor, Commons.Color.accent) ++ borderSpec: Border.controlSpec("normal", media.textColor, Commons.Color.accent) ++ ++ Image { ++ id: art ++ anchors.fill: parent ++ anchors.margins: artFrame.borderLeft ++ fillMode: Image.PreserveAspectCrop ++ asynchronous: true ++ sourceSize.width: media.artSize * 2 ++ sourceSize.height: media.artSize * 2 ++ source: media.artUrl ++ visible: status === Image.Ready ++ } ++ ++ Image { ++ id: appIcon ++ anchors.centerIn: parent ++ width: Math.round(media.artSize * 0.6) ++ height: width ++ fillMode: Image.PreserveAspectFit ++ asynchronous: true ++ sourceSize.width: width * 2 ++ sourceSize.height: height * 2 ++ source: art.visible ? "" : media.iconSource ++ visible: !art.visible && status === Image.Ready ++ } ++ ++ Text { ++ anchors.centerIn: parent ++ visible: !art.visible && !appIcon.visible ++ textFormat: Text.PlainText ++ text: "󰝚" ++ color: media.textColor ++ font.family: Style.font.family ++ font.pixelSize: media.compact ? Style.font.title : Style.font.display ++ } ++ } ++ ++ Column { ++ id: column ++ x: media.inner ++ y: media.inner ++ width: media.width - media.inner * 2 ++ spacing: Style.space(8) ++ ++ // The words beside the art (and, compact, the controls after them). ++ Item { ++ width: parent.width ++ height: media.artSize ++ ++ Column { ++ anchors.left: parent.left ++ anchors.leftMargin: media.artSize + Style.space(12) ++ anchors.right: parent.right ++ anchors.rightMargin: media.compact ? controls.width + Style.space(8) : 0 ++ anchors.verticalCenter: parent.verticalCenter ++ spacing: Style.space(2) ++ ++ Text { ++ objectName: "lockMediaApp" ++ width: parent.width ++ visible: !media.compact && !media.hideText && text !== "" ++ textFormat: Text.PlainText ++ text: Media.appName(media.player) ++ color: Qt.darker(media.textColor, 1.4) ++ font.family: Style.font.family ++ font.pixelSize: Math.max(12, Style.font.caption) ++ elide: Text.ElideRight ++ } ++ ++ Text { ++ objectName: "lockMediaTitle" ++ width: parent.width ++ textFormat: Text.PlainText ++ text: media.shown.title ++ color: media.textColor ++ font.family: Style.font.family ++ font.pixelSize: media.compact ? Style.font.body : Style.font.subtitle ++ font.bold: true ++ elide: Text.ElideRight ++ } ++ ++ Text { ++ objectName: "lockMediaDetail" ++ width: parent.width ++ visible: text !== "" ++ textFormat: Text.PlainText ++ text: media.shown.detail ++ color: Qt.darker(media.textColor, 1.15) ++ font.family: Style.font.family ++ font.pixelSize: media.compact ? Math.max(12, Style.font.caption) : Style.font.body ++ elide: Text.ElideRight ++ } ++ } ++ } ++ ++ // How far the track has played: shown, never a seek bar. ++ Item { ++ objectName: "lockMediaProgress" ++ visible: !media.compact && Media.hasTimeline(media.player) ++ width: parent.width ++ height: visible ? Math.max(4, Style.space(4)) : 0 ++ ++ Rectangle { ++ anchors.fill: parent ++ radius: height / 2 ++ color: Style.selectedFillFor(media.textColor, Commons.Color.accent) ++ } ++ ++ Rectangle { ++ height: parent.height ++ radius: height / 2 ++ width: parent.width * (media.player ? Media.fraction(media.player.position, media.player.length) : 0) ++ color: Commons.Color.accent ++ } ++ } ++ ++ // Room for the controls under the words, on the glance. ++ Item { ++ visible: !media.compact ++ width: parent.width ++ height: visible ? media.touchSize : 0 ++ } ++ } ++ ++ Row { ++ id: controls ++ anchors.right: media.compact ? parent.right : undefined ++ anchors.rightMargin: media.compact ? media.inner : 0 ++ anchors.horizontalCenter: media.compact ? undefined : parent.horizontalCenter ++ y: media.compact ? media.inner + (media.artSize - media.touchSize) / 2 : media.height - media.inner - media.touchSize ++ spacing: media.compact ? Style.space(2) : Style.space(24) ++ ++ MediaButton { ++ id: previousButton ++ objectName: "lockMediaPrevious" ++ glyph: "󰒮" ++ name: "Previous track" ++ action: "previous" ++ enabled: !!media.player && !!media.player.canGoPrevious ++ } ++ ++ MediaButton { ++ id: playButton ++ objectName: "lockMediaPlayPause" ++ glyph: media.isPlaying ? "󰏤" : "󰐊" ++ name: media.isPlaying ? "Pause" : "Play" ++ action: "playPause" ++ primary: true ++ enabled: Media.canPlayPause(media.player) ++ } ++ ++ MediaButton { ++ id: nextButton ++ objectName: "lockMediaNext" ++ glyph: "󰒭" ++ name: "Next track" ++ action: "next" ++ enabled: !!media.player && !!media.player.canGoNext ++ } ++ } ++ ++ component MediaButton: BorderSurface { ++ id: button ++ property string glyph: "" ++ property string name: "" ++ property string action: "" ++ property bool primary: false ++ ++ width: primary && !media.compact ? Math.round(media.touchSize * 1.4) : media.touchSize ++ height: media.touchSize ++ radius: Style.cornerRadius ++ opacity: enabled ? 1 : 0.4 ++ color: buttonTouch.pressed ? Style.pressedFillFor(media.textColor, Commons.Color.accent) ++ : primary ? Util.alpha(Commons.Color.accent, Style.selectedFillAlpha) : "transparent" ++ borderSpec: primary ? Border.controlSpec("selected", media.textColor, Commons.Color.accent) : Border.none() ++ ++ Accessible.role: Accessible.Button ++ Accessible.name: button.name ++ Accessible.onPressAction: if (button.enabled) media.run(button.action) ++ ++ Text { ++ anchors.centerIn: parent ++ textFormat: Text.PlainText ++ text: button.glyph ++ color: button.primary ? Commons.Color.accent : media.textColor ++ font.family: Style.font.family ++ font.pixelSize: Style.font.iconLarge ++ } ++ ++ MouseArea { ++ id: buttonTouch ++ anchors.fill: parent ++ enabled: button.enabled ++ onClicked: media.run(button.action) ++ } ++ } ++} +diff --git i/shell/plugins/lock/LockMediaSource.qml w/shell/plugins/lock/LockMediaSource.qml +new file mode 100644 +--- /dev/null ++++ w/shell/plugins/lock/LockMediaSource.qml +@@ -0,0 +1,52 @@ ++import QtQuick ++import Quickshell.Services.Mpris ++import "../services/media/MediaModel.js" as MediaModel ++import "LockMedia.js" as Media ++ ++// The MPRIS player the lock's media controls show (LockMedia.pick, with ++// Omarchy's media service's proxy rule). The order is kept from when the ++// lock is made: a player that starts playing or changes track goes first ++// among its kind. Its position is asked for once a second while it plays ++// and the display is lit (Quickshell reports it only when asked); nothing ++// runs while the display is dark. ++Item { ++ id: source ++ ++ property var players: Mpris.players ? Mpris.players.values : [] ++ property bool ticking: false ++ ++ property var order: ({}) ++ property int serial: 0 ++ readonly property var player: Media.pick(players, order, MediaModel.isProxyPlayer) ++ ++ function touch(p) { ++ var k = Media.key(p) ++ if (!k) return ++ var next = {} ++ for (var name in order) next[name] = order[name] ++ serial += 1 ++ next[k] = serial ++ order = next ++ } ++ ++ Component.onCompleted: { ++ for (var i = 0; i < players.length; i++) if (Media.playing(players[i])) touch(players[i]) ++ } ++ ++ Instantiator { ++ model: source.players ++ delegate: Connections { ++ required property var modelData ++ target: modelData ++ function onIsPlayingChanged() { if (Media.playing(modelData)) source.touch(modelData) } ++ function onTrackChanged() { source.touch(modelData) } ++ } ++ } ++ ++ Timer { ++ interval: 1000 ++ repeat: true ++ running: source.ticking && !!source.player && Media.playing(source.player) && !!source.player.positionSupported ++ onTriggered: if (source.player) source.player.positionChanged() ++ } ++} diff --git a/packages/omamobile-omarchy/legacy-4.0.6/0028-show-logo-a-stacked-logo-for-a-narrow-terminal.patch b/packages/omamobile-omarchy/legacy-4.0.6/0028-show-logo-a-stacked-logo-for-a-narrow-terminal.patch new file mode 100644 index 000000000..00119b92d --- /dev/null +++ b/packages/omamobile-omarchy/legacy-4.0.6/0028-show-logo-a-stacked-logo-for-a-narrow-terminal.patch @@ -0,0 +1,60 @@ +# Install terminals: a stacked logo for a terminal narrower than the logo. +# omarchy-launch-floating-terminal-with-presentation starts every install +# and setup screen (Install > AI > Dictation, the security setups, plugin +# add) with omarchy-show-logo, and logo.txt is 81 columns wide. A phone held +# upright fits about 66 at Omarchy's terminal font size, so the logo wrapped +# into a screen of broken blocks above the install's first question. A +# terminal too narrow for it now gets the same wordmark stacked on two lines +# (logo-narrow.txt, 48 columns), and one too narrow for that gets none. The +# width is read from the terminal itself (stty on /dev/tty), so a desktop +# terminal, or a run without one, shows the wide logo as before. Candidate +# for upstream Omarchy. +# +# Against Omarchy 4.0.6 (4.0.6-1). +diff --git i/bin/omarchy-show-logo w/bin/omarchy-show-logo +--- i/bin/omarchy-show-logo ++++ w/bin/omarchy-show-logo +@@ -3,7 +3,18 @@ + # omarchy:summary=Display the Omarchy logo in the terminal using green color. + + clear ++# A terminal narrower than the logo (a phone held upright) gets the logo ++# stacked on two lines, and one narrower still gets none, rather than a logo ++# that wraps into noise. ++logo=$OMARCHY_PATH/logo.txt ++columns=$(stty size 2>/dev/null columns )); then ++ logo=$OMARCHY_PATH/logo-narrow.txt ++ if [[ ! -f $logo ]] || (( $(LC_ALL=C.UTF-8 wc -L <"$logo") > columns )); then ++ logo= ++ fi ++fi + echo -e "\033[32m" +-cat <$OMARCHY_PATH/logo.txt ++[[ -n $logo ]] && cat <"$logo" + echo -e "\033[0m" + echo +diff --git i/logo-narrow.txt w/logo-narrow.txt +new file mode 100644 +--- /dev/null ++++ w/logo-narrow.txt +@@ -0,0 +1,19 @@ ++ ▄▄▄ ++ ▄█████▄ ▄███████████▄ ▄███████ ▄███████ ++███ ███ ███ ███ ███ ███ ███ ███ ███ ++███ ███ ███ ███ ███ ███ ███ ███ ███ ++███ ███ ███ ███ ███ ▄███▄▄▄███ ▄███▄▄▄██▀ ++███ ███ ███ ███ ███ ▀███▀▀▀███ ▀███▀▀▀▀ ++███ ███ ███ ███ ███ ███ ███ ██████████ ++███ ███ ███ ███ ███ ███ ███ ███ ███ ++ ▀█████▀ ▀█ ███ █▀ ███ █▀ ███ ███ ++ ███ █▀ ++ ++ ▄███████ ▄█ █▄ ▄█ █▄ ++ ███ ███ ███ ███ ███ ███ ++ ███ █▀ ███ ███ ███ ███ ++ ███ ▄███▄▄▄███▄ ███▄▄▄███ ++ ███ ▀▀███▀▀▀███ ▀▀▀▀▀▀███ ++ ███ █▄ ███ ███ ▄██ ███ ++ ███ ███ ███ ███ ███ ███ ++ ███████▀ ███ █▀ ▀█████▀ diff --git a/packages/omamobile-omarchy/patches/0030-about-the-logo-above-the-modules-in-a-narrow-terminal.patch b/packages/omamobile-omarchy/legacy-4.0.6/0030-about-the-logo-above-the-modules-in-a-narrow-terminal.patch similarity index 100% rename from packages/omamobile-omarchy/patches/0030-about-the-logo-above-the-modules-in-a-narrow-terminal.patch rename to packages/omamobile-omarchy/legacy-4.0.6/0030-about-the-logo-above-the-modules-in-a-narrow-terminal.patch diff --git a/packages/omamobile-omarchy/patches/bridge-4.0.4-menu-first-frame.patch b/packages/omamobile-omarchy/legacy-4.0.6/bridge-4.0.4-menu-first-frame.patch similarity index 100% rename from packages/omamobile-omarchy/patches/bridge-4.0.4-menu-first-frame.patch rename to packages/omamobile-omarchy/legacy-4.0.6/bridge-4.0.4-menu-first-frame.patch diff --git a/packages/omamobile-omarchy/patches/0001-first-run-let-a-platform-skip-the-keybindings-welcome.patch b/packages/omamobile-omarchy/patches/0001-first-run-let-a-platform-skip-the-keybindings-welcome.patch index d879205b4..b70bf276c 100644 --- a/packages/omamobile-omarchy/patches/0001-first-run-let-a-platform-skip-the-keybindings-welcome.patch +++ b/packages/omamobile-omarchy/patches/0001-first-run-let-a-platform-skip-the-keybindings-welcome.patch @@ -1,15 +1,20 @@ # First run: a platform without a keyboard-first workflow (a phone) skips the # "Learn Keybindings" welcome; omamobile-setup-user marks # welcome-keybindings-not-applicable. Sent upstream as omacom/omarchy#15075. +# +# Omarchy 4.5: rebased only. 4.5 moved the card's title and body into the i18n +# catalog (omarchy-i18n firstRun.keybindings*), which changed the context; the +# guard itself is unchanged and 4.5 still has no opt-out of its own. ---- a/install/user/first-run/welcome.sh -+++ b/install/user/first-run/welcome.sh +diff --git i/install/user/first-run/welcome.sh w/install/user/first-run/welcome.sh +--- i/install/user/first-run/welcome.sh ++++ w/install/user/first-run/welcome.sh @@ -1,3 +1,8 @@ +# A platform without a keyboard-first workflow (a phone, say) opts out of the +# keybindings introduction from its user setup: omarchy-done mark +# welcome-keybindings-not-applicable. +omarchy-done check welcome-keybindings-not-applicable && exit 0 + - # Real newlines, not a literal \n: the card renders the body as it arrives, and - # elides past three lines. - omarchy-notification-send -u critical -g  "Learn Keybindings" \ + # The catalog entry holds a real newline, not a literal \n: the card renders the + # body as it arrives, and elides past three lines. + omarchy-notification-send -u critical -g  "$(omarchy-i18n firstRun.keybindingsTitle)" \ diff --git a/packages/omamobile-omarchy/patches/0003-lock-number-pad-for-touch-only-devices.patch b/packages/omamobile-omarchy/patches/0003-lock-number-pad-for-touch-only-devices.patch index 131ac771a..77b11a959 100644 --- a/packages/omamobile-omarchy/patches/0003-lock-number-pad-for-touch-only-devices.patch +++ b/packages/omamobile-omarchy/patches/0003-lock-number-pad-for-touch-only-devices.patch @@ -3,13 +3,17 @@ # unlocks. The session lock hides every other surface, on-screen keyboards # included, so a phone needs its own digits; a PIN is a numeric password. # -# Against Omarchy 4.0.4 (the edge channel's aarch64 omarchy 4.0.4-2, the same -# files as tag v4.0.4) with 0000 (Commons.Color) applied. 4.0.4 has no -# "Fingerprint reader unavailable" notice, so the hunk that moved it above -# the field is gone and the hint shows whenever fingerprints are set up. -diff --git i/shell/plugins/lock/Keypad.qml w/shell/plugins/lock/Keypad.qml -new file mode 100644 -index 0000000..98ad1ad +# Omarchy 4.5 port (from the 4.0.6 series): same pad, toggle, layout and +# 10 s blank as before. 4.5 changed the lock under it, and the port follows: +# the placeholder is the i18n catalog's "Enter Password" unless the pad is +# shown ("Enter PIN" stays English, as the series' strings always were: the +# catalogs ship outside the patched package); 4.5's held-key guard +# (dropsAutoRepeat) also covers keys typed into the pad; 4.5's focus restore +# after a VT switch gives focus back to the pad's keys, not the field; the +# idle blank timer's 4.5 idleMs carries the 10 s. 4.5's "Fingerprint reader +# unavailable" notice moves above the field with the pad (below it is the +# pad) and replaces the "either unlocks" hint while it shows. + --- /dev/null +++ w/shell/plugins/lock/Keypad.qml @@ -0,0 +1,73 @@ @@ -86,14 +90,14 @@ index 0000000..98ad1ad + } + } +} -diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml -index 3c5f65d..53eef73 100644 --- i/shell/plugins/lock/LockView.qml +++ w/shell/plugins/lock/LockView.qml -@@ -17,8 +17,16 @@ Item { +@@ -19,8 +19,18 @@ property bool loadBackground: true property string passwordText: "" property bool syncingPasswordText: false +- +- readonly property string placeholderText: Commons.I18n.t("lock.enterPassword") + // Touch-only devices: a number pad under the field (the lock-keypad toggle). + property bool keypad: false + // A phone with a fingerprint sensor under the display has it in the lower @@ -102,14 +106,15 @@ index 3c5f65d..53eef73 100644 + // third clear, and a hint above the field says either works, as on Android. + readonly property bool keypadClearsSensor: keypad && fingerprintConfigured + readonly property int keypadBottomMargin: Math.round(height * (keypadClearsSensor ? 0.34 : 0.08)) - -- readonly property string placeholderText: "Enter Password" -+ readonly property string placeholderText: keypad ? "Enter PIN" : "Enter Password" ++ // Whichever line sits above the field with the number pad, for its room. ++ readonly property Item keypadLineAbove: keypadHint.visible || !unavailableNotice.visible ? keypadHint : unavailableNotice ++ ++ readonly property string placeholderText: keypad ? "Enter PIN" : Commons.I18n.t("lock.enterPassword") readonly property int fieldWidth: 381 readonly property int fieldHeight: 67 readonly property int outlineThickness: 3 -@@ -54,7 +62,8 @@ Item { - } +@@ -50,7 +60,8 @@ + signal wakeRequested() function forcePasswordFocus() { - passwordInput.forceActiveFocus() @@ -118,7 +123,18 @@ index 3c5f65d..53eef73 100644 } function clearPassword() { -@@ -115,16 +124,58 @@ Item { +@@ -75,7 +86,9 @@ + // The field loses focus while a password is checked (it is disabled then), + // and forcing focus onto it would not stick until the check ends. + function restorePasswordFocus() { +- if (inputEnabled && passwordInput.enabled && !passwordInput.activeFocus) forcePasswordFocus() ++ if (!inputEnabled || !passwordInput.enabled) return ++ // With the number pad the keys hold focus, not the field. ++ if (keypad ? !keypadKeys.activeFocus : !passwordInput.activeFocus) forcePasswordFocus() + } + + onPasswordTextChanged: syncPasswordText() +@@ -134,16 +147,64 @@ MouseArea { anchors.fill: parent @@ -126,12 +142,18 @@ index 3c5f65d..53eef73 100644 + hoverEnabled: !root.keypad onClicked: { root.wakeRequested(); root.forcePasswordFocus() } onPositionChanged: root.wakeRequested() - } - ++ } ++ + Item { + id: keypadKeys + Keys.onPressed: function(event) { + if (!numberPad.enabled) return ++ root.wakeRequested() ++ // As in the field: a held key types nothing (Omarchy 4.5's guard). ++ if (event.isAutoRepeat && root.dropsAutoRepeat(event.key)) { ++ event.accepted = true ++ return ++ } + if (event.text.length === 1 && event.text >= "0" && event.text <= "9") numberPad.digit(event.text) + else if (event.key === Qt.Key_Backspace) numberPad.backspace() + else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) numberPad.enter() @@ -148,9 +170,9 @@ index 3c5f65d..53eef73 100644 + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: root.keypadBottomMargin -+ // what is left above it for the field, the hint and a margin ++ // what is left above it for the field, the line over it and a margin + maxHeight: parent.height - root.keypadBottomMargin - root.fieldHeight - Style.space(40) -+ - (root.keypadClearsSensor ? keypadHint.height + Style.space(18) : 0) - Style.space(48) ++ - (root.keypadLineAbove.visible ? root.keypadLineAbove.height + Style.space(18) : 0) - Style.space(48) + onDigit: function(value) { + root.wakeRequested() + if (root.failureMessage.length > 0) root.clearFailureRequested() @@ -165,8 +187,8 @@ index 3c5f65d..53eef73 100644 + root.passwordTextEdited("") + if (submitted.length > 0) root.submitPassword(submitted) + } -+ } -+ + } + BorderSurface { id: inputField width: root.fieldWidth @@ -179,7 +201,7 @@ index 3c5f65d..53eef73 100644 color: Commons.Color.lock.background borderSpec: root.inputBorderSpec radius: Style.cornerRadius -@@ -141,7 +192,7 @@ Item { +@@ -160,7 +221,7 @@ anchors.leftMargin: inputField.borderLeft + 18 + root.fingerprintReserve verticalAlignment: TextInput.AlignVCenter horizontalAlignment: TextInput.AlignHCenter @@ -188,12 +210,34 @@ index 3c5f65d..53eef73 100644 clip: true enabled: root.inputEnabled && !root.authenticatingPassword readOnly: root.authenticatingPassword -@@ -216,5 +267,23 @@ Item { - verticalAlignment: Text.AlignVCenter - } +@@ -246,11 +307,18 @@ + // The crossed-out icon has no meaning to a user who has never seen it — it + // is not intuitive that it signals a broken reader — so the words carry the + // explanation and the icon only reinforces it. ++ // With the number pad, the space under the field is the pad's, so the ++ // notice goes above the field, where the hint below would otherwise be. + Text { ++ id: unavailableNotice + objectName: "fingerprintUnavailableNotice" + textFormat: Text.PlainText +- anchors.top: inputField.bottom +- anchors.topMargin: 18 ++ anchors.top: root.keypad ? undefined : inputField.bottom ++ anchors.topMargin: root.keypad ? 0 : 18 ++ anchors.bottom: root.keypad ? inputField.top : undefined ++ anchors.bottomMargin: root.keypad ? Style.space(18) : 0 ++ width: parent.width - Style.space(32) ++ wrapMode: root.keypad ? Text.WordWrap : Text.NoWrap + anchors.horizontalCenter: inputField.horizontalCenter + visible: root.fingerprintConfigured && root.fingerprintUnavailable + text: Commons.I18n.t("lock.fingerprintUnavailable") +@@ -260,5 +328,24 @@ + font.italic: true + horizontalAlignment: Text.AlignHCenter } + -+ // Touch-only devices with fingerprints: say that either unlocks. ++ // Touch-only devices with fingerprints: say that either unlocks. Not ++ // while the reader is unavailable: the notice above says so instead. + Text { + id: keypadHint + objectName: "keypadFingerprintHint" @@ -202,7 +246,7 @@ index 3c5f65d..53eef73 100644 + anchors.bottomMargin: Style.space(18) + anchors.horizontalCenter: inputField.horizontalCenter + width: parent.width - Style.space(32) -+ visible: root.keypadClearsSensor ++ visible: root.keypadClearsSensor && !root.fingerprintUnavailable + text: "Touch the fingerprint sensor or enter your PIN" + color: Commons.Color.lock.text + font.family: Style.font.family @@ -212,19 +256,17 @@ index 3c5f65d..53eef73 100644 + } } } -diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml -index 65fcb19..95726eb 100644 --- i/shell/plugins/lock/Service.qml +++ w/shell/plugins/lock/Service.qml -@@ -23,6 +23,7 @@ Item { +@@ -24,6 +24,7 @@ property bool fingerprintAuthenticating: false property bool passwordPamConfigured: false property bool fingerprintConfigured: false + property bool keypad: false - property bool previewVisible: false - property string enteredPassword: "" - property string pendingPassword: "" -@@ -127,6 +128,7 @@ Item { + property int fingerprintUnreachedStreak: 0 + property bool fingerprintAttemptReachedDevice: false + property bool fingerprintAttemptFastError: false +@@ -215,6 +216,7 @@ } function beginLock() { @@ -232,36 +274,38 @@ index 65fcb19..95726eb 100644 if (!passwordPamConfigured) { logEvent("lock-denied: missing-pam") return false -@@ -267,6 +269,7 @@ Item { - color: Commons.Color.background +@@ -507,6 +509,7 @@ LockView { -+ keypad: root.keypad id: lockView ++ keypad: root.keypad anchors.fill: parent backgroundPath: root.backgroundPath -@@ -298,6 +301,7 @@ Item { + videoPosterPath: root.videoPosterPath +@@ -543,6 +546,7 @@ exclusionMode: ExclusionMode.Ignore LockView { + keypad: root.keypad anchors.fill: parent backgroundPath: root.backgroundPath - backgroundVersion: root.backgroundVersion -@@ -414,7 +418,8 @@ Item { + videoPosterPath: root.videoPosterPath +@@ -766,7 +770,8 @@ Timer { id: idleBlankTimer -- interval: 5000 +- readonly property int idleMs: 5000 + // Touch-only devices (the number pad) get longer to find and use it. -+ interval: root.keypad ? 10000 : 5000 - repeat: false - property double armedAt: 0 - onTriggered: { -@@ -482,6 +487,17 @@ Item { ++ readonly property int idleMs: root.keypad ? 10000 : 5000 + // A resume reaches this as soon as the kernel thaws, seconds before the + // panel lights (on NVIDIA it waits out a VT switch and a modeset), so the + // idle run-up blanked the lock just as it appeared. +@@ -843,6 +848,17 @@ + if (!lockRequested) return + if (authenticatingPassword) idleBlankTimer.stop() else armBlankTimer() - } - ++ } ++ + // Touch-only devices opt into the number pad: omarchy-toggle lock-keypad. + FileView { + id: keypadToggle @@ -271,8 +315,6 @@ index 65fcb19..95726eb 100644 + onLoaded: root.keypad = true + onLoadFailed: root.keypad = false + onFileChanged: reload() -+ } -+ + } + FileView { - path: "/etc/pam.d/omarchy-lock-password" - watchChanges: true diff --git a/packages/omamobile-omarchy/patches/0005-touch-swipe-the-image-picker-and-hold-the-desktop-for-style.patch b/packages/omamobile-omarchy/patches/0005-touch-swipe-the-image-picker-and-hold-the-desktop-for-style.patch index 7deb48d2b..8f76441ed 100644 --- a/packages/omamobile-omarchy/patches/0005-touch-swipe-the-image-picker-and-hold-the-desktop-for-style.patch +++ b/packages/omamobile-omarchy/patches/0005-touch-swipe-the-image-picker-and-hold-the-desktop-for-style.patch @@ -2,30 +2,35 @@ # to a narrow screen, and hold the desktop for the Style menu (there is no # right button or keyboard shortcut on a phone). # -# Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4) with 0000 (Commons.Color) -# applied: only the context of the picker's size properties differs from -# upstream main. +# Omarchy 4.5 port: 4.5 renamed the menu's "style" route to "appearance" +# ("style" stays an alias), so the hold summons "appearance" by its id. The +# swipe follows 4.5's right-to-left reading (Util.readingKey flips the arrow +# keys; the swipe flips the same way) and waits for the picker's reveal +# (layoutSettled), as 4.5's keys do. 4.5's hold-to-preview (PreviewHold) is +# a separate handler and untouched. + diff --git i/shell/plugins/background/Background.qml w/shell/plugins/background/Background.qml -index 0a53b20..546aaaf 100644 --- i/shell/plugins/background/Background.qml +++ w/shell/plugins/background/Background.qml -@@ -105,6 +105,15 @@ Item { +@@ -218,6 +218,17 @@ if (!bgSwitchProc.running) bgSwitchProc.running = true } ++ // Touch screens: hold the desktop for the Appearance menu (4.0's "style" ++ // route; a phone has no right button or keyboard shortcut). + function openStyleMenu() { + if (!styleMenuProc.running) styleMenuProc.running = true + } + + Process { + id: styleMenuProc -+ command: ["omarchy-menu", "summon", "style"] ++ command: ["omarchy-menu", "summon", "appearance"] + } + function openThemeSwitcher() { - if (!themeSwitchProc.running) themeSwitchProc.running = true - } -@@ -313,6 +322,10 @@ Item { + var payload = JSON.stringify({ source: "themes" }) + +@@ -521,6 +532,10 @@ MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton @@ -37,11 +42,10 @@ index 0a53b20..546aaaf 100644 if (mouse.button === Qt.RightButton) root.openThemeSwitcher() else root.openSelector() diff --git i/shell/plugins/image-picker/ImagePicker.qml w/shell/plugins/image-picker/ImagePicker.qml -index b0554f5..0f735f6 100644 --- i/shell/plugins/image-picker/ImagePicker.qml +++ w/shell/plugins/image-picker/ImagePicker.qml -@@ -39,10 +39,11 @@ Item { - property color scrim: Commons.Color.imagePicker.scrim +@@ -55,10 +55,11 @@ + property color foreground: Commons.Color.imagePicker.text property color selectedBorder: Commons.Color.imagePicker.selectedBorder property color unselectedBorder: Commons.Color.imagePicker.unselectedBorder - property int expandedWidth: 768 @@ -55,22 +59,29 @@ index b0554f5..0f735f6 100644 property int sliceSpacing: -30 property int skewOffset: 28 property int bottomChromeHeight: showLabels ? (filterable ? 104 : 74) : (filterable ? 60 : 30) -@@ -435,6 +436,18 @@ Item { +@@ -728,6 +729,25 @@ Component.onCompleted: forceActiveFocus() -+ // Swipe left or right to move through the images on touch screens. ++ // Swipe to move through the images on touch screens: toward the ++ // reading start for the next one, as the arrow keys read. + DragHandler { + target: null + yAxis.enabled: false ++ enabled: root.layoutSettled + property real swipeX: 0 + onActiveTranslationChanged: swipeX = activeTranslation.x + onActiveChanged: { -+ if (active) swipeX = 0 -+ else if (Math.abs(swipeX) > 40) root.selectAdjacent(swipeX < 0 ? 1 : -1) ++ if (active) { ++ swipeX = 0 ++ } else if (Math.abs(swipeX) > 40) { ++ var next = swipeX < 0 ++ if (Commons.I18n.rightToLeft) next = !next ++ root.selectAdjacent(next ? 1 : -1) ++ } + } + } + Repeater { - model: root.imageArray.length - + id: imageCards + model: visibleImages diff --git a/packages/omamobile-omarchy/patches/0006-screensaver-restore-the-cursor-and-hide-the-on-screen-keyboard.patch b/packages/omamobile-omarchy/patches/0006-screensaver-restore-the-cursor-and-hide-the-on-screen-keyboard.patch index 6183995da..296188e42 100644 --- a/packages/omamobile-omarchy/patches/0006-screensaver-restore-the-cursor-and-hide-the-on-screen-keyboard.patch +++ b/packages/omamobile-omarchy/patches/0006-screensaver-restore-the-cursor-and-hide-the-on-screen-keyboard.patch @@ -12,11 +12,16 @@ # marker gone (TOUCH-PLAN 0.5) is what this closes; omamobile-shell's # omamobile-osk-guard is the safety net behind it. # -# Against Omarchy 4.0.6 (stable 4.0.6-1). +# Omarchy 4.5 port: rebased. 4.5 starts each screensaver on a special +# workspace per monitor, hands focus back once they are gone, and turns +# terminal echo off (stty -echo) after setting the black background; the +# mouse-reporting line now follows that. Nothing of the phone's behaviour +# changed. + diff --git i/bin/omarchy-launch-screensaver w/bin/omarchy-launch-screensaver --- i/bin/omarchy-launch-screensaver +++ w/bin/omarchy-launch-screensaver -@@ -15,6 +15,32 @@ +@@ -11,6 +11,32 @@ fi focused=$(omarchy-hyprland-monitor-focused) @@ -49,7 +54,7 @@ diff --git i/bin/omarchy-launch-screensaver w/bin/omarchy-launch-screensaver terminal=$(xdg-terminal-exec --print-id) case $terminal in -@@ -64,7 +90,10 @@ +@@ -63,7 +89,10 @@ hypr_exec ghostty --class=org.omarchy.screensaver --config-file="$OMARCHY_PATH/default/ghostty/screensaver" --font-size=18 -e omarchy-screensaver ;; *foot*) @@ -100,17 +105,17 @@ diff --git i/bin/omarchy-screensaver w/bin/omarchy-screensaver pkill -x ttfx 2>/dev/null pkill -f '[o]rg.omarchy.screensaver' 2>/dev/null exit 0 -@@ -17,6 +43,9 @@ - trap exit_screensaver SIGINT SIGTERM SIGHUP SIGQUIT +@@ -18,6 +44,9 @@ printf '\033]11;rgb:00/00/00\007' # Set background color to black + stty -echo 2>/dev/null # Don't echo the key that stops the screensaver into the corner +# Report mouse clicks (and touches) as input, so a tap ends the screensaver +# like a key press does. Turned back off on exit. +printf '\033[?1000h' hyprctl eval 'hl.config({ cursor = { invisible = true } })' &>/dev/null || hyprctl keyword cursor:invisible true &>/dev/null -@@ -33,6 +62,17 @@ +@@ -34,6 +63,17 @@ done } @@ -128,7 +133,7 @@ diff --git i/bin/omarchy-screensaver w/bin/omarchy-screensaver wait_for_terminal_resize while true; do -@@ -41,7 +81,26 @@ +@@ -42,7 +82,26 @@ --random-effect --no-eol --no-restore-cursor & while pgrep -t "${tty#/dev/}" -x ttfx >/dev/null; do diff --git a/packages/omamobile-omarchy/patches/0007-idle-lock-when-the-user-returns-to-the-screensaver.patch b/packages/omamobile-omarchy/patches/0007-idle-lock-when-the-user-returns-to-the-screensaver.patch index 4afb85828..3d383a5db 100644 --- a/packages/omamobile-omarchy/patches/0007-idle-lock-when-the-user-returns-to-the-screensaver.patch +++ b/packages/omamobile-omarchy/patches/0007-idle-lock-when-the-user-returns-to-the-screensaver.patch @@ -1,11 +1,14 @@ # Lock as soon as the user returns to the screensaver (lock-after-screensaver). # Refreshed against Omarchy 4.0.6 (edge 4.0.6-1) so it applies without fuzz; # the hunk lands where the fuzzed one did, before the main idle monitor. +# +# Omarchy 4.5: rebased (one line of offset); 4.5's idle service keeps +# runProcess, lockProcess, screensaverWindowCount and logEvent as used here. + diff --git i/shell/plugins/services/idle/Service.qml w/shell/plugins/services/idle/Service.qml -index 8fb45a6..d694ab9 100644 --- i/shell/plugins/services/idle/Service.qml +++ w/shell/plugins/services/idle/Service.qml -@@ -266,6 +266,32 @@ Item { +@@ -267,6 +267,32 @@ // With both timeouts at 0 the monitor stops reporting, so nothing else would end a running cycle. onIdleTimersEnabledChanged: if (!idleTimersEnabled) cancelIdleCycle("idle-timers-disabled") diff --git a/packages/omamobile-omarchy/patches/0008-brightness-panels-with-bl-power-follow-dpms.patch b/packages/omamobile-omarchy/patches/0008-brightness-panels-with-bl-power-follow-dpms.patch index 922444404..f14b05dfd 100644 --- a/packages/omamobile-omarchy/patches/0008-brightness-panels-with-bl-power-follow-dpms.patch +++ b/packages/omamobile-omarchy/patches/0008-brightness-panels-with-bl-power-follow-dpms.patch @@ -4,11 +4,14 @@ # bl_power (the device package's udev rule). # # Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4). +# +# Omarchy 4.5: unchanged; 4.5 added Apple and DDC display paths after +# this point, and the off/on steps it hooks are as before. + diff --git i/bin/omarchy-brightness-display w/bin/omarchy-brightness-display -index 5a3e534..3c754bb 100755 --- i/bin/omarchy-brightness-display +++ w/bin/omarchy-brightness-display -@@ -82,12 +82,26 @@ if (( $# == 0 )); then +@@ -82,12 +82,26 @@ exit fi diff --git a/packages/omamobile-omarchy/patches/0009-lock-ipc-wake-for-hardware-keys.patch b/packages/omamobile-omarchy/patches/0009-lock-ipc-wake-for-hardware-keys.patch index 1cc9b0d69..1eaf5b35a 100644 --- a/packages/omamobile-omarchy/patches/0009-lock-ipc-wake-for-hardware-keys.patch +++ b/packages/omamobile-omarchy/patches/0009-lock-ipc-wake-for-hardware-keys.patch @@ -3,11 +3,16 @@ # phone's power button, through omamobile-keys). # # Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4). +# +# Omarchy 4.5: rebased. The lock's IPC target (ShellIpc "lock") is +# unchanged in 4.5. 4.5 keeps authentication services out of the shell's +# service map (AuthServiceStore), so other code reaches the lock only over +# this IPC, never as an object: this call is the supported way in. + diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml -index ccd496a..113b40d 100644 --- i/shell/plugins/lock/Service.qml +++ w/shell/plugins/lock/Service.qml -@@ -848,6 +848,14 @@ Item { +@@ -899,6 +899,14 @@ return "ok" } diff --git a/packages/omamobile-omarchy/patches/0010-polkit-leave-the-on-screen-keyboard-usable.patch b/packages/omamobile-omarchy/patches/0010-polkit-leave-the-on-screen-keyboard-usable.patch index 419dc7856..621a64e8e 100644 --- a/packages/omamobile-omarchy/patches/0010-polkit-leave-the-on-screen-keyboard-usable.patch +++ b/packages/omamobile-omarchy/patches/0010-polkit-leave-the-on-screen-keyboard-usable.patch @@ -4,11 +4,18 @@ # wrong password so the keyboard shows again (FINGERPRINT-PLAN.md). # # Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4). +# +# Omarchy 4.5: rebased (offsets only). 4.5 made polkit an authentication +# service the shell keeps out of its service map (AuthServiceStore); this +# patch changes only the prompt's layer surface and focus, nothing of how +# the agent is loaded or reached. Top rather than Overlay remains the trade +# it was on 4.0: an overlay-layer surface can cover the prompt; the phone +# needs the on-screen keyboard above it. + diff --git i/shell/plugins/polkit/PolkitAgent.qml w/shell/plugins/polkit/PolkitAgent.qml -index acd6514c..e98356dd 100644 --- i/shell/plugins/polkit/PolkitAgent.qml +++ w/shell/plugins/polkit/PolkitAgent.qml -@@ -103,8 +103,16 @@ Item { +@@ -103,8 +103,16 @@ if (!dialogVisible) return // In fingerprint mode there is no field to type into — park focus on the // key catcher so Escape still cancels; otherwise focus the password field. @@ -27,7 +34,7 @@ index acd6514c..e98356dd 100644 } function submitResponse() { -@@ -149,7 +157,11 @@ Item { +@@ -149,7 +157,11 @@ id: errorTimer interval: 1200 repeat: false @@ -40,7 +47,7 @@ index acd6514c..e98356dd 100644 } SequentialAnimation { -@@ -225,9 +237,17 @@ Item { +@@ -229,9 +241,17 @@ anchors { top: true; bottom: true; left: true; right: true } color: "transparent" WlrLayershell.namespace: "omarchy-polkit" diff --git a/packages/omamobile-omarchy/patches/0011-lock-and-polkit-pin-or-password-input.patch b/packages/omamobile-omarchy/patches/0011-lock-and-polkit-pin-or-password-input.patch index acf09eb32..67a6db126 100644 --- a/packages/omamobile-omarchy/patches/0011-lock-and-polkit-pin-or-password-input.patch +++ b/packages/omamobile-omarchy/patches/0011-lock-and-polkit-pin-or-password-input.patch @@ -6,11 +6,15 @@ # its focus or the PIN. The polkit prompt asks squeekboard for its digit # layout for a PIN, with a 123/ABC switch, and a tap refocuses the field. # -# Against Omarchy 4.0.6 (edge 4.0.6-1), which has 0000's Commons.Color fix: -# with the series, LockView.qml is byte for byte the phone's tested file -# (4c72b5be..., F16b). +# Omarchy 4.5 port (on the 4.5 ports of 0003 and 0010): the same behaviour. +# 4.5's focus restore after a VT switch follows the input shown (the pad's +# keys or the field); the "Enter PIN" placeholders sit beside 4.5's i18n +# ones, which a password keeps ("Enter PIN" stays English, as the series' +# strings were); the polkit toggles' FileViews follow 4.5's Style.duration +# shake. The polkit agent is a 4.5 authentication service; nothing here +# changes how it is loaded or reached. + diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml -index 53eef73..1f1b3b0 100644 --- i/shell/plugins/lock/LockView.qml +++ w/shell/plugins/lock/LockView.qml @@ -1,5 +1,7 @@ @@ -21,7 +25,7 @@ index 53eef73..1f1b3b0 100644 import qs.Commons import qs.Commons as Commons import qs.Ui -@@ -24,9 +26,18 @@ Item { +@@ -26,11 +28,20 @@ // sensor pressed a key. With fingerprints set up, the pad keeps the lower // third clear, and a hint above the field says either works, as on Android. readonly property bool keypadClearsSensor: keypad && fingerprintConfigured @@ -35,14 +39,16 @@ index 53eef73..1f1b3b0 100644 + readonly property real inputSwitchReserve: keypad ? Math.round(inputSwitch.implicitWidth + 12) : 0 + readonly property real fieldSideReserve: Math.max(fingerprintReserve, inputSwitchReserve) readonly property int keypadBottomMargin: Math.round(height * (keypadClearsSensor ? 0.34 : 0.08)) + // Whichever line sits above the field with the number pad, for its room. + readonly property Item keypadLineAbove: keypadHint.visible || !unavailableNotice.visible ? keypadHint : unavailableNotice -- readonly property string placeholderText: keypad ? "Enter PIN" : "Enter Password" -+ readonly property string placeholderText: padShown ? "Enter PIN" : "Enter Password" +- readonly property string placeholderText: keypad ? "Enter PIN" : Commons.I18n.t("lock.enterPassword") ++ readonly property string placeholderText: padShown ? "Enter PIN" : Commons.I18n.t("lock.enterPassword") readonly property int fieldWidth: 381 readonly property int fieldHeight: 67 readonly property int outlineThickness: 3 -@@ -62,8 +73,53 @@ Item { - } +@@ -60,8 +71,53 @@ + signal wakeRequested() function forcePasswordFocus() { - if (keypad) keypadKeys.forceActiveFocus() @@ -97,7 +103,16 @@ index 53eef73..1f1b3b0 100644 } function clearPassword() { -@@ -144,7 +200,7 @@ Item { +@@ -88,7 +144,7 @@ + function restorePasswordFocus() { + if (!inputEnabled || !passwordInput.enabled) return + // With the number pad the keys hold focus, not the field. +- if (keypad ? !keypadKeys.activeFocus : !passwordInput.activeFocus) forcePasswordFocus() ++ if (padShown ? !keypadKeys.activeFocus : !passwordInput.activeFocus) forcePasswordFocus() + } + + onPasswordTextChanged: syncPasswordText() +@@ -173,7 +229,7 @@ Keypad { id: numberPad @@ -106,7 +121,7 @@ index 53eef73..1f1b3b0 100644 enabled: root.inputEnabled && !root.authenticatingPassword anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom -@@ -173,9 +229,14 @@ Item { +@@ -202,9 +258,14 @@ width: root.fieldWidth height: root.fieldHeight anchors.horizontalCenter: parent.horizontalCenter @@ -124,7 +139,7 @@ index 53eef73..1f1b3b0 100644 color: Commons.Color.lock.background borderSpec: root.inputBorderSpec radius: Style.cornerRadius -@@ -187,12 +248,12 @@ Item { +@@ -216,12 +277,12 @@ anchors.topMargin: inputField.borderTop // Reserve the fingerprint icon's width on both sides so the centered // dots stay symmetric and never slide under the icon as they grow. @@ -140,7 +155,7 @@ index 53eef73..1f1b3b0 100644 clip: true enabled: root.inputEnabled && !root.authenticatingPassword readOnly: root.authenticatingPassword -@@ -249,6 +310,33 @@ Item { +@@ -282,6 +343,33 @@ elide: Text.ElideRight } @@ -174,10 +189,10 @@ index 53eef73..1f1b3b0 100644 // Fingerprint hint pinned inside the field's right edge when a sensor is // enrolled, so the user knows they can touch to unlock instead of typing. // Matches hyprlock, which draws its fingerprint icon in the same spot. -@@ -278,7 +366,8 @@ Item { +@@ -340,7 +428,8 @@ anchors.horizontalCenter: inputField.horizontalCenter width: parent.width - Style.space(32) - visible: root.keypadClearsSensor + visible: root.keypadClearsSensor && !root.fingerprintUnavailable - text: "Touch the fingerprint sensor or enter your PIN" + text: root.padShown ? "Touch the fingerprint sensor or enter your PIN" + : "Touch the fingerprint sensor or enter your password" @@ -185,10 +200,9 @@ index 53eef73..1f1b3b0 100644 font.family: Style.font.family font.pixelSize: Style.font.subtitle diff --git i/shell/plugins/polkit/PolkitAgent.qml w/shell/plugins/polkit/PolkitAgent.qml -index 82c2848..36dc118 100644 --- i/shell/plugins/polkit/PolkitAgent.qml +++ w/shell/plugins/polkit/PolkitAgent.qml -@@ -39,6 +39,16 @@ Item { +@@ -39,6 +39,16 @@ // to the password even when a sensor is enrolled. Refreshed per request. property bool laptopClosed: false property int shakeOffset: 0 @@ -205,7 +219,7 @@ index 82c2848..36dc118 100644 readonly property bool dialogVisible: polkitAgent.isActive || closing // We show one method at a time. Fingerprint owns the dialog while PAM is -@@ -93,6 +103,7 @@ Item { +@@ -93,6 +103,7 @@ closeTimer.stop() closing = false submitted = false @@ -213,11 +227,10 @@ index 82c2848..36dc118 100644 passwordInput.text = "" refreshLidState() syncFromFlow() -@@ -170,6 +181,24 @@ Item { - NumberAnimation { target: root; property: "shakeOffset"; to: 8; duration: 50; easing.type: Easing.InOutQuad } - NumberAnimation { target: root; property: "shakeOffset"; to: 0; duration: 55; easing.type: Easing.OutQuad } +@@ -171,6 +182,24 @@ + NumberAnimation { target: root; property: "shakeOffset"; to: 0; duration: Style.duration(55); easing.type: Easing.OutQuad } } -+ FileView { + FileView { + path: root.togglesDir + "/lock-keypad" + watchChanges: true + printErrors: false @@ -235,10 +248,11 @@ index 82c2848..36dc118 100644 + onFileChanged: reload() + } + - FileView { ++ FileView { path: "/etc/pam.d/polkit-1" watchChanges: true -@@ -324,7 +353,7 @@ Item { + printErrors: false +@@ -328,7 +357,7 @@ } Item { @@ -247,7 +261,7 @@ index 82c2848..36dc118 100644 height: root.fieldHeight TextInput { -@@ -333,6 +362,8 @@ Item { +@@ -337,6 +366,8 @@ verticalAlignment: TextInput.AlignVCenter activeFocusOnPress: true clip: true @@ -256,16 +270,16 @@ index 82c2848..36dc118 100644 selectionColor: Util.alpha(root.accent, 0.45) selectedTextColor: root.foreground font.family: root.fontFamily -@@ -357,7 +388,7 @@ Item { +@@ -361,7 +392,7 @@ anchors.left: parent.left anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter -- text: root.errorFlash ? "Wrong" : (root.submitted ? "Checking..." : "Enter password") -+ text: root.errorFlash ? "Wrong" : (root.submitted ? "Checking..." : (root.digitsInput ? "Enter PIN" : "Enter password")) +- text: root.errorFlash ? I18n.t("polkit.wrong") : (root.submitted ? I18n.t("polkit.checking") : I18n.t("polkit.enterPassword")) ++ text: root.errorFlash ? I18n.t("polkit.wrong") : (root.submitted ? I18n.t("polkit.checking") : (root.digitsInput ? "Enter PIN" : I18n.t("polkit.enterPassword"))) color: root.errorFlash ? Commons.Color.polkit.textError : root.foreground opacity: root.errorFlash ? 1 : 0.36 font.family: root.fontFamily -@@ -379,7 +410,36 @@ Item { +@@ -383,7 +414,36 @@ anchors.fill: parent acceptedButtons: Qt.LeftButton enabled: passwordInput.visible diff --git a/packages/omamobile-omarchy/patches/0012-update-hand-omarchy-update-to-the-phone-wrapper.patch b/packages/omamobile-omarchy/patches/0012-update-hand-omarchy-update-to-the-phone-wrapper.patch index 889da8840..31e8e0870 100644 --- a/packages/omamobile-omarchy/patches/0012-update-hand-omarchy-update-to-the-phone-wrapper.patch +++ b/packages/omamobile-omarchy/patches/0012-update-hand-omarchy-update-to-the-phone-wrapper.patch @@ -9,11 +9,22 @@ # Omarchy's update runs unwrapped, as before. Escape hatch: # OMAMOBILE_UPDATE=1 omarchy-update. # -# Against Omarchy 4.0.4 (edge 4.0.4-2; tag v4.0.4). +# +# Omarchy 4.5 port: the handoff is unchanged and still the first thing the +# script does, before 4.5's transcript (script), its update lock and its +# sudo keep-alive. 4.5 split the restart step into --services-only (found +# on PATH, so the phone's stand-in runs it) and a final --reboot-only run +# by its absolute path in $OMARCHY_PATH/bin, which would skip the stand-in +# and decide "kernel updated" from vmlinuz/modules ownership, wrong for a +# phone booting slot B. Under OMAMOBILE_UPDATE only, that last call goes +# through PATH too; a desktop runs it exactly as before. 4.5's new boot +# verification (omarchy-update-boot) is a stand-in on the phone as well +# (packages/omamobile-omarchy lib/update-bin). + diff --git i/bin/omarchy-update w/bin/omarchy-update --- i/bin/omarchy-update +++ w/bin/omarchy-update -@@ -7,6 +7,14 @@ +@@ -8,6 +8,14 @@ set -e @@ -25,6 +36,21 @@ diff --git i/bin/omarchy-update w/bin/omarchy-update + exec /usr/bin/omamobile-update "$@" +fi + - if [[ -z ${OMARCHY_UPDATE_LOGGED:-} ]]; then - script_command=$(printf '%q ' "$0" "$@") - exec env OMARCHY_UPDATE_LOGGED=1 script -qefc "$script_command" "/tmp/omarchy-update.log" + update_stay_awake_stopped=0 + sudo_keepalive_pid="" + +@@ -147,7 +155,13 @@ + fi + + if (( boot_verified )); then +- "$OMARCHY_PATH/bin/omarchy-update-restart" --reboot-only ++ # Omarchy Mobile: under omamobile-update the phone's stand-in on PATH ++ # decides about a restart (slot B, not a vmlinuz), and asks nothing. ++ if [[ -n ${OMAMOBILE_UPDATE:-} ]]; then ++ omarchy-update-restart --reboot-only ++ else ++ "$OMARCHY_PATH/bin/omarchy-update-restart" --reboot-only ++ fi + else + echo -e "\e[31m\nThe update is not finished: its boot files did not pass verification (see above). Do not reboot until omarchy update completes.\e[0m" >&2 + exit 1 diff --git a/packages/omamobile-omarchy/patches/0013-idle-wake-a-locked-display-through-the-lock.patch b/packages/omamobile-omarchy/patches/0013-idle-wake-a-locked-display-through-the-lock.patch index 0fe310e1f..e244a411e 100644 --- a/packages/omamobile-omarchy/patches/0013-idle-wake-a-locked-display-through-the-lock.patch +++ b/packages/omamobile-omarchy/patches/0013-idle-wake-a-locked-display-through-the-lock.patch @@ -4,10 +4,16 @@ # next unlock: a day of a lit screen on the phone. # # Against Omarchy 4.0.6 (edge 4.0.6-1), after 0007. +# +# Omarchy 4.5: rebased (offsets only). It reaches the lock over its IPC +# target (omarchy-shell lock wake): 4.5 keeps the lock out of the shell's +# service map, so IPC is the way in; the fallback to omarchy-system-wake +# stays for no lock or no answer. + diff --git i/shell/plugins/services/idle/Service.qml w/shell/plugins/services/idle/Service.qml --- i/shell/plugins/services/idle/Service.qml +++ w/shell/plugins/services/idle/Service.qml -@@ -119,7 +119,9 @@ +@@ -120,7 +120,9 @@ lockTimer.stop() screensaverLaunchGraceTimer.stop() diff --git a/packages/omamobile-omarchy/patches/0014-lock-emergency-call-button-for-touch-devices.patch b/packages/omamobile-omarchy/patches/0014-lock-emergency-call-button-for-touch-devices.patch index 1e715673d..d0f94c708 100644 --- a/packages/omamobile-omarchy/patches/0014-lock-emergency-call-button-for-touch-devices.patch +++ b/packages/omamobile-omarchy/patches/0014-lock-emergency-call-button-for-touch-devices.patch @@ -5,11 +5,15 @@ # carrier (TELEPHONY-APPS-PLAN §3.3) that is the warning that it doesn't # work yet, never a dialpad. The lock stays as it is. # -# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003 and 0011. +# Omarchy 4.5 port: the same button, after the 4.5 ports of 0003 and 0011. +# 4.5's "shell call" IPC (shell.qml callIfLoaded) still reaches a loaded +# panel plugin by id, so the call is unchanged; it does nothing when +# omamobile.call is not loaded, as before. + diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml --- i/shell/plugins/lock/LockView.qml +++ w/shell/plugins/lock/LockView.qml -@@ -374,5 +374,42 @@ +@@ -436,5 +436,42 @@ wrapMode: Text.WordWrap horizontalAlignment: Text.AlignHCenter } diff --git a/packages/omamobile-omarchy/patches/0015-notifications-inline-reply.patch b/packages/omamobile-omarchy/patches/0015-notifications-inline-reply.patch index 89ec9a5f9..1ec4f6892 100644 --- a/packages/omamobile-omarchy/patches/0015-notifications-inline-reply.patch +++ b/packages/omamobile-omarchy/patches/0015-notifications-inline-reply.patch @@ -1,232 +1,179 @@ -# Notifications: inline reply (the freedesktop `inline-reply` action and -# NotificationReplied signal, which Quickshell implements). The server -# advertises it, and a toast whose sender asked for it gets a Reply button -# that opens a field with Send and Cancel; Send hands the text to the sender -# and dismisses the toast. While a field is open the toast's countdown stops -# and the toast surface takes keyboard focus on demand, so an on-screen -# keyboard can type into it. Stored history rows can't be answered and get -# no button. Messages apps use it to reply to a text without opening the -# app (TELEPHONY-APPS-PLAN §7.2). -# -# Against Omarchy 4.0.6 (edge 4.0.6-1). -diff --git i/shell/plugins/notifications/Service.qml w/shell/plugins/notifications/Service.qml +# SPDX-License-Identifier: MIT +# Notifications: port live-only inline reply to Omarchy4.5's key-based refs +# and Toast scene. Keep the4.5 store/deck engine and markup/security limits. +# Restored/dead senders cannot reply; one editor takes OnDemand keyboard +# focus and pauses expiry. A failed send preserves the draft. No app opens. + --- i/shell/plugins/notifications/Service.qml +++ w/shell/plugins/notifications/Service.qml -@@ -314,6 +314,52 @@ Item { - removePopup(index, "dismiss") +@@ -816,6 +816,7 @@ } -+ // The live notification behind a popup row, or null. A restored row has -+ // none (see removePopup). -+ function liveRefAt(index) { -+ if (index < 0 || index >= popupModel.count) return null -+ var entry = popupModel.get(index) -+ if (!entry || entry.originalId < 0 || isRestoredRow(entry)) return null -+ var ref = liveRefs[entry.originalId] + function finishClose(key, reason) { ++ if (replyKey === key) replyKey = "" + unmarkLeaving(key) + var at = rowIndexFor(key) + if (!liveKeys[key]) return +@@ -905,6 +906,35 @@ + return out + } + ++ // Only a live sender may receive an inline reply; restored rows have none. ++ property string replyKey: "" ++ function replyPlaceholder(key, revision) { ++ if (leaving[key]) return "" ++ var ref = refs[key] + try { -+ return ref && ref.tracked ? ref : null -+ } catch (e) { -+ return null -+ } ++ return ref && ref.tracked && ref.hasInlineReply ++ ? Security.bounded(String(ref.inlineReplyPlaceholder || "Reply"), 160) : "" ++ } catch (e) { return "" } + } -+ -+ // The reply field's placeholder for a popup whose sender asked for an -+ // inline reply, or "" when it can't take one. -+ function replyPlaceholderAt(index) { -+ var ref = liveRefAt(index) -+ if (!ref || !ref.hasInlineReply) return "" -+ return String(ref.inlineReplyPlaceholder || "") || "Reply" ++ function beginReply(key) { ++ if (!replyPlaceholder(key, refsRevision)) return false ++ stopKeyboard() ++ replyKey = key ++ return true + } -+ -+ // Popups with the reply field open. While any is, the popup surface takes -+ // keyboard focus so the field can be typed into. -+ property int openReplies: 0 -+ -+ // Send the reply to its sender (NotificationReplied), then take the toast -+ // off the screen. A sender that has meanwhile closed the notification -+ // gets nothing; the popup opens its app instead, so the reply isn't lost -+ // silently. -+ function sendReply(index, text) { -+ var ref = liveRefAt(index) -+ if (!ref || !ref.hasInlineReply) { -+ invokePopupDefault(index) -+ return -+ } ++ function sendReply(key, text) { ++ if (leaving[key] || !liveKeys[key]) return false ++ if (typeof text !== "string" || !text.trim() || text.length > 4096) return false ++ var ref = refs[key] + try { ++ if (!ref || !ref.tracked || !ref.hasInlineReply) return false + ref.sendInlineReply(text) -+ } catch (e) { -+ console.warn("inline reply failed:", e) -+ invokePopupDefault(index) -+ return -+ } -+ dismissPopup(index) ++ } catch (e) { return false } ++ replyKey = "" ++ closeToast(key, "dismissed") ++ return true + } + - function expirePopup(index) { - removePopup(index, "expire") - } -@@ -936,6 +982,7 @@ Item { + function invokeAction(key, identifier) { + if (typeof identifier !== "string" || identifier.length > Security.MAX_ACTION_ID) return + invokeSenderAction(key, identifier) +@@ -1358,6 +1388,7 @@ bodyMarkupSupported: true bodyHyperlinksSupported: true persistenceSupported: true + inlineReplySupported: true - onNotification: function(notification) { - service.handleNotification(notification) -@@ -960,7 +1007,9 @@ Item { - + onNotification: function(notification) { service.handleNotification(notification) } + } +@@ -1515,7 +1546,8 @@ WlrLayershell.namespace: "omarchy-notifications" WlrLayershell.layer: WlrLayer.Overlay -- WlrLayershell.keyboardFocus: WlrKeyboardFocus.None -+ // Passive, except while a reply field is open (OnDemand, as the -+ // polkit prompt uses, so an on-screen keyboard can type into it). -+ WlrLayershell.keyboardFocus: service.openReplies > 0 ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None + readonly property bool takesKeyboard: service.keyboardMode && service.targetDisplayName === String(modelData.name) +- WlrLayershell.keyboardFocus: takesKeyboard ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None ++ WlrLayershell.keyboardFocus: service.replyKey && showingNotifications ? WlrKeyboardFocus.OnDemand ++ : (takesKeyboard ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None) exclusionMode: ExclusionMode.Ignore - color: "transparent" -@@ -1012,7 +1061,19 @@ Item { - - readonly property real lifetime: service.durationFor(cardSlot.urgency, cardSlot.expireTimeout) - property real remainingLifetime: 1.0 -- readonly property bool ticking: cardSlot.lifetime > 0 && !card.hovered -+ readonly property bool ticking: cardSlot.lifetime > 0 && !card.hovered && !cardSlot.replying + // Constant width and full height, so the buffer is allocated once. +@@ -1631,6 +1663,11 @@ + hovered: service.keyboardMode ? service.keyboardKey === model.key : service.hoverKey === model.key + selected: service.keyboardMode && service.keyboardKey === model.key + actions: service.actionsOf(model.key, service.refsRevision) ++ replyPlaceholder: service.replyPlaceholder(model.key, service.refsRevision) ++ replyOpen: service.replyKey === model.key && replyPlaceholder.length > 0 ++ onReplyRequested: service.beginReply(model.key) ++ onReplyCancelled: if (service.replyKey === model.key) service.replyKey = "" ++ onReplySent: function(text) { service.sendReply(model.key, text) } + hoverX: service.hoverX + hoverY: service.hoverY + // A click is the mouse taking over: it ends keyboard mode, which +--- i/shell/plugins/notifications/Toast.qml ++++ w/shell/plugins/notifications/Toast.qml +@@ -26,6 +26,12 @@ + property bool selected: false // the keyboard's card + property double now: Date.now() + property real cardWidth: Style.space(380) ++ property string replyPlaceholder: "" ++ property bool replyOpen: false ++ signal replyRequested() ++ signal replyCancelled() ++ signal replySent(string text) + -+ // Inline reply. The placeholder is looked up again whenever the -+ // row's content changes, as an update can add or drop the action. -+ readonly property string replyPlaceholder: { -+ cardSlot.summary -+ cardSlot.body -+ return service.replyPlaceholderAt(cardSlot.index) -+ } -+ property bool replying: false -+ onReplyingChanged: service.openReplies += replying ? 1 : -1 -+ onReplyPlaceholderChanged: if (replyPlaceholder.length === 0) replying = false -+ Component.onDestruction: if (replying) service.openReplies -= 1 + property var actions: [] // what the sender put on the wire - // A client updating this notification in place rewrites the row - // under the card (see refreshPopup). New text deserves a full look, -@@ -1052,8 +1113,22 @@ Item { - fontFamily: service.shell && service.shell.bar ? service.shell.bar.fontFamily : "" - glyph: cardSlot.glyph + // The pointer in the deck's coordinates: the deck owns hover, so cards and +@@ -151,7 +157,7 @@ + // time, and gets a fresh display period of its own duration. Its picture + // may be new at the same path, so the image is read again too. + property real remaining: Number(row.duration || 0) +- readonly property bool ticking: Number(row.duration || 0) > 0 && !paused ++ readonly property bool ticking: Number(row.duration || 0) > 0 && !paused && !replyOpen + readonly property string arrival: String(row.ts) + ":" + String(row.duration) + property bool reloading: false + onArrivalChanged: { +@@ -200,7 +206,7 @@ -+ replyPlaceholder: cardSlot.replyPlaceholder -+ replying: cardSlot.replying -+ - onCloseRequested: service.dismissPopup(cardSlot.index) - onCardClicked: service.invokePopupDefault(cardSlot.index) -+ onReplyRequested: cardSlot.replying = true -+ onReplyCancelled: { -+ cardSlot.replying = false -+ // A fresh countdown, so the toast doesn't vanish the -+ // moment the field closes. -+ cardSlot.remainingLifetime = 1.0 -+ } -+ onReplySent: function(text) { -+ cardSlot.replying = false -+ service.sendReply(cardSlot.index, text) -+ } - } - } - } -diff --git i/shell/plugins/notifications/components/NotificationCard.qml w/shell/plugins/notifications/components/NotificationCard.qml ---- i/shell/plugins/notifications/components/NotificationCard.qml -+++ w/shell/plugins/notifications/components/NotificationCard.qml -@@ -33,8 +33,33 @@ BorderSurface { + // The height this card's *state* implies, a step function the deck lays out + // from. Feeding a mid-animation height back into the layout stalls the stack. +- readonly property real targetHeight: fixedHeight + deedArea.wanted ++ readonly property real targetHeight: fixedHeight + deedArea.wanted + replyArea.wanted - readonly property bool hovered: hoverTracker.hovered + // The height the scene says it is right now, on the way there. + property real drawnHeight: targetHeight +@@ -233,7 +239,7 @@ + Rectangle { + anchors.fill: plate + anchors { leftMargin: plate.borderLeft; rightMargin: plate.borderRight +- topMargin: plate.borderTop; bottomMargin: plate.borderBottom } ++ topMargin: plate.borderTop; bottomMargin: plate.borderBottom + replyArea.wanted } + visible: card.selected + color: Style.hoverFillFor(Commons.Color.notifications.text, Commons.Color.accent) + } +@@ -539,7 +545,7 @@ + // What the state asks for; the drawn height is whatever slack the + // scene has given the card so far. + readonly property real wanted: shown ? barHeight : 0 +- height: Math.max(0, card.drawnHeight - card.fixedHeight) ++ height: Math.max(0, card.drawnHeight - card.fixedHeight - replyArea.wanted) + visible: height > 0 + clip: true -+ // Inline reply (the freedesktop `inline-reply` action): the popup container -+ // sets the sender's placeholder text while the live notification takes a -+ // reply. The history panel leaves it empty: a stored notification can't be -+ // answered. -+ property string replyPlaceholder: "" -+ // The reply field is open. The container keeps the toast on screen and -+ // gives its surface keyboard focus meanwhile. -+ property bool replying: false -+ - signal closeRequested() - signal cardClicked() -+ signal replyRequested() -+ signal replySent(string text) -+ signal replyCancelled() -+ -+ function sendReply() { -+ var text = replyField.text -+ if (text.trim().length === 0) return -+ root.replySent(text) -+ } -+ -+ // A field that opens gets focus, so an on-screen keyboard shows; one that -+ // closes forgets what was typed. -+ onReplyingChanged: { -+ if (replying) Qt.callLater(function() { replyField.forceActiveFocus() }) -+ else replyField.text = "" -+ } - // Prefer per-notification media/avatar data, then fall back to the app icon. - // The `check` flag avoids Qt's missing-texture placeholder for unknown names. - readonly property string smallIconSource: image.length > 0 ? image : iconSource(appIcon) -@@ -82,7 +107,9 @@ BorderSurface { - onClicked: function(mouse) { - if (mouse.button === Qt.RightButton) { - root.closeRequested() -- } else { -+ } else if (!root.replying) { -+ // A tap beside the open reply field must not open the app and -+ // throw the reply away. - root.cardClicked() +@@ -579,6 +585,45 @@ } } -@@ -192,6 +219,53 @@ BorderSurface { - } - } - } -+ -+ // Reply, then a field with Send and Cancel, each tall enough to tap on -+ // a touch screen. -+ RowLayout { -+ id: replyRow -+ readonly property real controlHeight: Style.space(40) -+ Layout.fillWidth: true -+ Layout.leftMargin: Style.space(12) -+ Layout.rightMargin: Style.space(12) -+ Layout.bottomMargin: Style.space(10) -+ visible: root.replyPlaceholder.length > 0 -+ spacing: Style.space(8) -+ + ++ Column { ++ id: replyArea ++ anchors { left: parent.left; right: parent.right; bottom: parent.bottom ++ leftMargin: Style.space(10); rightMargin: Style.space(10) ++ bottomMargin: plate.borderBottom } ++ readonly property real wanted: card.replyPlaceholder && (card.place.front || card.replyOpen) ++ ? (card.replyOpen ? replyField.implicitHeight + replyButtons.implicitHeight + Style.space(12) ++ : replyButton.implicitHeight + Style.space(8)) : 0 ++ height: wanted ++ spacing: Style.space(4) ++ visible: wanted > 0 ++ Button { ++ id: replyButton ++ visible: !card.replyOpen ++ text: "Reply" ++ onClicked: { ++ card.replyRequested() ++ Qt.callLater(function() { if (card.replyOpen) replyField.forceActiveFocus() }) ++ } ++ } + TextField { + id: replyField -+ objectName: "notificationReplyField" -+ Layout.fillWidth: true -+ visible: root.replying -+ Layout.preferredHeight: replyRow.controlHeight -+ placeholderText: root.replyPlaceholder -+ foreground: Commons.Color.notifications.text -+ onAccepted: root.sendReply() -+ Keys.onEscapePressed: root.replyCancelled() -+ } -+ -+ Item { -+ Layout.fillWidth: true -+ visible: !root.replying ++ visible: card.replyOpen ++ width: parent.width ++ placeholderText: card.replyPlaceholder ++ maximumLength: 4096 ++ onAccepted: if (text.trim()) card.replySent(text) ++ Keys.onEscapePressed: card.replyCancelled() + } -+ -+ Button { -+ visible: root.replying -+ text: "Cancel" -+ Layout.preferredHeight: replyRow.controlHeight -+ foreground: Commons.Color.notifications.text -+ onClicked: root.replyCancelled() -+ } -+ -+ Button { -+ objectName: "notificationReplyButton" -+ Layout.preferredHeight: replyRow.controlHeight -+ text: root.replying ? "Send" : "Reply" -+ bordered: true -+ foreground: Commons.Color.notifications.text -+ onClicked: root.replying ? root.sendReply() : root.replyRequested() ++ Row { ++ id: replyButtons ++ visible: card.replyOpen ++ spacing: Style.space(8) ++ Button { text: "Send"; enabled: replyField.text.trim().length > 0 ++ onClicked: card.replySent(replyField.text) } ++ Button { text: "Cancel"; onClicked: card.replyCancelled() } + } + } - } - - } ++ + // Under the content (z: -1) so buttons get their clicks first; anything + // that does not accept a click falls through to here. + MouseArea { diff --git a/packages/omamobile-omarchy/patches/0016-pacman-a-phone-refuses-the-channel-switch-and-pacman-refresh.patch b/packages/omamobile-omarchy/patches/0016-pacman-a-phone-refuses-the-channel-switch-and-pacman-refresh.patch index 726b6c144..aa5dce5dc 100644 --- a/packages/omamobile-omarchy/patches/0016-pacman-a-phone-refuses-the-channel-switch-and-pacman-refresh.patch +++ b/packages/omamobile-omarchy/patches/0016-pacman-a-phone-refuses-the-channel-switch-and-pacman-refresh.patch @@ -1,50 +1,35 @@ -# Phone only, not for upstream: omarchy-channel-set and omarchy-refresh-pacman -# refuse on a phone and point at RELEASES.md section 5.4. Both copy Omarchy's -# x86_64 pacman.conf and mirrorlist over the phone's (no [omamobile], no Arch -# Linux ARM) and then upgrade everything from them; the menu offers that as -# Update > Channel, and omarchy-reinstall-pkgs calls the refresh too -# (TOUCH-PLAN 0.2). omamobile-update, which this package installs, is the -# phone's test, as in 0012. omamobile-setup-user hides Update > Channel too; -# this keeps a terminal from doing the same. -# -# Against Omarchy 4.0.6 (stable 4.0.6-1). +# SPDX-License-Identifier: MIT +# Keep phone repository ownership before any4.5 platform/channel reset action. + diff --git i/bin/omarchy-channel-set w/bin/omarchy-channel-set --- i/bin/omarchy-channel-set +++ w/bin/omarchy-channel-set -@@ -6,6 +6,16 @@ +@@ -1,5 +1,12 @@ + #!/bin/bash - set -euo pipefail - -+# Omarchy Mobile: a phone's pacman.conf carries [omamobile] and Arch Linux -+# ARM, which the channel's x86_64 pacman.conf (omarchy-refresh-pacman) drops. ++# A phone's pinned package repository and Arch Linux ARM mirrors are owned ++# by omamobile-update, never the desktop channel/reset commands. +if [[ -x /usr/bin/omamobile-update ]]; then -+ echo "omarchy-channel-set: not on an Omarchy Mobile phone. It would replace this phone's" >&2 -+ echo "pacman.conf with Omarchy's x86_64 one (no [omamobile], no Arch Linux ARM) and upgrade" >&2 -+ echo "everything from it. The phone follows Omarchy's stable channel; update it with" >&2 -+ echo "'omarchy update'. See docs/RELEASES.md section 5.4 in derekross/omarchy-mobile." >&2 ++ echo "omarchy-channel-set: use 'omarchy update' on Omarchy Mobile; see docs/RELEASES.md 5.4." >&2 + exit 1 +fi + - usage() { echo "Usage: omarchy-channel-set [stable|rc|edge|dev]"; } - fail() { echo "Error: $*" >&2; exit 1; } - + # omarchy:summary=Set the Omarchy package channel. + # omarchy:args= + # omarchy:requires-sudo=true diff --git i/bin/omarchy-refresh-pacman w/bin/omarchy-refresh-pacman --- i/bin/omarchy-refresh-pacman +++ w/bin/omarchy-refresh-pacman -@@ -3,6 +3,16 @@ - # omarchy:summary=Overwrite the package configuration for /etc/pacman with the Omarchy default of using its dedicated mirrors and repositories, then update all packages. - # omarchy:requires-sudo=true +@@ -1,5 +1,12 @@ + #!/bin/bash -+# Omarchy Mobile: a phone's pacman.conf carries [omamobile] and Arch Linux -+# ARM, which Omarchy's x86_64 pacman.conf and mirrorlist would replace. ++# A phone's pinned package repository and Arch Linux ARM mirrors are owned ++# by omamobile-update, never the desktop channel/reset commands. +if [[ -x /usr/bin/omamobile-update ]]; then -+ echo "omarchy-refresh-pacman: not on an Omarchy Mobile phone. It would replace this phone's" >&2 -+ echo "pacman.conf and mirrorlist with Omarchy's x86_64 ones (no [omamobile], no Arch Linux" >&2 -+ echo "ARM) and upgrade everything from them. Update the phone with 'omarchy update'." >&2 -+ echo "See docs/RELEASES.md section 5.4 in derekross/omarchy-mobile." >&2 ++ echo "omarchy-refresh-pacman: use 'omarchy update' on Omarchy Mobile; see docs/RELEASES.md 5.4." >&2 + exit 1 +fi + - sudo cp -f /etc/pacman.conf /etc/pacman.conf.bak - sudo cp -f /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak + # omarchy:summary=Overwrite the package configuration for /etc/pacman with the Omarchy default of using its dedicated mirrors and repositories, then update all packages. + # omarchy:requires-sudo=true diff --git a/packages/omamobile-omarchy/patches/0017-notifications-swipe-to-dismiss-and-a-touch-close-button.patch b/packages/omamobile-omarchy/patches/0017-notifications-swipe-to-dismiss-and-a-touch-close-button.patch index cd2462d33..09be2bfea 100644 --- a/packages/omamobile-omarchy/patches/0017-notifications-swipe-to-dismiss-and-a-touch-close-button.patch +++ b/packages/omamobile-omarchy/patches/0017-notifications-swipe-to-dismiss-and-a-touch-close-button.patch @@ -1,261 +1,55 @@ -# Notifications: swipe to dismiss, and a close button on touch screens. On a -# touch screen a tap runs the toast's default action and there is no right -# button, so a toast could only be got rid of by letting it launch something, -# and a critical one (Omarchy's first-run invitations) never expires. A -# sideways swipe now moves the card with the finger: let go past 35% of its -# width, or flick it, and it flies off that side and closes as a right-click -# does; short of that it springs back. The drag starts only past a threshold, -# so a tap still runs the default action, and it is off while a reply is -# being typed. When Hyprland lists a touch screen, each toast also gets a -# close glyph with a 44 px target in its top-right corner; a seat with only a -# mouse shows none, so desktops look as before. Hover pauses the countdown -# for a mouse or stylus only (a finger doesn't hover), and a card being -# swiped doesn't expire under the finger. Right-click still closes. -# -# Against Omarchy 4.0.6 (edge 4.0.6-1) with 0015 (inline reply) applied. -diff --git i/shell/plugins/notifications/Service.qml w/shell/plugins/notifications/Service.qml ---- i/shell/plugins/notifications/Service.qml -+++ w/shell/plugins/notifications/Service.qml -@@ -455,6 +455,29 @@ - - Process { id: focusAppProc; running: false } - -+ // Whether the seat has a touch screen, asked of Hyprland once at startup. -+ // Toasts then show a close button: a tap runs the default action, and a -+ // finger has no right button to dismiss with. A seat with only a mouse -+ // keeps the toasts as they were. -+ property bool touchScreen: false -+ -+ Process { -+ id: touchScreenProc -+ command: ["hyprctl", "-j", "devices"] -+ running: false -+ stdout: StdioCollector { -+ waitForEnd: true -+ onStreamFinished: { -+ try { -+ var touch = JSON.parse(text || "{}").touch -+ service.touchScreen = Array.isArray(touch) && touch.length > 0 -+ } catch (e) { -+ service.touchScreen = false -+ } -+ } -+ } -+ } -+ - Process { - id: ensureDirsProc - command: ["mkdir", "-p", service.stateDir, service.popupStateDir, service.historyDir, service.imagesDir] -@@ -880,6 +903,7 @@ - - Component.onCompleted: { - ensureDirsProc.running = true -+ touchScreenProc.running = true - // Once mkdir has had a tick, load the existing settings file. FileView - // surfaces an empty string when the file doesn't exist; loadSettings - // handles that path. -@@ -1061,7 +1085,7 @@ - - readonly property real lifetime: service.durationFor(cardSlot.urgency, cardSlot.expireTimeout) - property real remainingLifetime: 1.0 -- readonly property bool ticking: cardSlot.lifetime > 0 && !card.hovered && !cardSlot.replying -+ readonly property bool ticking: cardSlot.lifetime > 0 && !card.held && !cardSlot.replying - - // Inline reply. The placeholder is looked up again whenever the - // row's content changes, as an update can add or drop the action. -@@ -1115,6 +1139,7 @@ - - replyPlaceholder: cardSlot.replyPlaceholder - replying: cardSlot.replying -+ closeButtonShown: service.touchScreen - - onCloseRequested: service.dismissPopup(cardSlot.index) - onCardClicked: service.invokePopupDefault(cardSlot.index) -diff --git i/shell/plugins/notifications/components/NotificationCard.qml w/shell/plugins/notifications/components/NotificationCard.qml ---- i/shell/plugins/notifications/components/NotificationCard.qml -+++ w/shell/plugins/notifications/components/NotificationCard.qml -@@ -32,6 +32,22 @@ - property string fontFamily: "" - - readonly property bool hovered: hoverTracker.hovered -+ // The card is under the user's hand: a mouse over it, or a finger -+ // swiping it. The popup container pauses the countdown meanwhile. -+ readonly property bool held: hovered || swipeHandler.active -+ -+ // Touch: a horizontal swipe dismisses (swipeEnabled), and a close button -+ // shows in the top-right corner (closeButtonShown), as a tap runs the -+ // default action and a touch screen has no right button. The container -+ // shows the button when the seat has a touch screen, so a mouse-only -+ // desktop looks and behaves as before. -+ property bool swipeEnabled: true -+ property bool closeButtonShown: false -+ // How far the card has been swiped sideways, in pixels. +# SPDX-License-Identifier: MIT +# Port touch dismissal to4.5Toast scene: independent horizontal translation, +# touch-only drag (disabled during reply) and persistent40px close target. +# Retain4.5keyed store/deck and existing mouse actions; no history deletion. + +diff --git i/shell/plugins/notifications/Toast.qml w/shell/plugins/notifications/Toast.qml +--- i/shell/plugins/notifications/Toast.qml ++++ w/shell/plugins/notifications/Toast.qml +@@ -28,6 +28,23 @@ + property real cardWidth: Style.space(380) + property string replyPlaceholder: "" + property bool replyOpen: false + property real swipeOffset: 0 -+ // Release speed of the last swipe, pixels per second. -+ property real swipeVelocity: 0 -+ property bool dismissing: false - - // Inline reply (the freedesktop `inline-reply` action): the popup container - // sets the sender's placeholder text while the live notification takes a -@@ -77,6 +93,23 @@ - readonly property color accentColor: urgency === 2 ? Commons.Color.urgent : (urgency === 0 ? dimColor : Commons.Color.notifications.countdown) - readonly property var cardBorderSpec: Border.surfaceSpec("notifications", "border", Commons.Color.notifications.border, Math.max(1, Style.space(2))) - -+ // A swipe ends: past 35% of the width, or flicked fast enough the same -+ // way, the card flies off that side and closes; otherwise it springs back. -+ function finishSwipe() { -+ var distance = Math.abs(root.swipeOffset) -+ var sameWay = root.swipeVelocity * root.swipeOffset > 0 -+ var flung = sameWay && Math.abs(root.swipeVelocity) >= Style.space(900) && distance >= root.width * 0.1 -+ if (root.width > 0 && (distance >= root.width * 0.35 || flung)) { -+ root.dismissing = true -+ swipeAnimation.to = (root.swipeOffset < 0 ? -1 : 1) * (root.width + Style.space(24)) -+ swipeAnimation.dismiss = true -+ } else { -+ swipeAnimation.to = 0 -+ swipeAnimation.dismiss = false -+ } -+ swipeAnimation.restart() -+ } -+ - function sanitizeBody(s) { - return NotificationLogic.sanitizeBody(s, app, appIcon) - } -@@ -92,13 +125,23 @@ - implicitWidth: Style.space(380) - // Add vertical border insets so mainColumn (inset by border on top/left/right) - // doesn't push content under the bottom edge. -- implicitHeight: mainColumn.implicitHeight + borderTop + borderBottom -+ implicitHeight: Math.max(mainColumn.implicitHeight, closeButtonShown ? closeButton.height : 0) + borderTop + borderBottom - radius: cornerRadius - color: Commons.Color.notifications.background - borderSpec: cardBorderSpec - clip: true - -- HoverHandler { id: hoverTracker } -+ // The swipe moves the card sideways and fades it as it goes. -+ transform: Translate { x: root.swipeOffset } -+ opacity: 1 - 0.6 * Math.min(1, Math.abs(root.swipeOffset) / Math.max(1, root.width)) -+ -+ // A mouse or stylus resting on the card pauses its countdown. A finger -+ // doesn't hover, so touch is left out: a toast that was touched must not -+ // count as hovered and stop expiring. -+ HoverHandler { -+ id: hoverTracker -+ acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad | PointerDevice.Stylus -+ } - - MouseArea { - anchors.fill: parent -@@ -115,6 +158,61 @@ - } - } - -+ // Swipe to dismiss. Only sideways movement past the threshold starts it, -+ // so a tap still runs the default action and a right-click still closes. -+ // Off while a reply is being typed, so selecting text can't throw the -+ // reply away. ++ transform: Translate { x: card.swipeOffset } + DragHandler { -+ id: swipeHandler + target: null ++ enabled: !card.replyOpen && !card.place.hidden && !card.place.leaving ++ acceptedDevices: PointerDevice.TouchScreen ++ xAxis.enabled: true + yAxis.enabled: false -+ dragThreshold: Style.space(12) -+ enabled: root.swipeEnabled && !root.replying && !root.dismissing ++ onActiveTranslationChanged: if (active) card.swipeOffset = activeTranslation.x + onActiveChanged: { -+ if (active) { -+ swipeAnimation.stop() -+ root.swipeVelocity = 0 -+ } else { -+ root.finishSwipe() -+ } -+ } -+ onActiveTranslationChanged: { -+ if (!active) return -+ root.swipeOffset = activeTranslation.x -+ root.swipeVelocity = centroid.velocity.x -+ } -+ } -+ -+ SequentialAnimation { -+ id: swipeAnimation -+ property real to: 0 -+ property bool dismiss: false -+ NumberAnimation { -+ target: root -+ property: "swipeOffset" -+ to: swipeAnimation.to -+ duration: swipeAnimation.dismiss ? 140 : 200 -+ easing.type: swipeAnimation.dismiss ? Easing.InQuad : Easing.OutBack -+ } -+ ScriptAction { -+ script: { -+ if (!swipeAnimation.dismiss) return -+ root.closeRequested() -+ // A container that keeps the card (nothing removes it) gets it back. -+ swipeResetTimer.restart() ++ if (!active) { ++ var dismiss = Math.abs(card.swipeOffset) >= Math.min(Style.space(90), card.width * 0.25) ++ card.swipeOffset = 0 ++ if (dismiss) card.dismissed() + } + } + } -+ -+ Timer { -+ id: swipeResetTimer -+ interval: 400 -+ onTriggered: { -+ root.dismissing = false -+ root.swipeOffset = 0 -+ } -+ } -+ - ColumnLayout { - id: mainColumn - // Inset by the card border so the content doesn't paint over the card's -@@ -131,7 +229,8 @@ - RowLayout { - Layout.fillWidth: true - Layout.leftMargin: Style.space(12) -- Layout.rightMargin: Style.space(12) -+ // Text stays clear of the close button's touch target. -+ Layout.rightMargin: root.closeButtonShown ? closeButton.width : Style.space(12) - Layout.topMargin: root.singleLineToast ? Style.space(7) : Style.space(10) - Layout.bottomMargin: root.singleLineToast ? Style.space(7) : Style.space(10) - spacing: root.collapseRedundantIcon ? 0 : (root.compactGlyph ? Style.space(8) : Style.space(12)) -@@ -268,4 +367,39 @@ - } - } - -+ // Close button: a small glyph with a 44 px touch target in the top-right -+ // corner, inside the border. -+ MouseArea { -+ id: closeButton -+ objectName: "notificationCloseButton" -+ visible: root.closeButtonShown -+ anchors.top: parent.top -+ anchors.right: parent.right -+ anchors.topMargin: root.borderTop -+ anchors.rightMargin: root.borderRight -+ width: Style.space(44) -+ height: Style.space(44) -+ cursorShape: Qt.PointingHandCursor -+ Accessible.role: Accessible.Button -+ Accessible.name: "Dismiss notification" -+ onClicked: root.closeRequested() -+ -+ Rectangle { -+ anchors.centerIn: parent -+ width: Style.space(28) -+ height: width -+ radius: width / 2 -+ color: Commons.Color.notifications.text -+ opacity: closeButton.pressed ? 0.18 : 0 -+ } -+ -+ Text { -+ textFormat: Text.PlainText -+ anchors.centerIn: parent -+ text: "󰅖" -+ color: root.dimColor -+ font.family: root.fontFamily -+ font.pixelSize: Style.font.icon -+ } -+ } - } + signal replyRequested() + signal replyCancelled() + signal replySent(string text) +@@ -454,7 +471,7 @@ + anchors.centerIn: parent + text: card.ago() + color: card.dimColor +- opacity: card.hovered ? 0 : 1 ++ opacity: 0 + visible: opacity > 0.01 + font.family: Style.font.family + font.pixelSize: Style.font.bodySmall +@@ -465,10 +482,10 @@ + id: shut + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter +- implicitWidth: closeMark.implicitWidth + Style.space(6) +- implicitHeight: closeMark.implicitHeight ++ implicitWidth: Math.max(Style.space(40), closeMark.implicitWidth + Style.space(6)) ++ implicitHeight: Math.max(Style.space(40), closeMark.implicitHeight) + enabled: card.hovered +- opacity: card.hovered ? 1 : 0 ++ opacity: 1 + visible: opacity > 0.01 + readonly property bool hot: card.pointerOver(shut) + Behavior on opacity { NumberAnimation { duration: card.fade; easing.type: Easing.InOutQuad } } diff --git a/packages/omamobile-omarchy/patches/0018-menu-a-back-button-and-swipe-right-to-go-back.patch b/packages/omamobile-omarchy/patches/0018-menu-a-back-button-and-swipe-right-to-go-back.patch index 410f8cf80..f13aa6e47 100644 --- a/packages/omamobile-omarchy/patches/0018-menu-a-back-button-and-swipe-right-to-go-back.patch +++ b/packages/omamobile-omarchy/patches/0018-menu-a-back-button-and-swipe-right-to-go-back.patch @@ -1,19 +1,11 @@ -# Menu: a back button in the header and swipe right to go back. Below the -# top level, going up was Backspace, Left or Escape-and-reopen, none of which -# a touch screen has. The header now shows a chevron (a 44 px target) that -# calls goBack(), and a swipe right on the card does the same: the card -# follows the finger at half speed and goes back once the finger has -# travelled a quarter of its width (at least 64 px) or flicks. The drag -# starts only past a threshold and only sideways, and not while the list -# scrolls, so taps still pick rows and vertical scrolling is untouched. -# Neither shows nor acts at the top level, in dmenu mode or while the -# uninstall question is open. The keys work as before. -# -# Against Omarchy 4.0.6 (edge 4.0.6-1), before the menu-first-frame bridge. +# SPDX-License-Identifier: MIT +# Port menu Back/swipe to4.5FilterInput without covering inputmethod commits. +# Touch-only swipe,44px Back target, root/dmenu/confirmation/scroll guards. + diff --git i/shell/plugins/menu/Menu.qml w/shell/plugins/menu/Menu.qml --- i/shell/plugins/menu/Menu.qml +++ w/shell/plugins/menu/Menu.qml -@@ -1066,6 +1066,50 @@ +@@ -1317,6 +1317,51 @@ MouseArea { anchors.fill: parent; onClicked: {} } @@ -29,6 +21,7 @@ diff --git i/shell/plugins/menu/Menu.qml w/shell/plugins/menu/Menu.qml + DragHandler { + id: backSwipe + target: null ++ acceptedDevices: PointerDevice.TouchScreen + yAxis.enabled: false + dragThreshold: Style.space(12) + enabled: card.canGoBack && !resultList.moving @@ -41,7 +34,7 @@ diff --git i/shell/plugins/menu/Menu.qml w/shell/plugins/menu/Menu.qml + // The finger's travel (the card follows at half speed). + var distance = card.swipeOffset * 2 + var flung = card.swipeVelocity >= Style.space(900) && distance >= Style.space(24) -+ if (distance >= Math.max(Style.space(64), card.width * 0.25) || flung) root.goBack() ++ if (card.canGoBack && !resultList.moving && (distance >= Math.max(Style.space(64), card.width * 0.25) || flung)) root.goBack() + backSwipeSettle.restart() + } + onActiveTranslationChanged: { @@ -64,13 +57,10 @@ diff --git i/shell/plugins/menu/Menu.qml w/shell/plugins/menu/Menu.qml Item { id: keyCatcher anchors.fill: parent -@@ -1151,9 +1195,46 @@ +@@ -1400,9 +1445,31 @@ radius: root.cornerRadius color: "transparent" -+ // Back, for touch: shown below the top level, does what -+ // Backspace does. A 44 px target, overhanging the header's -+ // height into the margins around it. + MouseArea { + id: backButton + objectName: "menuBackButton" @@ -79,35 +69,23 @@ diff --git i/shell/plugins/menu/Menu.qml w/shell/plugins/menu/Menu.qml + anchors.verticalCenter: parent.verticalCenter + width: Style.space(44) + height: Math.max(parent.height, Style.space(44)) -+ hoverEnabled: true -+ cursorShape: Qt.PointingHandCursor ++ z: 2 + Accessible.role: Accessible.Button + Accessible.name: "Back" + onClicked: root.goBack() -+ -+ Rectangle { -+ anchors.centerIn: parent -+ width: Style.space(32) -+ height: width -+ radius: root.cornerRadius -+ color: root.selectedBackground -+ opacity: backButton.pressed ? 0.9 : (backButton.containsMouse ? 0.5 : 0) -+ } -+ + Text { -+ textFormat: Text.PlainText + anchors.centerIn: parent -+ text: "󰅁" ++ text: "‹" ++ textFormat: Text.PlainText + color: root.foreground -+ font.family: root.fontFamily + font.pixelSize: Style.font.heading + } + } + - Text { - textFormat: Text.PlainText + FilterInput { + id: filterInput anchors.left: parent.left + anchors.leftMargin: backButton.visible ? backButton.width : 0 anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter - text: root.filterText || (root.dmenuActive ? (root.dmenuPrompt + "…") : ((root.item(root.activeMenu) ? (root.item(root.activeMenu).title || root.item(root.activeMenu).label) : "Go") + "…")) + keyHandler: keyCatcher diff --git a/packages/omamobile-omarchy/patches/0019-notifications-forget-one-notification-by-ipc.patch b/packages/omamobile-omarchy/patches/0019-notifications-forget-one-notification-by-ipc.patch index e718492ef..5b7b69124 100644 --- a/packages/omamobile-omarchy/patches/0019-notifications-forget-one-notification-by-ipc.patch +++ b/packages/omamobile-omarchy/patches/0019-notifications-forget-one-notification-by-ipc.patch @@ -1,73 +1,48 @@ -# Notifications: forget one notification by IPC. Omarchy Mobile's quick -# settings list the toasts on screen and the history under the sheet, and a -# sideways swipe on a row there takes away that one notification. The -# service has calls for all toasts (dismissAll), all history (clear) and -# toasts by summary text, but none for one entry, and every way a toast -# leaves the screen moves its file into history, so a toast swiped away in -# the shade would come straight back as a history row. Deleting a history -# file from outside isn't safe either: archives, trims and replays run on the -# service's serialized file queue, and a move still queued for that -# notification would put the file back. `forget -.json` now -# closes a toast with that file name (a history replay of it too) at its -# sender without archiving it, then deletes the history entry and its image -# copies on the same queue, after anything already queued. A name that isn't -# a notification file name does nothing. -# -# Against Omarchy 4.0.6 (edge 4.0.6-1) with 0015 and 0017 applied. +# SPDX-License-Identifier: MIT +# Forget4.5keyed live/history record through IPC without sender actions. +# Skip re-archiving the forgotten toast; malformed/unknown keys do nothing. +# Never delete arbitrary image paths:4.5doesnotown sender image files. + diff --git i/shell/plugins/notifications/Service.qml w/shell/plugins/notifications/Service.qml --- i/shell/plugins/notifications/Service.qml +++ w/shell/plugins/notifications/Service.qml -@@ -376,9 +376,11 @@ - // The popup is leaving the screen — for any reason — so its file must not - // survive to the next shell restart. It becomes the newest history entry - // instead. Rows that never had a file (a history replay, the empty-history -- // placeholder) archive to nothing, which the move tolerates. -+ // placeholder) archive to nothing, which the move tolerates. A forgotten -+ // popup (forgetNotification) leaves no history entry: its file goes. - if (entry) { -- archivePopupFileFor(entry) -+ if (reason === "forget") deletePopupFileFor(entry) -+ else archivePopupFileFor(entry) - if (restored) delete restoredPopups[NotificationLogic.popupFileName(entry)] - } - popupModel.remove(index) -@@ -398,6 +400,26 @@ - while (popupModel.count > 0) dismissPopup(0) +@@ -826,7 +826,7 @@ + delete heights[key] + delete fresh[key] + // A placeholder (the empty-history notice) was never recorded. +- if (key.indexOf("placeholder") !== 0) storeClose(key, reason) ++ if (key.indexOf("placeholder") !== 0 && reason !== "forget") storeClose(key, reason) + layoutRevision += 1 } -+ // Forget one notification for good, named by its file (-.json, -+ // popupFileName): a toast on screen with that name, a history replay of it -+ // included, closes at its sender without moving into history, and the -+ // history entry and its image copies are deleted. The delete runs on the -+ // file queue, after any archive already queued for the same notification, -+ // so a toast that has just left the screen can't come back as history. +@@ -1218,6 +1218,21 @@ + } + + // A row that closes moves from live to history. ++ // Key-based4.5 store deletion. Never construct an arbitrary path or run ++ // notification actions; forget removes only the named logical record. + function forgetNotification(name) { -+ var file = String(name || "") -+ if (!/^[0-9]+-[0-9]+\.json$/.test(file)) return "none" -+ for (var i = popupModel.count - 1; i >= 0; i--) { -+ var row = popupModel.get(i) -+ if (row && row.originalId >= 0 && NotificationLogic.popupFileName(row) === file) -+ removePopup(i, "forget") -+ } -+ enqueuePopupFileJob(["bash", "-c", -+ "rm -f \"$1/$3\" \"$2/${3%.json}\"-*", "--", -+ historyDir, imagesDir, file]) ++ var key = String(name || "") ++ if (!Store.KEY.test(key)) return "none" ++ var exists = !!liveKeys[key] || !!Store.liveEntry(liveEntries, key) ++ || historyEntries.some(function(entry) { return entry.key === key }) ++ if (!exists) return "none" ++ storeDrop(key) ++ historyEntries = historyEntries.filter(function(entry) { return entry.key !== key }) ++ saveSoon("history") ++ closeToast(key, "forget", true) + return "ok" + } + - // Run the popup's click action, then dismiss. Omarchy's own toasts carry the - // action as an argv vector in the `execArgv` role (see execArgvFromHints), - // which the persistence files preserve, so restored toasts stay clickable. -@@ -993,6 +1015,12 @@ - return hit ? "ok" : "none" - } + function storeClose(key, reason) { + var entry = Store.liveEntry(liveEntries, key) + if (!entry) return +@@ -1428,6 +1443,8 @@ -+ // Forget one notification, toast or history entry, by its file name -+ // (`forget 1760000000000-3.json`); the rest of the history stays. -+ function forget(name: string): string { -+ return service.forgetNotification(name) -+ } -+ function ping(): string { return "ok" } - } ++ function forget(name: string): string { return service.forgetNotification(name) } ++ + function isDnd(): string { return service.doNotDisturb ? "on" : "off" } + + function toggleDnd(): string { diff --git a/packages/omamobile-omarchy/patches/0020-notifications-touch-phrasing-for-keyboard-and-click-hints.patch b/packages/omamobile-omarchy/patches/0020-notifications-touch-phrasing-for-keyboard-and-click-hints.patch index 2f30027af..490078237 100644 --- a/packages/omamobile-omarchy/patches/0020-notifications-touch-phrasing-for-keyboard-and-click-hints.patch +++ b/packages/omamobile-omarchy/patches/0020-notifications-touch-phrasing-for-keyboard-and-click-hints.patch @@ -14,10 +14,13 @@ # dropped too, but 0001 skips that toast on a phone. # # Against Omarchy 4.0.6 (stable 4.0.6-1). +# +# Omarchy4.5: touch-friendly notification hints. + diff --git i/bin/omarchy-notification-send w/bin/omarchy-notification-send --- i/bin/omarchy-notification-send +++ w/bin/omarchy-notification-send -@@ -136,6 +136,50 @@ +@@ -176,6 +176,50 @@ fi done diff --git a/packages/omamobile-omarchy/patches/0021-sleep-turn-the-display-off-before-suspend.patch b/packages/omamobile-omarchy/patches/0021-sleep-turn-the-display-off-before-suspend.patch index cc9bfac30..b56278d70 100644 --- a/packages/omamobile-omarchy/patches/0021-sleep-turn-the-display-off-before-suspend.patch +++ b/packages/omamobile-omarchy/patches/0021-sleep-turn-the-display-off-before-suspend.patch @@ -12,11 +12,13 @@ # patch 0023), so the glance is up on the next wake. # # Against Omarchy 4.0.6 (4.0.6-1). +# +# Omarchy4.5: retain display-off-before-suspend behavior. + diff --git i/bin/omarchy-system-sleep-lock w/bin/omarchy-system-sleep-lock -index d471cea..b278615 100755 --- i/bin/omarchy-system-sleep-lock +++ w/bin/omarchy-system-sleep-lock -@@ -104,6 +104,25 @@ report_unsecured() { +@@ -105,6 +105,25 @@ exit 1 } @@ -42,7 +44,7 @@ index d471cea..b278615 100755 # Request the lock before touching monitor state, so a stuck Hyprland IPC call # cannot consume the window before Quickshell has begun securing the session. request_lock -@@ -113,7 +132,7 @@ sync_clamshell +@@ -114,7 +133,7 @@ # inside the reserve derive_budget_ms already held back for logind. while (( $(remaining_ms) > 0 )); do case $(lock_state) in diff --git a/packages/omamobile-omarchy/patches/0022-lock-fingerprint-only-when-a-finger-is-enrolled.patch b/packages/omamobile-omarchy/patches/0022-lock-fingerprint-only-when-a-finger-is-enrolled.patch index 13c9da150..2faa452f0 100644 --- a/packages/omamobile-omarchy/patches/0022-lock-fingerprint-only-when-a-finger-is-enrolled.patch +++ b/packages/omamobile-omarchy/patches/0022-lock-fingerprint-only-when-a-finger-is-enrolled.patch @@ -1,186 +1,30 @@ -# Lock: fingerprint only when a finger is enrolled. A backport of the probe -# half of upstream Omarchy's 879d6583d ("Fix fingerprint enrollment and -# lock-screen recovery", omacom/omarchy#7158, on quattro for 4.5; no stable -# release has it). The lock and omarchy-apply-lock took -# fprintd-list "$USER" | grep -qi finger as "fingerprint is set up", which -# also matches "User ... has no fingers enrolled ...". On a phone with -# omamobile-fingerprint installed (it ships the PAM file) and nothing -# enrolled, the lock then started a pam_fprintd attempt that failed at once -# (PAM_AUTHINFO_UNAVAIL) and retried every 250 ms for as long as it was up: -# 130,164 attempts in one night, about 55-62 mA (#170). -# -# As upstream: the probe is LC_ALL=C fprintd-list "$USER" 2>&1, and -# FingerprintModel.classifyProbe() reads it: "yes" only for an enrolled-print -# row (" - #0: ..."), "no" for "has no fingers enrolled" (or no PAM file or -# fprintd-list), "unknown" otherwise. Unknown never turns fingerprint off; it -# is asked again after 1 s, doubling to 40 s, while the lock is up. -# omarchy-apply-lock matches the same row, removes the PAM file only on a -# definite "no", and keeps it when the probe fails. -# -# Not taken: the rest of 879d6583d (the attempt backoff and the "reader -# unavailable" notice, the fprintd resume hook and its stop-timeout drop-in, -# the enrollment script changes), so a phone with a finger enrolled behaves -# as before: retries after a mismatch stay at 250 ms. FingerprintModel.js -# holds only upstream's probe functions, copied unchanged. -# -# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003 and 0009. Drop it once the -# phone's Omarchy has 879d6583d (the 4.5 line); its Service.qml and -# omarchy-apply-lock differ from 4.0.6's, so this will not apply there. +# SPDX-License-Identifier: MIT +# Enrollment classification from old0022 is already upstream in4.5; preserve +# its stronger backoff/recovery model unchanged. Mobile addition only: desktop +# apply-lock must preserve existing root-owned PAM and qualified fprintd hooks, +# including Komodo max-tries1; do not overwrite them during migration/setup. + diff --git i/bin/omarchy-apply-lock w/bin/omarchy-apply-lock --- i/bin/omarchy-apply-lock +++ w/bin/omarchy-apply-lock -@@ -40,16 +40,24 @@ - account include system-local-login - EOF +@@ -26,6 +26,20 @@ + fi + } --if [[ -x /usr/bin/fprintd-list ]] && -- /usr/bin/fprintd-list "$target_user" 2>/dev/null | grep -qi finger; then -+# Keep the privileged probe pinned to /usr/bin; failure is not empty enrollment. -+if [[ -x /usr/bin/fprintd-list ]]; then -+ fingerprint_status=$(/usr/bin/fprintd-list "$target_user" 2>&1 || true) -+else -+ fingerprint_status="no" ++# Mobile owns its existing PAM policy (including a single-try fingerprint ++# conversation paired with graceful client release). Desktop setup must not ++# overwrite it, or install unqualified fprintd sleep/restart hooks beside it. ++if [[ -x /usr/bin/omamobile-update && -f /etc/pam.d/omarchy-lock-password ]]; then ++ if [[ -L /etc/pam.d/omarchy-lock-password ]] || ++ [[ $(stat -c %u /etc/pam.d/omarchy-lock-password) != 0 ]] || ++ [[ -n $(find /etc/pam.d/omarchy-lock-password -perm /022 -print) ]]; then ++ echo "Unsafe existing mobile password PAM policy; refusing setup." >&2 ++ exit 1 ++ fi ++ echo "Preserving existing mobile lock PAM and fprintd recovery policy." ++ exit 0 +fi + -+if grep -qE '^[[:space:]]*-[[:space:]]*#[0-9]+:' <<< "$fingerprint_status"; then - echo "Configuring lock screen fingerprint authentication..." - as_root tee /etc/pam.d/omarchy-lock-fingerprint >/dev/null <<'EOF' - #%PAM-1.0 - auth required pam_fprintd.so - account include system-local-login - EOF --else -+elif [[ $fingerprint_status == "no" ]] || grep -qi 'has no fingers enrolled' <<< "$fingerprint_status"; then - as_root rm -f /etc/pam.d/omarchy-lock-fingerprint -+else -+ echo "Could not check fingerprint enrollment; keeping the existing configuration." >&2 - fi + echo "Configuring lock screen password authentication..." - # omarchy-shell can't reach a running shell during chroot install. The echo -diff --git i/shell/plugins/lock/FingerprintModel.js w/shell/plugins/lock/FingerprintModel.js -new file mode 100644 ---- /dev/null -+++ w/shell/plugins/lock/FingerprintModel.js -@@ -0,0 +1,33 @@ -+// The probe half of upstream's FingerprintModel.js (879d6583d): what -+// fprintd-list's answer means, and how often to ask again when it had none. -+var MATCH_RETRY_MS = 250 -+var ERROR_RETRY_BASE_MS = 1000 -+// Leave enough idle time for fprintd to exit and clear a wedged claim. -+var FPRINTD_IDLE_EXIT_MS = 30000 -+var ERROR_RETRY_CAP_MS = 40000 -+ -+function retryDelayMs(streak) { -+ if (streak <= 0) return MATCH_RETRY_MS -+ var delay = ERROR_RETRY_BASE_MS * Math.pow(2, streak - 1) -+ return Math.min(delay, ERROR_RETRY_CAP_MS) -+} -+ -+// A failed probe is unknown, so it cannot disable authentication for the lock. -+function classifyProbe(text) { -+ var s = String(text || "").trim() -+ if (/^[ \t]*-[ \t]*#[0-9]+:/m.test(s)) return "yes" -+ if (s === "no") return "no" -+ if (/has no fingers enrolled/i.test(s)) return "no" -+ return "unknown" -+} -+ -+if (typeof module !== "undefined") { -+ module.exports = { -+ MATCH_RETRY_MS: MATCH_RETRY_MS, -+ ERROR_RETRY_BASE_MS: ERROR_RETRY_BASE_MS, -+ ERROR_RETRY_CAP_MS: ERROR_RETRY_CAP_MS, -+ FPRINTD_IDLE_EXIT_MS: FPRINTD_IDLE_EXIT_MS, -+ classifyProbe: classifyProbe, -+ retryDelayMs: retryDelayMs -+ } -+} -diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml ---- i/shell/plugins/lock/Service.qml -+++ w/shell/plugins/lock/Service.qml -@@ -5,6 +5,7 @@ - import Quickshell.Wayland - import qs.Commons - import qs.Commons as Commons -+import "FingerprintModel.js" as FingerprintModel - - Item { - id: root -@@ -23,6 +24,7 @@ - property bool fingerprintAuthenticating: false - property bool passwordPamConfigured: false - property bool fingerprintConfigured: false -+ property int fingerprintProbeStreak: 0 - property bool keypad: false - property bool previewVisible: false - property string enteredPassword: "" -@@ -119,6 +121,32 @@ - if (!fingerprintCheckProc.running) fingerprintCheckProc.running = true - } - -+ // Only definitive enrollment results may disable authentication. -+ function applyFingerprintProbe(text) { -+ var status = FingerprintModel.classifyProbe(text) -+ if (status === "unknown") { -+ if (fingerprintConfigured) return -+ fingerprintProbeStreak += 1 -+ if (lockRequested) { -+ fingerprintRecheckTimer.interval = FingerprintModel.retryDelayMs(fingerprintProbeStreak) -+ fingerprintRecheckTimer.restart() -+ } -+ return -+ } -+ fingerprintProbeStreak = 0 -+ fingerprintRecheckTimer.stop() -+ fingerprintConfigured = status === "yes" -+ if (lockRequested && fingerprintConfigured) { -+ // A pending retry already owns the next attempt. -+ if (!fingerprintRetryTimer.running) startFingerprint() -+ } else if (!fingerprintConfigured) { -+ // abort() delivers no completion signal, so close the attempt here. -+ if (fingerprintPam.active) fingerprintPam.abort() -+ fingerprintAuthenticating = false -+ fingerprintRetryTimer.stop() -+ } -+ } -+ - function logEvent(event) { - lastEvent = event - lastEventAt = new Date().toISOString() -@@ -132,6 +160,8 @@ - failedAttempts = 0 - authenticatingPassword = false - fingerprintAuthenticating = false -+ fingerprintProbeStreak = 0 -+ fingerprintRecheckTimer.stop() - fingerprintRetryTimer.stop() - if (passwordPam.active) passwordPam.abort() - if (fingerprintPam.active) fingerprintPam.abort() -@@ -390,15 +420,21 @@ - } - } - -+ // Keep fprintd errors distinguishable from an explicit empty enrollment. - Process { - id: fingerprintCheckProc -- command: ["bash", "-c", "if [[ -f /etc/pam.d/omarchy-lock-fingerprint ]] && command -v fprintd-list >/dev/null 2>&1 && fprintd-list \"$USER\" 2>/dev/null | grep -qi finger; then echo yes; else echo no; fi"] -+ command: ["bash", "-c", "if [[ -f /etc/pam.d/omarchy-lock-fingerprint ]] && command -v fprintd-list >/dev/null 2>&1; then LC_ALL=C fprintd-list \"$USER\" 2>&1; else echo no; fi"] - stdout: StdioCollector { id: fingerprintCheckStdout; waitForEnd: true } -- onExited: { -- root.fingerprintConfigured = String(fingerprintCheckStdout.text || "").trim() === "yes" -- if (root.lockRequested && root.fingerprintConfigured) root.startFingerprint() -- else if (!root.fingerprintConfigured && fingerprintPam.active) fingerprintPam.abort() -- } -+ onExited: root.applyFingerprintProbe(fingerprintCheckStdout.text) -+ } -+ -+ // Retries a probe that could not reach fprintd, paced like the attempt -+ // retries so a daemon that stays unreachable is asked about ever less often. -+ Timer { -+ id: fingerprintRecheckTimer -+ interval: FingerprintModel.ERROR_RETRY_BASE_MS -+ repeat: false -+ onTriggered: root.refreshFingerprintStatus() - } - - Process { + as_root tee /etc/pam.d/omarchy-lock-password >/dev/null <<'EOF' diff --git a/packages/omamobile-omarchy/patches/0023-lock-a-glance-view-for-touch-only-devices.patch b/packages/omamobile-omarchy/patches/0023-lock-a-glance-view-for-touch-only-devices.patch index 8f08ea8b7..32bed6669 100644 --- a/packages/omamobile-omarchy/patches/0023-lock-a-glance-view-for-touch-only-devices.patch +++ b/packages/omamobile-omarchy/patches/0023-lock-a-glance-view-for-touch-only-devices.patch @@ -1,56 +1,10 @@ -# Lock: a glance view on touch-only devices (the lock-keypad toggle), as a -# phone's lock screen opens: the time, the date, the home screen's last -# weather reading and the newest notifications, over the lock's blurred -# wallpaper. Only a swipe up (a clear drag, 8 % of the height, or a quick -# flick, from anywhere, a card included) or a typed key (kept in the field) -# moves to the PIN view, which is the lock as before plus a small clock. A -# tap never does: a tap on a card opens it to more of its text (summary up -# to 2 lines, body up to 4) and runs nothing, a second tap closes it, and a -# tap elsewhere does nothing. The first 12 px of a drag decide its way: -# mostly sideways on a card swipes it as a toast swipes (0017's -# finishSwipe: past 35 % or a flick it flies off), and that one notification -# is forgotten through the notifications service's forget call (0019), the -# call the phone's shade makes, so it leaves the history and the shade too, -# and the next one moves up; mostly vertical is the swipe up. It comes back -# whenever the lock is shown, the -# screen is woken (the wake call from 0009) or the screen goes dark: the -# lock's own blank, or a new "dark" call for what blanks it from outside -# (the phone's power button, and sleep). With an empty field and no input it -# also comes back after 15 s, counted on the wall clock so that a sleep in -# between can't freeze it. A touch on a dark screen, and one within 400 ms -# of a wake, only wakes it, and open cards close again. Only one view shows -# outside the short change; the other is hidden, so nothing of the PIN view -# renders or takes touches under the glance. Fingerprint unlock is untouched -# and works from both. -# -# The cards are Omarchy's NotificationCard, static as the history uses it, -# one per notification, newest first, as many as fit above the hint (up to -# three), then a line for the rest ("N more from A and B", "N more from A, -# B and 2 others"), with three new card properties: summaryLines, bodyLines -# and a detail label (the age, "2m"). -# Read (the forget is the one change) from the notifications plugin's -# persisted toasts and history -# (~/.local/state/omarchy/notifications/*.json, history/*.json): the same -# notifications the phone's shade lists, the newest ten with no age limit, -# Omarchy's own messages (omarchy-action, shown as Omarchy) and notify-send -# included. While do-not-disturb is on (notifications.json "dnd"), only what -# still toasts shows: Omarchy's own messages and a critical notify-send. -# The toggle lock-hide-notification-text shows the app name and "Unlock to -# read" instead of the text. Weather comes from -# ~/.local/state/omamobile/weather.json, written by the phone shell's -# omamobile-weather service, and is hidden when absent or over 3 h old; the -# lock makes no network calls. The clock is 12- or 24-hour as the phone bar -# and the home screen's clock decide, from the bar's clockFormat (shell.json, -# read at once whatever the lock shows, on every change and whenever the -# glance comes back; a failed read keeps the last), else the bar's default -# (HH:mm), never the session's C/POSIX locale. The big glance time is built -# without AM/PM (Qt's "h" without a marker counts to 23), the small clock -# over the PIN view keeps it. On a computer the lock is unchanged. -# -# Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003, 0009, 0011, 0014, 0017 -# and 0019. -diff --git i/shell/plugins/lock/LockGlance.js w/shell/plugins/lock/LockGlance.js -new file mode 100644 +# SPDX-License-Identifier: MIT +# Port mobileglance to4.5auth/wake fields without changing authcapabilities. +# Retain licensed4.0.6 standaloneNotificationCard/NotificationLogic API for +# privatepixel.lock too; parse4.5compactlive/history arrays into legacyreadrows, +# preserve stablekeys forIPCforget and readDNDfromquiet.json. No actions/network. +#4.5Toast is a different scene-boundtype, not a compatibleglance replacement. + --- /dev/null +++ w/shell/plugins/lock/LockGlance.js @@ -0,0 +1,164 @@ @@ -218,8 +172,6 @@ new file mode 100644 + var text = String(w.text || "").trim() + return Math.round(w.temperature) + "°" + (text ? ", " + text.charAt(0).toLowerCase() + text.slice(1) : "") +} -diff --git i/shell/plugins/lock/LockGlance.qml w/shell/plugins/lock/LockGlance.qml -new file mode 100644 --- /dev/null +++ w/shell/plugins/lock/LockGlance.qml @@ -0,0 +1,628 @@ @@ -542,7 +494,7 @@ new file mode 100644 + } + + FileView { -+ path: glance.active ? glance.home + "/.local/state/omarchy/notifications.json" : "" ++ path: glance.active ? glance.home + "/.local/state/omarchy/notifications/quiet.json" : "" + watchChanges: true + printErrors: false + onLoaded: glance.doNotDisturb = Glance.doNotDisturb(text()) @@ -851,10 +803,9 @@ new file mode 100644 + } + } +} -diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml --- i/shell/plugins/lock/LockView.qml +++ w/shell/plugins/lock/LockView.qml -@@ -31,6 +31,16 @@ +@@ -33,6 +33,16 @@ // The ABC/123 switch in the field swaps either way, so a password with // letters and digits can always be typed. property bool passwordFirst: false @@ -871,18 +822,15 @@ diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml property bool switchedInput: false readonly property bool padShown: keypad && (passwordFirst === switchedInput) readonly property real inputSwitchReserve: keypad ? Math.round(inputSwitch.implicitWidth + 12) : 0 -@@ -73,6 +83,10 @@ - } +@@ -71,6 +81,7 @@ + signal wakeRequested() function forcePasswordFocus() { -+ if (glance.showing) { -+ glance.forceActiveFocus() -+ return -+ } ++ if (glance.showing) { glance.forceActiveFocus(); return } if (padShown) { keypadKeys.forceActiveFocus() return -@@ -200,7 +214,8 @@ +@@ -229,7 +240,8 @@ Keypad { id: numberPad @@ -892,7 +840,7 @@ diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml enabled: root.inputEnabled && !root.authenticatingPassword anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom -@@ -226,6 +241,8 @@ +@@ -255,6 +267,8 @@ BorderSurface { id: inputField @@ -901,17 +849,27 @@ diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml width: root.fieldWidth height: root.fieldHeight anchors.horizontalCenter: parent.horizontalCenter -@@ -365,7 +382,8 @@ +@@ -408,7 +422,8 @@ + width: parent.width - Style.space(32) + wrapMode: root.keypad ? Text.WordWrap : Text.NoWrap + anchors.horizontalCenter: inputField.horizontalCenter +- visible: root.fingerprintConfigured && root.fingerprintUnavailable ++ visible: root.fingerprintConfigured && root.fingerprintUnavailable && root.pinVisible ++ opacity: root.pinOpacity + text: Commons.I18n.t("lock.fingerprintUnavailable") + color: Commons.Color.lock.textError + font.family: Style.font.family +@@ -427,7 +442,8 @@ anchors.bottomMargin: Style.space(18) anchors.horizontalCenter: inputField.horizontalCenter width: parent.width - Style.space(32) -- visible: root.keypadClearsSensor -+ visible: root.keypadClearsSensor && root.pinVisible +- visible: root.keypadClearsSensor && !root.fingerprintUnavailable ++ visible: root.keypadClearsSensor && !root.fingerprintUnavailable && root.pinVisible + opacity: root.pinOpacity text: root.padShown ? "Touch the fingerprint sensor or enter your PIN" : "Touch the fingerprint sensor or enter your password" color: Commons.Color.lock.text -@@ -383,9 +401,10 @@ +@@ -445,9 +461,10 @@ Item { id: emergencyButton objectName: "lockEmergencyCall" @@ -924,7 +882,7 @@ diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml anchors.topMargin: Style.space(20) width: emergencyLabel.implicitWidth + Style.space(40) height: Math.max(Style.space(44), emergencyLabel.implicitHeight + Style.space(16)) -@@ -411,5 +430,12 @@ +@@ -473,5 +490,12 @@ } } } @@ -937,67 +895,51 @@ diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml + } } } -diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml --- i/shell/plugins/lock/Service.qml +++ w/shell/plugins/lock/Service.qml -@@ -31,6 +31,15 @@ - property int failedAttempts: 0 +@@ -54,6 +54,9 @@ property string backgroundPath: "" + property string videoPosterPath: "" property int backgroundVersion: 0 -+ // Bumped by the wake call (a phone's power button): the lock's glance view -+ // comes back each time the screen is woken. + property int wakeSerial: 0 -+ // Bumped whenever the locked display goes dark: the lock's own blank, or -+ // the dark call (a phone's power button, sleep). The glance view comes -+ // back each time, and displayDark holds until the display is lit through -+ // the lock again, so the touch that wakes a dark screen only wakes it. + property int blankSerial: 0 + property bool displayDark: false - property string lastEvent: "init" - property string lastEventAt: "" - property bool strandedLock: false -@@ -178,14 +187,22 @@ + // The wallpaper file's mtime and size. The lock caches its wallpaper by + // version, so a file overwritten in place must bump the version too. + property string backgroundSignature: "" +@@ -257,6 +260,7 @@ } function runWake() { + displayDark = false if (!wakeProcess.running) wakeProcess.running = true if (lockRequested) armBlankTimer() + resumeFingerprint() +@@ -351,8 +355,15 @@ } function runBlank() { + markDark() + pauseFingerprint() if (!blankProcess.running) blankProcess.running = true - } - ++ } ++ + function markDark() { + if (!lockRequested) return + blankSerial += 1 + displayDark = true -+ } -+ - function submitPassword(value) { - var password = String(value || "") - if (!lockRequested || authenticatingPassword || password.length === 0) return -@@ -280,6 +297,9 @@ + } - LockView { - keypad: root.keypad -+ wakeSerial: root.wakeSerial -+ blankSerial: root.blankSerial -+ displayDark: root.displayDark - id: lockView - anchors.fill: parent - backgroundPath: root.backgroundPath -@@ -548,10 +568,21 @@ + function submitPassword(value) { +@@ -903,7 +914,18 @@ // it and re-arm the blank timer (a phone's power button). function wake(): string { if (!root.currentlyLocked()) return "unlocked" + root.wakeSerial += 1 root.runWake() - return "ok" - } - ++ return "ok" ++ } ++ + // The locked display went dark some other way than the lock's own blank + // (a phone's power button, or just before sleep): back to the glance + // view, and the touch that next wakes the screen only wakes it. The @@ -1005,44 +947,877 @@ diff --git i/shell/plugins/lock/Service.qml w/shell/plugins/lock/Service.qml + function dark(): string { + if (!root.currentlyLocked()) return "unlocked" + root.markDark() -+ return "ok" + return "ok" + } + +--- /dev/null ++++ w/shell/plugins/notifications/NotificationLogic.js +@@ -0,0 +1,515 @@ ++// SPDX-License-Identifier: MIT ++// Retained licensed4.0.6 compatibility component; not the4.5 daemon. ++// Copyright (c) David Heinemeier Hansson ++// ++// Permission is hereby granted, free of charge, to any person obtaining ++// a copy of this software and associated documentation files (the ++// "Software"), to deal in the Software without restriction, including ++// without limitation the rights to use, copy, modify, merge, publish, ++// distribute, sublicense, and/or sell copies of the Software, and to ++// permit persons to whom the Software is furnished to do so, subject to ++// the following conditions: ++// ++// The above copyright notice and this permission notice shall be ++// included in all copies or substantial portions of the Software. ++// ++// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE ++// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION ++// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ++// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++// Mobile touch changes: Copyright (c) 2026 Derek Ross ++function isChromiumDerived(app, appIcon) { ++ var source = (String(app || "") + "\n" + String(appIcon || "")).toLowerCase() ++ return source.indexOf("chrom") >= 0 || source.indexOf("brave") >= 0 || ++ source.indexOf("vivaldi") >= 0 || source.indexOf("microsoft-edge") >= 0 || ++ source.indexOf("opera") >= 0 ++} ++ ++// True when a `<...>` run is an image tag, so the name is read the way Qt's ++// parser reads it: after the `<`, the leading run of letters and digits. ++// ++// Skip everything up to that run rather than matching the separator, because ++// there is no JavaScript expression for what Qt skips. QQuickStyledText calls ++// skipSpace(), which is QChar::isSpace(), and that set is not `\s`: Qt counts ++// U+0085 NEL and `\s` does not, while `\s` counts U+FEFF and Qt does not. A ++// name read with `\s` therefore misses a tag written as `<`, U+0085, `img`: ++// Qt skips the NEL, reads `img` and issues the GET, while the regex finds no ++// name at all and the tag is kept. Measured against Qt 6.11.2. ++// ++// Over-skipping is the safe direction. It can only classify more runs as ++// images, and dropping a run never manufactures a tag: a dropped run joins two ++// stretches of text that each contain no `<`. ++function isImageTag(tag) { ++ var name = /^<[^A-Za-z0-9]*([A-Za-z0-9]+)/.exec(tag) ++ return !!name && name[1].toLowerCase() === "img" ++} ++ ++// The body renders as StyledText so notifications can use the markup the ++// body-markup capability advertises (see Service.qml). StyledText honours ++// , and a remote src makes the shell issue an unauthenticated GET ++// with no user action, so image tags go before the renderer sees them. ++// ++// Work in whole tags, never in substrings of one. A `<` opens a tag that runs ++// to the next `>`, nested `<` and all, and only a tag whose own name is `img` ++// is dropped. ++// ++// That is the conservative bound, not Qt's exact one: Qt lets a `>` inside a ++// quoted attribute value pass without closing the tag, so a Qt tag can be ++// longer than the run taken here. Do not "correct" this to match Qt. Taking ++// the shorter run only ever splits one Qt tag into several, and a split can ++// only expose an `` through. ++// ++// Deleting a substring is what makes a naive `/]*>/g` unsafe. Given ++// ++// g src="http://a/beacon.png"> ++// ++// Qt reads ONE malformed tag named `im` and renders nothing, but removing the ++// inner match closes the surviving halves up into `` ++// — a live tag the input never contained. The stripper would be manufacturing ++// the very thing it exists to remove. ++// ++// Because every `<` opens a tag, the text between tags never contains one, so ++// dropping a tag cannot splice its neighbours into a new one. That makes a ++// single pass sufficient, with no re-scanning and no input bound to police. ++function stripImageTags(text) { ++ var out = "" ++ var i = 0 ++ ++ while (i < text.length) { ++ var open = text.indexOf("<", i) ++ if (open === -1) { ++ out += text.slice(i) ++ break + } + - function isLocked(): string { - return root.currentlyLocked() ? "true" : "false" - } -diff --git i/shell/plugins/notifications/components/NotificationCard.qml w/shell/plugins/notifications/components/NotificationCard.qml ---- i/shell/plugins/notifications/components/NotificationCard.qml ++ out += text.slice(i, open) ++ ++ // An unterminated tag at the end of the string still reaches the renderer, ++ // which closes it itself, so treat the remainder as one tag. ++ var close = text.indexOf(">", open) ++ var tag = close === -1 ? text.slice(open) : text.slice(open, close + 1) ++ ++ if (!isImageTag(tag)) out += tag ++ i = close === -1 ? text.length : close + 1 ++ } ++ ++ return out ++} ++ ++// What the card renders, and the last thing to touch the string before Qt parses ++// it. The newline rewrite belongs here rather than in the card because it inserts ++// `
` into text stripImageTags chose to KEEP, and a kept tag may hold a `<` of ++// its own: `` is one tag named `x` to both the ++// stripper and Qt, until the rewrite splits it into `` and a live image tag ++// the input never contained. Measured against Qt 6.11.2 — the rewritten form ++// fetches, the original does not. So strip again after, and what Qt parses is what ++// was checked last. ++function styledBody(body, app, appIcon) { ++ return stripImageTags(sanitizeBody(body, app, appIcon).replace(/\r\n|\r|\n/g, "
")) ++} ++ ++function sanitizeBody(body, app, appIcon) { ++ var text = stripImageTags(String(body || "")) ++ if (!isChromiumDerived(app, appIcon)) return text ++ ++ return text ++ .replace(/^\s*]*>\s*(?:https?:\/\/|www\.)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/[^<\s]*)?\s*<\/a>\s*/i, "") ++ .replace(/^\s*(?:https?:\/\/|www\.)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/\S*)?\s+/i, "") ++} ++ ++function summaryStartsWithGlyph(summary) { ++ var text = String(summary || "").replace(/^\s+/, "") ++ if (!text) return false ++ ++ var offset = 1 ++ var first = text.charCodeAt(0) ++ if (first >= 0xd800 && first <= 0xdbff && text.length > 1) offset = 2 ++ ++ var spaces = 0 ++ while (offset < text.length && text.charAt(offset) === " ") { ++ spaces++ ++ offset++ ++ } ++ ++ return spaces >= 2 ++} ++ ++function shouldBypassDnd(notification, criticalUrgency) { ++ var appName = String((notification && notification.appName) || "") ++ if (appName === "omarchy-action") return true ++ return appName === "notify-send" && notification && notification.urgency === criticalUrgency ++} ++ ++function isEphemeralApp(appName) { ++ var name = String(appName || "") ++ return name === "notify-send" || name === "omarchy-action" ++} ++ ++function stringHint(hints, name) { ++ try { ++ if (hints) { ++ var value = hints[name] ++ if (value !== undefined && value !== null) return String(value) ++ } ++ } catch (e) { ++ } ++ return "" ++} ++ ++function glyphFromHints(hints) { ++ return stringHint(hints, "omarchy-glyph") ++} ++ ++// The click action: a JSON argv string from omarchy-notification-send ++// --exec. Carried as data so a toast restored after a shell restart stays ++// clickable (a libnotify action can't — its sender is gone). Run via ++// Util.execArgv as bash positional parameters, never a shell string, so ++// attacker-controlled values (a title, a filename) can't become commands. ++function execArgvFromHints(hints) { ++ return stringHint(hints, "omarchy-exec-argv") ++} ++ ++// Validate a persisted omarchy-exec-argv into a runnable argv, or null. This is ++// a STRUCTURAL check only: it fails closed on a malformed hint (non-array, a ++// non-string or empty program, or a leading-dash program that argv would read as ++// an option). It does not judge intent — a well-formed ["bash","-c",…] is ++// accepted. WHICH senders may set this hint is a separate boundary: any ++// session-bus process can, by the freedesktop protocol's design (see ++// docs/notifications.md), which is equivalent to same-uid code execution. ++function parseExecArgv(value) { ++ var text = String(value || "") ++ if (!text) return null ++ ++ var parsed ++ try { ++ parsed = JSON.parse(text) ++ } catch (e) { ++ return null ++ } ++ ++ if (!Array.isArray(parsed) || parsed.length === 0) return null ++ for (var i = 0; i < parsed.length; i++) { ++ if (typeof parsed[i] !== "string") return null ++ } ++ if (!parsed[0] || parsed[0].charAt(0) === "-") return null ++ return parsed ++} ++ ++function shouldRenderCompactGlyph(glyph, iconSource, singleLineToast) { ++ return String(glyph || "").length > 0 && String(iconSource || "").length === 0 && !!singleLineToast ++} ++ ++function snapshotOf(notification, timestamp) { ++ var n = notification || {} ++ var id = n.id || 0 ++ var expireTimeout = Number(n.expireTimeout || 0) ++ if (!isFinite(expireTimeout) || expireTimeout < 0) expireTimeout = 0 ++ return { ++ id: id, ++ originalId: id, ++ app: n.appName || "", ++ appIcon: n.appIcon || "", ++ summary: String(n.summary || ""), ++ body: n.body || "", ++ image: n.image || "", ++ glyph: glyphFromHints(n.hints), ++ execArgv: execArgvFromHints(n.hints), ++ urgency: n.urgency, ++ expireTimeout: expireTimeout, ++ timestamp: timestamp === undefined ? Date.now() : timestamp ++ } ++} ++ ++// Everything the popup card draws, and therefore everything an in-place ++// update has to write through to the row and its file. ++var POPUP_ROLES = ["app", "appIcon", "summary", "body", "image", "glyph", "execArgv", "urgency", "expireTimeout"] ++ ++function popupRoles() { ++ return POPUP_ROLES ++} ++ ++// Whether a refresh has anything to write. Each property a client updates ++// emits its own signal, and the catch-up refresh after a row is inserted ++// usually finds the object exactly as it was snapshotted — without this, ++// one update would rewrite the file several times over. ++function popupRowChanged(row, updated) { ++ var current = row || {} ++ var next = updated || {} ++ for (var i = 0; i < POPUP_ROLES.length; i++) { ++ var role = POPUP_ROLES[i] ++ if (current[role] !== next[role]) return true ++ } ++ return false ++} ++ ++// A client updating a notification through replaces_id keeps the identity of ++// the popup it took over: the file name is the timestamp and id the popup was ++// first persisted under, and the restore, replace and archive paths all key ++// off that name. Only what the card draws comes from the updated object. ++function replacementSnapshot(notification, originalId, timestamp) { ++ var updated = snapshotOf(notification, timestamp) ++ updated.id = originalId ++ updated.originalId = originalId ++ return updated ++} ++ ++function historyEntry(value, normalUrgency) { ++ var e = value || {} ++ var out = { ++ id: e.id || 0, ++ originalId: e.originalId || e.id || 0, ++ app: e.app || "", ++ appIcon: e.appIcon || "", ++ summary: e.summary || "", ++ body: e.body || "", ++ image: e.image || "", ++ glyph: e.glyph || "", ++ execArgv: e.execArgv || "", ++ urgency: typeof e.urgency === "number" ? e.urgency : normalUrgency, ++ expireTimeout: 0, ++ timestamp: e.timestamp || 0 ++ } ++ if (typeof e.key === "string" && /^[A-Za-z0-9_-]{1,120}$/.test(e.key)) out.key = e.key ++ return out ++} ++ ++// notifications.json holds nothing but the last-set DND preference now that ++// history is a directory of files. Older versions kept `pending`/`past` ++// (and, older still, `entries`) arrays in there; their presence is reported ++// so the service can rewrite the file without the dead payload. ++function parseSettings(raw) { ++ var text = String(raw || "").trim() ++ if (!text) return { error: false, dnd: null, legacy: false } ++ ++ try { ++ var parsed = JSON.parse(text) ++ return { ++ error: false, ++ dnd: parsed && typeof parsed.dnd === "boolean" ? parsed.dnd : null, ++ legacy: !!(parsed && (parsed.pending || parsed.past || parsed.entries)) ++ } ++ } catch (e) { ++ return { error: true, errorMessage: String(e), dnd: null, legacy: false } ++ } ++} ++ ++// ---------------------------------------------------- popup persistence ++// ++// Each on-screen popup is mirrored to its own file under ++// ~/.local/state/omarchy/notifications/ so toasts survive shell restarts ++// (e.g. the restart `omarchy-update` performs). The file exists exactly as ++// long as the popup is on screen: it is written when the toast appears and ++// moved into the history/ subdirectory when the toast expires, is dismissed, ++// or its action is invoked. History is those moved files, newest last-10. ++ ++function popupEntry(value, normalUrgency) { ++ var entry = historyEntry(value, normalUrgency) ++ var expire = Number((value || {}).expireTimeout || 0) ++ if (!isFinite(expire) || expire < 0) expire = 0 ++ entry.expireTimeout = expire ++ // Absolute expiry deadline, set only when a restore resets a surviving ++ // popup's display lifetime. Kept out of the entry entirely when unset so ++ // restored rows match the roles of freshly received ones. ++ var deadline = Number((value || {}).deadline || 0) ++ if (isFinite(deadline) && deadline > 0) entry.deadline = deadline ++ return entry ++} ++ ++function popupFileName(entry) { ++ if (entry && typeof entry.key === "string" && /^[A-Za-z0-9_-]{1,120}$/.test(entry.key)) return entry.key ++ return imageStem(entry) + ".json" ++} ++ ++// ---------------------------------------------------- persisted images ++// ++// A notification's images only exist while it is live: Chromium-family ++// senders (all Omarchy web apps) delete their scoped /tmp files on close, ++// and image-data hints surface as in-process image:// URLs that die with ++// the server object. Persisted entries therefore reference their own ++// copies, named by the entry's file stem so cleanup can find them from ++// the JSON file name alone. ++ ++var PERSISTED_IMAGE_ROLES = ["appIcon", "image"] ++ ++function imageStem(entry) { ++ var e = entry || {} ++ return String(e.timestamp || 0) + "-" + String(e.originalId || 0) ++} ++ ++// The filesystem path behind a file-backed image value, or "" for anything ++// a copy can't capture: themed icon names, in-process image:// URLs, empty. ++function localImageFile(value) { ++ var s = String(value || "") ++ if (s.indexOf("file://") === 0) { ++ s = s.slice(7) ++ try { s = decodeURIComponent(s) } catch (e) {} ++ } ++ return s.charAt(0) === "/" ? s : "" ++} ++ ++// The entry as it should hit the disk, plus the copies that make it true. ++// File-backed images redirect to their copy under imagesDir; dead image:// ++// URLs drop to "" (the card falls back to the app icon). Already-redirected ++// values map onto themselves and produce no copy, keeping restores no-ops. ++function persistablePopup(entry, imagesDir) { ++ var e = entry || {} ++ var out = {} ++ for (var key in e) out[key] = e[key] ++ var copies = [] ++ for (var i = 0; i < PERSISTED_IMAGE_ROLES.length; i++) { ++ var role = PERSISTED_IMAGE_ROLES[i] ++ var value = String(out[role] || "") ++ if (!value) continue ++ var source = localImageFile(value) ++ if (source) { ++ var copy = String(imagesDir || "") + imageStem(e) + "-" + role ++ if (source !== copy) copies.push({ from: source, to: copy }) ++ out[role] = "file://" + copy ++ } else if (value.indexOf("image://") === 0) { ++ out[role] = "" ++ } ++ } ++ return { entry: out, copies: copies } ++} ++ ++function serializePopup(entry, normalUrgency) { ++ // Compact (single-line) on purpose: restore cats every file together and ++ // parses line by line, which only works when each file is one line. ++ return JSON.stringify(popupEntry(entry, normalUrgency)) ++} ++ ++// Parse the concatenation of every persisted popup file into entries, ++// newest-first. Deliberately NO dedupe by originalId: ids restart from 1 ++// with every server process, so two files sharing an id are usually ++// different generations — dropping the older one would silently discard a ++// restored critical alert the moment a fresh notification reuses its id. ++// The one case that leaves a genuine duplicate (a crash between a ++// replacement's write and the replaced file's delete) merely re-shows a ++// superseded toast, which expires or is dismissed and cleans itself up. ++function parsePopupFiles(raw, normalUrgency) { ++ var lines = String(raw || "").split("\n") ++ var entries = [] ++ for (var i = 0; i < lines.length; i++) { ++ var line = lines[i].trim() ++ if (!line) continue ++ try { ++ var value = JSON.parse(line) ++ var values = Array.isArray(value) ? value : [value] ++ for (var j = 0; j < values.length && j < 1000; j++) { ++ var row = values[j] ++ if (!row || typeof row !== "object" || Array.isArray(row)) continue ++ //4.5live/history are compact arrays; quiet state is not a row. ++ if (typeof row.key === "string") { ++ if (!/^[A-Za-z0-9_-]{1,120}$/.test(row.key) || typeof row.ts !== "number" || !isFinite(row.ts)) continue ++ row = Object.assign({}, row, { timestamp: row.ts * 1000 }) ++ } else if (!row.timestamp && !row.summary && !row.body) continue ++ entries.push(popupEntry(row, normalUrgency)) ++ } ++ } catch (e) { ++ // A torn write from a crash mid-save — skip the line, keep the rest. ++ } ++ } ++ entries.sort(function(a, b) { return (b.timestamp || 0) - (a.timestamp || 0) }) ++ return entries ++} ++ ++// A persisted popup whose lifetime already ran out would have expired on ++// screen had the shell kept running, so it is not restored. duration 0 means ++// the popup never expires (critical urgency) and always survives restarts. ++// A restore-reset deadline outranks the original timestamp: without it, a ++// second restart would judge a re-shown toast by a clock that no longer ++// governs its display and drop it while it is still on screen. ++function popupExpired(entry, duration, now) { ++ var deadline = Number((entry || {}).deadline || 0) ++ if (isFinite(deadline) && deadline > 0) return Number(now) >= deadline ++ var lifetime = Number(duration || 0) ++ if (!isFinite(lifetime) || lifetime <= 0) return false ++ return (Number(now) - Number((entry || {}).timestamp || 0)) >= lifetime ++} ++ ++function popupPlacement(barPosition, barClearance, gapsOut) { ++ var position = String(barPosition || "top") ++ var clearance = Number(barClearance) ++ var gap = Number(gapsOut) ++ if (!isFinite(clearance)) clearance = 0 ++ if (!isFinite(gap)) gap = 0 ++ ++ return { ++ anchors: { top: true, bottom: false, left: false, right: true }, ++ margins: { ++ top: position === "top" ? clearance : gap, ++ bottom: gap, ++ left: gap, ++ right: position === "right" ? clearance : gap ++ } ++ } ++} ++ ++// The archived files are the history. They are read back exactly like the ++// live popup files, then normalized into history rows: replaying a toast ++// must not inherit the original's expire timeout or restore deadline, so it ++// gets the standard on-screen lifetime for its urgency instead. ++// ++// liveRows are the toasts still on screen when the replay was asked for. ++// They belong in it — they're the newest notifications there are — but the ++// directory read races their archival, so they're carried across by hand and ++// keyed by file name (timestamp + id) to drop the copy the read already saw. ++function historyRows(raw, liveRows, normalUrgency, limit) { ++ var max = limit === undefined || limit === null ? 10 : Number(limit) ++ if (isNaN(max)) max = 10 ++ max = Math.max(0, max) ++ ++ var out = [] ++ var seen = {} ++ function collect(rows) { ++ for (var i = 0; i < rows.length; i++) { ++ var entry = rows[i] ++ if (!entry) continue ++ var key = popupFileName(entry) ++ if (seen[key]) continue ++ seen[key] = true ++ out.push(historyEntry(entry, normalUrgency)) ++ } ++ } ++ ++ collect(Array.isArray(liveRows) ? liveRows : []) ++ collect(parsePopupFiles(raw, normalUrgency)) ++ out.sort(function(a, b) { return (b.timestamp || 0) - (a.timestamp || 0) }) ++ return out.slice(0, max) ++} ++ ++if (typeof module !== "undefined") { ++ module.exports = { ++ isChromiumDerived: isChromiumDerived, ++ sanitizeBody: sanitizeBody, ++ styledBody: styledBody, ++ summaryStartsWithGlyph: summaryStartsWithGlyph, ++ shouldBypassDnd: shouldBypassDnd, ++ isEphemeralApp: isEphemeralApp, ++ stringHint: stringHint, ++ glyphFromHints: glyphFromHints, ++ execArgvFromHints: execArgvFromHints, ++ parseExecArgv: parseExecArgv, ++ shouldRenderCompactGlyph: shouldRenderCompactGlyph, ++ snapshotOf: snapshotOf, ++ popupRoles: popupRoles, ++ popupRowChanged: popupRowChanged, ++ replacementSnapshot: replacementSnapshot, ++ historyEntry: historyEntry, ++ parseSettings: parseSettings, ++ historyRows: historyRows, ++ popupEntry: popupEntry, ++ popupFileName: popupFileName, ++ imageStem: imageStem, ++ localImageFile: localImageFile, ++ persistablePopup: persistablePopup, ++ serializePopup: serializePopup, ++ parsePopupFiles: parsePopupFiles, ++ popupExpired: popupExpired, ++ popupPlacement: popupPlacement ++ } ++} +--- /dev/null +++ w/shell/plugins/notifications/components/NotificationCard.qml -@@ -27,6 +27,11 @@ - property int urgency: 1 - property double timestamp: 0 - property int cornerRadius: 0 +@@ -0,0 +1,443 @@ ++// SPDX-License-Identifier: MIT ++// Retained licensed4.0.6 compatibility component; not the4.5 daemon. ++// Copyright (c) David Heinemeier Hansson ++// ++// Permission is hereby granted, free of charge, to any person obtaining ++// a copy of this software and associated documentation files (the ++// "Software"), to deal in the Software without restriction, including ++// without limitation the rights to use, copy, modify, merge, publish, ++// distribute, sublicense, and/or sell copies of the Software, and to ++// permit persons to whom the Software is furnished to do so, subject to ++// the following conditions: ++// ++// The above copyright notice and this permission notice shall be ++// included in all copies or substantial portions of the Software. ++// ++// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE ++// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION ++// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ++// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++// Mobile touch changes: Copyright (c) 2026 Derek Ross ++// Notification card. Pure presentational — no service, Notification, or ++// ListModel references. The popup container drives lifetime; the history ++// panel drives static rendering. Both use the same component. ++ ++import QtQuick ++import QtQuick.Layouts ++import Quickshell ++import qs.Commons ++import qs.Commons as Commons ++import qs.Ui ++import "../NotificationLogic.js" as NotificationLogic ++ ++BorderSurface { ++ id: root ++ ++ property string app: "" ++ property string appIcon: "" ++ property string summary: "" ++ property string body: "" ++ property string image: "" ++ // Nerd Font glyph rendered in the icon slot when no real icon is set. ++ // Used by omarchy-notification-send so user-action toasts (`Silenced ++ // notifications` etc.) show their bell/lock/etc. glyph without leaking ++ // into the summary text. ++ property string glyph: "" ++ // NotificationUrgency: Low=0, Normal=1, Critical=2 (upstream). ++ property int urgency: 1 ++ property double timestamp: 0 ++ property int cornerRadius: 0 + // A static summary (a phone's lock screen) keeps each card short, and + // says beside the summary how many there are and how old ("2 new, 5m"). + property int summaryLines: 2 + property int bodyLines: 3 + property string detail: "" - - // System monospace font injected by the container. - property string fontFamily: "" -@@ -300,7 +305,7 @@ - font.bold: true - wrapMode: Text.WordWrap - elide: Text.ElideRight -- maximumLineCount: 2 ++ ++ // System monospace font injected by the container. ++ property string fontFamily: "" ++ ++ readonly property bool hovered: hoverTracker.hovered ++ // The card is under the user's hand: a mouse over it, or a finger ++ // swiping it. The popup container pauses the countdown meanwhile. ++ readonly property bool held: hovered || swipeHandler.active ++ ++ // Touch: a horizontal swipe dismisses (swipeEnabled), and a close button ++ // shows in the top-right corner (closeButtonShown), as a tap runs the ++ // default action and a touch screen has no right button. The container ++ // shows the button when the seat has a touch screen, so a mouse-only ++ // desktop looks and behaves as before. ++ property bool swipeEnabled: true ++ property bool closeButtonShown: false ++ // How far the card has been swiped sideways, in pixels. ++ property real swipeOffset: 0 ++ // Release speed of the last swipe, pixels per second. ++ property real swipeVelocity: 0 ++ property bool dismissing: false ++ ++ // Inline reply (the freedesktop `inline-reply` action): the popup container ++ // sets the sender's placeholder text while the live notification takes a ++ // reply. The history panel leaves it empty: a stored notification can't be ++ // answered. ++ property string replyPlaceholder: "" ++ // The reply field is open. The container keeps the toast on screen and ++ // gives its surface keyboard focus meanwhile. ++ property bool replying: false ++ ++ signal closeRequested() ++ signal cardClicked() ++ signal replyRequested() ++ signal replySent(string text) ++ signal replyCancelled() ++ ++ function sendReply() { ++ var text = replyField.text ++ if (text.trim().length === 0) return ++ root.replySent(text) ++ } ++ ++ // A field that opens gets focus, so an on-screen keyboard shows; one that ++ // closes forgets what was typed. ++ onReplyingChanged: { ++ if (replying) Qt.callLater(function() { replyField.forceActiveFocus() }) ++ else replyField.text = "" ++ } ++ // Prefer per-notification media/avatar data, then fall back to the app icon. ++ // The `check` flag avoids Qt's missing-texture placeholder for unknown names. ++ readonly property string smallIconSource: image.length > 0 ? image : iconSource(appIcon) ++ readonly property bool hasGlyph: glyph.length > 0 ++ readonly property bool compactGlyph: NotificationLogic.shouldRenderCompactGlyph(glyph, smallIconSource, singleLineToast) ++ readonly property bool hasSmallIcon: smallIconSource.length > 0 ++ readonly property bool summaryStartsWithGlyph: NotificationLogic.summaryStartsWithGlyph(summary) ++ readonly property bool singleLineToast: sanitizedBody.length === 0 ++ readonly property bool collapseRedundantIcon: singleLineToast && !hasGlyph && summaryStartsWithGlyph ++ readonly property string sanitizedBody: sanitizeBody(body) ++ readonly property string styledBody: NotificationLogic.styledBody(body, app, appIcon) ++ ++ readonly property color dimColor: Qt.darker(Commons.Color.notifications.text, 1.4) ++ readonly property color bodyColor: Qt.darker(Commons.Color.notifications.text, 1.15) ++ readonly property color accentColor: urgency === 2 ? Commons.Color.urgent : (urgency === 0 ? dimColor : Commons.Color.notifications.countdown) ++ readonly property var cardBorderSpec: Border.surfaceSpec("notifications", "border", Commons.Color.notifications.border, Math.max(1, Style.space(2))) ++ ++ // A swipe ends: past 35% of the width, or flicked fast enough the same ++ // way, the card flies off that side and closes; otherwise it springs back. ++ function finishSwipe() { ++ var distance = Math.abs(root.swipeOffset) ++ var sameWay = root.swipeVelocity * root.swipeOffset > 0 ++ var flung = sameWay && Math.abs(root.swipeVelocity) >= Style.space(900) && distance >= root.width * 0.1 ++ if (root.width > 0 && (distance >= root.width * 0.35 || flung)) { ++ root.dismissing = true ++ swipeAnimation.to = (root.swipeOffset < 0 ? -1 : 1) * (root.width + Style.space(24)) ++ swipeAnimation.dismiss = true ++ } else { ++ swipeAnimation.to = 0 ++ swipeAnimation.dismiss = false ++ } ++ swipeAnimation.restart() ++ } ++ ++ function sanitizeBody(s) { ++ return NotificationLogic.sanitizeBody(s, app, appIcon) ++ } ++ ++ function iconSource(icon) { ++ var value = String(icon || "") ++ if (value.length === 0) return "" ++ if (value.indexOf("file://") === 0 || value.indexOf("image://") === 0) return value ++ if (value.charAt(0) === "/") return Util.fileUrl(value) ++ return Quickshell.iconPath(value, true) ++ } ++ ++ implicitWidth: Style.space(380) ++ // Add vertical border insets so mainColumn (inset by border on top/left/right) ++ // doesn't push content under the bottom edge. ++ implicitHeight: Math.max(mainColumn.implicitHeight, closeButtonShown ? closeButton.height : 0) + borderTop + borderBottom ++ radius: cornerRadius ++ color: Commons.Color.notifications.background ++ borderSpec: cardBorderSpec ++ clip: true ++ ++ // The swipe moves the card sideways and fades it as it goes. ++ transform: Translate { x: root.swipeOffset } ++ opacity: 1 - 0.6 * Math.min(1, Math.abs(root.swipeOffset) / Math.max(1, root.width)) ++ ++ // A mouse or stylus resting on the card pauses its countdown. A finger ++ // doesn't hover, so touch is left out: a toast that was touched must not ++ // count as hovered and stop expiring. ++ HoverHandler { ++ id: hoverTracker ++ acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad | PointerDevice.Stylus ++ } ++ ++ MouseArea { ++ anchors.fill: parent ++ cursorShape: Qt.PointingHandCursor ++ acceptedButtons: Qt.LeftButton | Qt.RightButton ++ onClicked: function(mouse) { ++ if (mouse.button === Qt.RightButton) { ++ root.closeRequested() ++ } else if (!root.replying) { ++ // A tap beside the open reply field must not open the app and ++ // throw the reply away. ++ root.cardClicked() ++ } ++ } ++ } ++ ++ // Swipe to dismiss. Only sideways movement past the threshold starts it, ++ // so a tap still runs the default action and a right-click still closes. ++ // Off while a reply is being typed, so selecting text can't throw the ++ // reply away. ++ DragHandler { ++ id: swipeHandler ++ target: null ++ yAxis.enabled: false ++ dragThreshold: Style.space(12) ++ enabled: root.swipeEnabled && !root.replying && !root.dismissing ++ onActiveChanged: { ++ if (active) { ++ swipeAnimation.stop() ++ root.swipeVelocity = 0 ++ } else { ++ root.finishSwipe() ++ } ++ } ++ onActiveTranslationChanged: { ++ if (!active) return ++ root.swipeOffset = activeTranslation.x ++ root.swipeVelocity = centroid.velocity.x ++ } ++ } ++ ++ SequentialAnimation { ++ id: swipeAnimation ++ property real to: 0 ++ property bool dismiss: false ++ NumberAnimation { ++ target: root ++ property: "swipeOffset" ++ to: swipeAnimation.to ++ duration: swipeAnimation.dismiss ? 140 : 200 ++ easing.type: swipeAnimation.dismiss ? Easing.InQuad : Easing.OutBack ++ } ++ ScriptAction { ++ script: { ++ if (!swipeAnimation.dismiss) return ++ root.closeRequested() ++ // A container that keeps the card (nothing removes it) gets it back. ++ swipeResetTimer.restart() ++ } ++ } ++ } ++ ++ Timer { ++ id: swipeResetTimer ++ interval: 400 ++ onTriggered: { ++ root.dismissing = false ++ root.swipeOffset = 0 ++ } ++ } ++ ++ ColumnLayout { ++ id: mainColumn ++ // Inset by the card border so the content doesn't paint over the card's ++ // outer border. ++ anchors.top: parent.top ++ anchors.left: parent.left ++ anchors.right: parent.right ++ anchors.topMargin: root.borderTop ++ anchors.leftMargin: root.borderLeft ++ anchors.rightMargin: root.borderRight ++ spacing: 0 ++ ++ // Text content. ++ RowLayout { ++ Layout.fillWidth: true ++ Layout.leftMargin: Style.space(12) ++ // Text stays clear of the close button's touch target. ++ Layout.rightMargin: root.closeButtonShown ? closeButton.width : Style.space(12) ++ Layout.topMargin: root.singleLineToast ? Style.space(7) : Style.space(10) ++ Layout.bottomMargin: root.singleLineToast ? Style.space(7) : Style.space(10) ++ spacing: root.collapseRedundantIcon ? 0 : (root.compactGlyph ? Style.space(8) : Style.space(12)) ++ ++ Item { ++ id: smallIconSlot ++ Layout.preferredWidth: visible ? Style.space(40) : 0 ++ Layout.preferredHeight: visible ? Style.space(40) : 0 ++ Layout.alignment: Qt.AlignVCenter ++ // Hide the slot when the icon failed to resolve (themed-icon name ++ // not in the user's icon theme) AND we don't have a glyph fallback ++ // — prevents rendering Qt's pink broken-image placeholder. ++ visible: !root.collapseRedundantIcon && !root.compactGlyph && (root.hasSmallIcon || root.hasGlyph) && (root.hasGlyph || smallIconImage.status !== Image.Error) ++ ++ Image { ++ id: smallIconImage ++ anchors.fill: parent ++ source: root.smallIconSource ++ sourceSize.width: smallIconSlot.width * Screen.devicePixelRatio ++ sourceSize.height: smallIconSlot.height * Screen.devicePixelRatio ++ fillMode: Image.PreserveAspectFit ++ asynchronous: true ++ smooth: true ++ visible: !root.hasGlyph || smallIconImage.status === Image.Ready ++ } ++ ++ // Glyph fallback (Nerd Font character) when no image icon is ++ // available. Used by omarchy-notification-send's `-g` flag. ++ Text { ++ textFormat: Text.PlainText ++ anchors.centerIn: parent ++ visible: root.hasGlyph && smallIconImage.status !== Image.Ready ++ text: root.glyph ++ color: Commons.Color.notifications.text ++ font.family: root.fontFamily ++ font.pixelSize: Style.font.displayLarge ++ } ++ } ++ ++ Text { ++ textFormat: Text.PlainText ++ Layout.alignment: Qt.AlignVCenter ++ visible: root.compactGlyph ++ text: root.glyph ++ color: Commons.Color.notifications.text ++ font.family: root.fontFamily ++ font.pixelSize: Style.font.icon ++ } ++ ++ ColumnLayout { ++ Layout.fillWidth: true ++ Layout.alignment: Qt.AlignVCenter ++ spacing: Style.space(2) ++ ++ Text { ++ // The spec defines the summary as a single line of plain text, so ++ // AutoText could only ever promote a hostile string to rich text. ++ // The body below is StyledText on purpose — see Service.qml's ++ // bodyMarkupSupported — and is stripped in NotificationLogic. ++ textFormat: Text.PlainText ++ Layout.fillWidth: true ++ visible: root.summary.length > 0 ++ text: root.summary ++ font.family: "Liberation Sans" ++ color: Commons.Color.notifications.text ++ font.pixelSize: Style.font.title ++ font.bold: true ++ wrapMode: Text.WordWrap ++ elide: Text.ElideRight + maximumLineCount: root.summaryLines - } - - Text { -@@ -314,9 +319,19 @@ - font.pixelSize: Style.font.title - wrapMode: Text.WordWrap - elide: Text.ElideRight -- maximumLineCount: 3 ++ } ++ ++ Text { ++ Layout.fillWidth: true ++ Layout.topMargin: Style.space(2) ++ visible: root.sanitizedBody.length > 0 ++ text: root.styledBody ++ textFormat: Text.StyledText ++ font.family: "Liberation Sans" ++ color: root.bodyColor ++ font.pixelSize: Style.font.title ++ wrapMode: Text.WordWrap ++ elide: Text.ElideRight + maximumLineCount: root.bodyLines - } - } ++ } ++ } + + Text { + textFormat: Text.PlainText @@ -1053,6 +1828,89 @@ diff --git i/shell/plugins/notifications/components/NotificationCard.qml w/shell + font.family: root.fontFamily + font.pixelSize: Style.font.bodySmall + } - } - - // Reply, then a field with Send and Cancel, each tall enough to tap on ++ } ++ ++ // Reply, then a field with Send and Cancel, each tall enough to tap on ++ // a touch screen. ++ RowLayout { ++ id: replyRow ++ readonly property real controlHeight: Style.space(40) ++ Layout.fillWidth: true ++ Layout.leftMargin: Style.space(12) ++ Layout.rightMargin: Style.space(12) ++ Layout.bottomMargin: Style.space(10) ++ visible: root.replyPlaceholder.length > 0 ++ spacing: Style.space(8) ++ ++ TextField { ++ id: replyField ++ objectName: "notificationReplyField" ++ Layout.fillWidth: true ++ visible: root.replying ++ Layout.preferredHeight: replyRow.controlHeight ++ placeholderText: root.replyPlaceholder ++ foreground: Commons.Color.notifications.text ++ onAccepted: root.sendReply() ++ Keys.onEscapePressed: root.replyCancelled() ++ } ++ ++ Item { ++ Layout.fillWidth: true ++ visible: !root.replying ++ } ++ ++ Button { ++ visible: root.replying ++ text: "Cancel" ++ Layout.preferredHeight: replyRow.controlHeight ++ foreground: Commons.Color.notifications.text ++ onClicked: root.replyCancelled() ++ } ++ ++ Button { ++ objectName: "notificationReplyButton" ++ Layout.preferredHeight: replyRow.controlHeight ++ text: root.replying ? "Send" : "Reply" ++ bordered: true ++ foreground: Commons.Color.notifications.text ++ onClicked: root.replying ? root.sendReply() : root.replyRequested() ++ } ++ } ++ } ++ ++ // Close button: a small glyph with a 44 px touch target in the top-right ++ // corner, inside the border. ++ MouseArea { ++ id: closeButton ++ objectName: "notificationCloseButton" ++ visible: root.closeButtonShown ++ anchors.top: parent.top ++ anchors.right: parent.right ++ anchors.topMargin: root.borderTop ++ anchors.rightMargin: root.borderRight ++ width: Style.space(44) ++ height: Style.space(44) ++ cursorShape: Qt.PointingHandCursor ++ Accessible.role: Accessible.Button ++ Accessible.name: "Dismiss notification" ++ onClicked: root.closeRequested() ++ ++ Rectangle { ++ anchors.centerIn: parent ++ width: Style.space(28) ++ height: width ++ radius: width / 2 ++ color: Commons.Color.notifications.text ++ opacity: closeButton.pressed ? 0.18 : 0 ++ } ++ ++ Text { ++ textFormat: Text.PlainText ++ anchors.centerIn: parent ++ text: "󰅖" ++ color: root.dimColor ++ font.family: root.fontFamily ++ font.pixelSize: Style.font.icon ++ } ++ } ++} diff --git a/packages/omamobile-omarchy/patches/0024-app-icons-keep-the-largest-size.patch b/packages/omamobile-omarchy/patches/0024-app-icons-keep-the-largest-size.patch index f8ad213c4..4766d1be4 100644 --- a/packages/omamobile-omarchy/patches/0024-app-icons-keep-the-largest-size.patch +++ b/packages/omamobile-omarchy/patches/0024-app-icons-keep-the-largest-size.patch @@ -5,10 +5,13 @@ # screen at 64 logical (192 physical) pixels. An SVG or a "scalable" path # still wins over any size; then the larger NxN directory (@Nx scaled). # Candidate for upstream Omarchy. +# +# Omarchy4.5: retain largest appicon choice. + diff --git i/shell/services/AppLibrary.qml w/shell/services/AppLibrary.qml --- i/shell/services/AppLibrary.qml +++ w/shell/services/AppLibrary.qml -@@ -136,6 +136,17 @@ +@@ -151,6 +151,17 @@ ].join(' ') } @@ -26,7 +29,7 @@ diff --git i/shell/services/AppLibrary.qml w/shell/services/AppLibrary.qml function indexIconLine(path) { var value = String(path || "").trim() if (value.length === 0) return -@@ -143,7 +154,9 @@ +@@ -158,7 +169,9 @@ var file = slash >= 0 ? value.slice(slash + 1) : value var dot = file.lastIndexOf(".") var name = dot > 0 ? file.slice(0, dot) : file diff --git a/packages/omamobile-omarchy/patches/0025-launch-no-toast-for-shell-surfaces.patch b/packages/omamobile-omarchy/patches/0025-launch-no-toast-for-shell-surfaces.patch index faabb29e4..28fa26b30 100644 --- a/packages/omamobile-omarchy/patches/0025-launch-no-toast-for-shell-surfaces.patch +++ b/packages/omamobile-omarchy/patches/0025-launch-no-toast-for-shell-surfaces.patch @@ -1,19 +1,13 @@ -# App launch: no "Launching ..." toast for a desktop entry that runs -# omarchy-shell. Such an entry opens a shell surface (on the phone the -# Updates entry summons the update sheet), never a toplevel, so the toast -# waited for a window that never came and sat over the sheet's buttons -# until its timeout. Every other launch keeps the toast. Candidate for -# upstream Omarchy. +# SPDX-License-Identifier: MIT +# No launch toast for shellsurfaces, retaining4.5terminalapp launchrouting. + diff --git i/shell/services/AppLibrary.qml w/shell/services/AppLibrary.qml --- i/shell/services/AppLibrary.qml +++ w/shell/services/AppLibrary.qml -@@ -74,10 +74,19 @@ +@@ -74,10 +74,16 @@ if (!iconIndexScan.running) iconIndexScan.running = true } -+ // An entry that runs omarchy-shell opens a shell surface (a panel or a -+ // sheet), never a window, so the launch toast would wait for a toplevel -+ // that doesn't come and cover the surface until it times out. + function launchesShellSurface(id) { + var entry = DesktopEntries.byId(id) + var command = entry && entry.command ? entry.command : [] @@ -25,6 +19,6 @@ diff --git i/shell/services/AppLibrary.qml w/shell/services/AppLibrary.qml if (!id) return - root.beginLaunchFeedback(name) + if (!root.launchesShellSurface(id)) root.beginLaunchFeedback(name) - // Start gtk-launch inside a scope under app-graphical.slice so apps do not - // inherit wayland-wm@.service. Keeping gtk-launch as the desktop-entry - // resolver supports IDs with spaces and entries that UWSM rejects. + // A terminal app goes through Omarchy's TUI launcher, which names its + // terminal window after the command (org.omarchy.nvim), so the dock and + // titlebars can tell Neovim from the terminal it runs in. diff --git a/packages/omamobile-omarchy/patches/0026-lock-battery-status.patch b/packages/omamobile-omarchy/patches/0026-lock-battery-status.patch index daae350e2..ae6ccbc07 100644 --- a/packages/omamobile-omarchy/patches/0026-lock-battery-status.patch +++ b/packages/omamobile-omarchy/patches/0026-lock-battery-status.patch @@ -23,6 +23,9 @@ # goes dark so a wake never paints a stale one before its own reading. # # Against Omarchy 4.0.6 (edge 4.0.6-1), after 0003, 0009, 0011, 0014, 0023. +# +# Omarchy4.5: bounded local battery status. + diff --git i/shell/plugins/lock/LockBattery.js w/shell/plugins/lock/LockBattery.js new file mode 100644 --- /dev/null @@ -219,7 +222,7 @@ new file mode 100644 diff --git i/shell/plugins/lock/LockView.qml w/shell/plugins/lock/LockView.qml --- i/shell/plugins/lock/LockView.qml +++ w/shell/plugins/lock/LockView.qml -@@ -437,5 +437,16 @@ Item { +@@ -497,5 +497,16 @@ lock: root pinTop: root.keypadClearsSensor ? keypadHint.y : inputField.y } diff --git a/packages/omamobile-omarchy/patches/0027-lock-media-controls.patch b/packages/omamobile-omarchy/patches/0027-lock-media-controls.patch index 44f47da71..1fffd007c 100644 --- a/packages/omamobile-omarchy/patches/0027-lock-media-controls.patch +++ b/packages/omamobile-omarchy/patches/0027-lock-media-controls.patch @@ -28,6 +28,9 @@ # while it is dark. On a computer (keypad off) nothing shows. # # Against Omarchy 4.0.6 (edge 4.0.6-1), after 0023 and 0026. +# +# Omarchy4.5: local transport-only media controls. + diff --git i/shell/plugins/lock/LockGlance.qml w/shell/plugins/lock/LockGlance.qml --- i/shell/plugins/lock/LockGlance.qml +++ w/shell/plugins/lock/LockGlance.qml diff --git a/packages/omamobile-omarchy/patches/0028-show-logo-a-stacked-logo-for-a-narrow-terminal.patch b/packages/omamobile-omarchy/patches/0028-show-logo-a-stacked-logo-for-a-narrow-terminal.patch index 00119b92d..4038f483c 100644 --- a/packages/omamobile-omarchy/patches/0028-show-logo-a-stacked-logo-for-a-narrow-terminal.patch +++ b/packages/omamobile-omarchy/patches/0028-show-logo-a-stacked-logo-for-a-narrow-terminal.patch @@ -11,6 +11,9 @@ # for upstream Omarchy. # # Against Omarchy 4.0.6 (4.0.6-1). +# +# Omarchy4.5: mobile narrowterminal logo sizing. + diff --git i/bin/omarchy-show-logo w/bin/omarchy-show-logo --- i/bin/omarchy-show-logo +++ w/bin/omarchy-show-logo diff --git a/packages/omamobile-omarchy/test/all b/packages/omamobile-omarchy/test/all index dbd0f43c8..c60132d95 100755 --- a/packages/omamobile-omarchy/test/all +++ b/packages/omamobile-omarchy/test/all @@ -77,7 +77,10 @@ python3 -B test/patches.py || fail "re-patch tool" pkg=${OMARCHY_PKG:-$(ls ~/.cache/omamobile-rootfs/pkg/omarchy-[0-9]*-aarch64.pkg.tar.* 2>/dev/null | grep -v '\.sig$' | sort | tail -1 || true)} if [[ -n $pkg ]] && command -v bsdtar >/dev/null; then mkdir -p "$t/omarchy-pkg" - bsdtar -xf "$pkg" -C "$t/omarchy-pkg" usr/bin/omarchy-apply-lock usr/share/omarchy/bin/omarchy-system-sleep-lock + bsdtar -xf "$pkg" -C "$t/omarchy-pkg" usr/bin/omarchy-apply-lock usr/bin/omarchy-system-sleep-lock + # The packaged source alias is absolute /usr/bin. Normalize this one test + # input inside the fake root; never follow it into the host's installed tree. + install -Dm755 "$t/omarchy-pkg/usr/bin/omarchy-system-sleep-lock" "$t/omarchy-pkg/usr/share/omarchy/bin/omarchy-system-sleep-lock" OMARCHY_PKG_ROOT=$t/omarchy-pkg bash test/lock-pam.sh || fail "lock-pam" # Patch 0021 run against the real sleep lock, with fakes. OMARCHY_PKG_ROOT=$t/omarchy-pkg bash test/sleep-lock.sh || fail "sleep-lock" @@ -90,6 +93,7 @@ fi || fail "install and upgrade write the lock's PAM file" pass "install and upgrade write the lock's PAM file when it is missing" bash test/update.sh || fail "omamobile-update" +python3 -I test/migration-mobile-holds.py || fail "mobile migration holds" # Patch 0015 end to end (inline reply on a private bus), in the OWL # conformance container, when asked: OMAMOBILE_NOTIFY_TEST=1. @@ -101,4 +105,4 @@ if [[ -n ${OMAMOBILE_NOTIFY_TEST:-} ]]; then pass "inline reply end to end" fi -python3 -I test/migration-mobile-holds.py || fail "mobile-critical migration holds" +python3 -I test/source-family.py || fail "source-family selection" diff --git a/packages/omamobile-omarchy/test/lock-glance b/packages/omamobile-omarchy/test/lock-glance index e44a7b19f..13e2a1091 100755 --- a/packages/omamobile-omarchy/test/lock-glance +++ b/packages/omamobile-omarchy/test/lock-glance @@ -18,11 +18,25 @@ trap 'rm -rf "$work"' EXIT mkdir -p "$work/qs" "$work/plugins" "$work/home/.local/state/omarchy/toggles" \ "$work/home/.local/state/omamobile" "$work/home/.config/omarchy" cp -r "$shell/Commons" "$shell/Ui" "$work/qs/" +mkdir -p "$work/home/omarchy/default" +[[ ! -d $shell/../default/i18n ]] || cp -r "$shell/../default/i18n" "$work/home/omarchy/default/" cp -r "$shell/plugins/lock" "$shell/plugins/notifications" "$work/plugins/" +if [[ -n ${PRIVATE_LOCK_DIR:-} ]]; then + for f in Service.qml LockView.qml LockGlance.qml LockGlance.js Keypad.qml FingerprintModel.js LockBattery.qml LockBattery.js LockMedia.qml LockMedia.js LockMediaSource.qml NenajMatrix.qml; do + [[ ! -f $PRIVATE_LOCK_DIR/$f ]] || cp "$PRIVATE_LOCK_DIR/$f" "$work/plugins/lock/$f" + done + # Resolve production absolute imports to the SAME candidate components in + # this fixture only; never fall through to this machine's installed shell. + sed -i 's|file:///usr/share/omarchy/shell/plugins/notifications/components|../notifications/components|g' "$work/plugins/lock/LockGlance.qml" + sed -i 's|file:///usr/share/omarchy/shell/plugins/notifications/NotificationLogic.js|../notifications/NotificationLogic.js|g' "$work/plugins/lock/LockGlance.js" +fi # Omarchy's media service's model, which the lock's media controls (0027) use. mkdir -p "$work/plugins/services" cp -r "$shell/plugins/services/media" "$work/plugins/services/" cp "$here/lock-glance.qml" "$work/tst_lock_glance.qml" +if ! grep -q "notifications/quiet.json" "$shell/plugins/lock/LockGlance.qml"; then + sed -i "s|notifications/quiet.json|notifications.json|g" "$work/tst_lock_glance.qml" +fi printf '.pragma library\nvar HOME = "%s"\n' "$work/home" > "$work/TestEnv.js" export QT_QPA_PLATFORM=offscreen QT_QUICK_BACKEND=software QML_DISABLE_DISK_CACHE=1 diff --git a/packages/omamobile-omarchy/test/lock-glance.qml b/packages/omamobile-omarchy/test/lock-glance.qml index 12684747e..683da3245 100644 --- a/packages/omamobile-omarchy/test/lock-glance.qml +++ b/packages/omamobile-omarchy/test/lock-glance.qml @@ -166,7 +166,7 @@ Item { harness.supplies = "Battery\t1\t87\tDischarging\t\nUSB\t\t\tCharging\t1\n" harness.suppliesHang = false Mpris.players.values = [] - Quickshell.vars = { HOME: harness.home } + Quickshell.vars = { HOME: harness.home, OMARCHY_PATH: harness.home + "/omarchy" } Quickshell.started = [] Quickshell.responder = function(argv) { var cmd = argv.join(" ") @@ -184,7 +184,7 @@ Item { return cmd.indexOf("/.local/state/omarchy/notifications/") >= 0 ? harness.notificationsRaw : null } writeFile(".local/state/omarchy/toggles/lock-hide-notification-text", "") - writeFile(".local/state/omarchy/notifications.json", "") + writeFile(".local/state/omarchy/notifications/quiet.json", "") writeFile(".local/state/omamobile/weather.json", "") writeFile(".config/omarchy/shell.json", "") writeFile(".local/state/omarchy/toggles/credential-password", "") @@ -577,12 +577,12 @@ Item { entry("omarchy-action", 3 * minute, 2, "Theme changed", ""), entry("notify-send", 4 * minute, 3, "Ping", "") ].join("\n") + "\n" - writeFile(".local/state/omarchy/notifications.json", '{"version": 3, "dnd": true}\n') + writeFile(".local/state/omarchy/notifications/quiet.json", '{"version": 3, "dnd": true}\n') show() var cards = byName("lockGlanceCard").filter(function(c) { return c.visible }) compare(cards.length, 1) compare(cards[0].summary, "Theme changed") - writeFile(".local/state/omarchy/notifications.json", '{"version": 3, "dnd": false}\n') + writeFile(".local/state/omarchy/notifications/quiet.json", '{"version": 3, "dnd": false}\n') settle() compare(byName("lockGlanceCard").filter(function(c) { return c.visible }).length, 3) compare(glance().cards[2].app, "Notifications", "a bare notify-send goes by Notifications") diff --git a/packages/omamobile-omarchy/test/mobile-pam-preserve.py b/packages/omamobile-omarchy/test/mobile-pam-preserve.py new file mode 100644 index 000000000..80596d733 --- /dev/null +++ b/packages/omamobile-omarchy/test/mobile-pam-preserve.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Execute the actual mobile PAM-preservation branch on isolated fake paths. +Only root-UID metadata is stubbed; real modes/symlink tests and file hashes apply. +No PAM, service or privilege helper is ever invoked. +""" +import hashlib +import os +from pathlib import Path +import subprocess +import sys +import tempfile + +source=Path(sys.argv[1]).read_text() +start=source.index('# Mobile owns its existing PAM policy') +end=source.index('echo "Configuring lock screen password authentication..."',start) +guard=source[start:end] +with tempfile.TemporaryDirectory() as d: + root=Path(d);helper=root/'mobile-update';helper.write_text('#!/bin/sh\nexit 0\n');helper.chmod(0o755) + policy=root/'password';policy.write_text('synthetic customized password PAM\n');policy.chmod(0o644) + fp=root/'fingerprint';fp.write_text('synthetic fingerprint max-tries=1\n');fp.chmod(0o644) + baseline=[hashlib.sha256(p.read_bytes()).hexdigest() for p in (policy,fp)] + script='set -eu\nstat() { echo "$FAKE_UID"; }\n'+guard.replace('/usr/bin/omamobile-update',str(helper)).replace('/etc/pam.d/omarchy-lock-password',str(policy))+'\nexit 77\n' + def run(uid='0'): + env=dict(os.environ);env['FAKE_UID']=uid + return subprocess.run(['bash','-c',script],env=env,capture_output=True,text=True) + assert run().returncode==0 + assert [hashlib.sha256(p.read_bytes()).hexdigest() for p in (policy,fp)]==baseline + assert run('1000').returncode==1 + policy.chmod(0o666);assert run().returncode==1;policy.chmod(0o644) + original=root/'saved';policy.rename(original);policy.symlink_to(original) + assert run().returncode==1 + policy.unlink();assert run().returncode==77,'fresh setup may continue when no prior password policy exists' +print('PASS actual PAM preservation branch: secure policy unchanged; wrong owner/writable/symlink refused; absent policy permits initial setup; no privileged commands') diff --git a/packages/omamobile-omarchy/test/notification-store45.cjs b/packages/omamobile-omarchy/test/notification-store45.cjs new file mode 100644 index 000000000..53f1fbb60 --- /dev/null +++ b/packages/omamobile-omarchy/test/notification-store45.cjs @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MIT +const fs=require('fs'),vm=require('vm'),assert=require('assert/strict'),path=require('path'); +const root=process.argv[2];assert(root,'usage: node notification-store45.cjs SHELL'); +function load(p,extras={}) {const x={module:{exports:{}},...extras};vm.createContext(x);vm.runInContext(fs.readFileSync(p,'utf8').replace(/^\.(?:pragma|import).*$/mg,''),x);return x;} +const logic=load(path.join(root,'plugins/notifications/NotificationLogic.js')).module.exports; +const glance=load(path.join(root,'plugins/lock/LockGlance.js'),{NotificationLogic:logic,Date}); +const now=Date.now(),n={key:'nSynthetic1',ts:now/1000,originalId:1,app:'Fixture',summary:'Synthetic summary',body:'Synthetic body',image:'file:///tmp/synthetic.png',urgency:1}; +const raw=JSON.stringify([n])+ '\n'+JSON.stringify([{...n,summary:'older copy',ts:n.ts-1},{...n,key:'nSynthetic2',originalId:2,ts:n.ts-2}])+'\n'+JSON.stringify({dnd:false}); +const rows=logic.historyRows(raw,[],1,10);assert.equal(rows.length,2);assert.equal(rows[0].key,'nSynthetic1');assert.equal(rows[0].timestamp,now);assert.equal(logic.popupFileName(rows[0]),'nSynthetic1');assert.equal(rows[0].summary,n.summary); +assert.equal(glance.cards(raw,now,false,false).length,2); +const hidden=glance.cards(raw,now,true,false)[0];assert.equal(hidden.summary,'Fixture');assert.equal(hidden.body,'Unlock to read');assert.equal(hidden.image,'');assert.equal(hidden.file,'nSynthetic1'); +assert.equal(glance.cards(raw,now,false,true).length,0);assert.equal(glance.doNotDisturb('{"dnd":true}'),true); +assert.equal(logic.historyRows(JSON.stringify([{...n,key:'../bad'}]),[],1,10).length,0); +assert.equal(logic.historyRows(JSON.stringify([{...n,ts:'bad'}]),[],1,10).length,0); +assert.equal(logic.historyRows('{"dnd":true}\n',[],1,10).length,0); +const old={originalId:8,timestamp:now,app:'Fixture',summary:'Legacy synthetic'};const oldrow=logic.historyRows(JSON.stringify(old)+'\n',[],1,10)[0];assert.equal(logic.popupFileName(oldrow),String(now)+'-8.json'); +console.log('PASS4.5store->legacyglance: keyed live/history merge, dedupe, timestamp, privacy/DND, malformed rows; oldrecord compatibility'); diff --git a/packages/omamobile-omarchy/test/patches.py b/packages/omamobile-omarchy/test/patches.py index 6e49f4349..185991905 100755 --- a/packages/omamobile-omarchy/test/patches.py +++ b/packages/omamobile-omarchy/test/patches.py @@ -321,6 +321,7 @@ def real_package(t): subprocess.run(["bsdtar", "-xf", pkg, "-C", ex], check=True) info = dict(l.split(" = ", 1) for l in open(os.path.join(ex, ".PKGINFO")).read().splitlines() if " = " in l) version = info["pkgver"] + selected_series = os.path.join(PKG, "legacy-4.0.6") if version.startswith("4.0.6-") else SERIES def make_root(name, mtree_from): root = os.path.join(t, name) @@ -334,11 +335,16 @@ def make_root(name, mtree_from): shutil.copy(mtree_from, os.path.join(entry, "mtree")) return root, entry + if version.startswith("4.5.0-"): + import port45 + port45.actual(t, ex, version, make_root, run, ok, read, selected_series, PKG, qml_parse) + return + root, _ = make_root("real", os.path.join(ex, ".MTREE")) - rc, out = run(root, "apply", series=SERIES) + rc, out = run(root, "apply", series=selected_series) ok(rc == 0, "real omarchy %s: the shipped series applies (%s)" % (version, out.strip().splitlines()[-1])) status = json.load(open(os.path.join(root, STATE, "status.json"))) - ok(not status["upstream"] and len(status["applied"]) == len(glob.glob(os.path.join(SERIES, "*.patch"))), + ok(not status["upstream"] and len(status["applied"]) == len(glob.glob(os.path.join(selected_series, "*.patch"))), "real omarchy %s: every patch applied, none upstream" % version) ok("omamobile-update" in read(root, "usr/bin/omarchy-update"), "real omarchy: omarchy-update hands over (0012)") ok(os.path.isfile(os.path.join(root, "usr/share/omarchy/shell/plugins/lock/Keypad.qml")), "real omarchy: the lock's keypad is there (0003)") @@ -382,7 +388,7 @@ def make_root(name, mtree_from): ok("(event.key === Qt.Key_Backspace || event.key === Qt.Key_Left) && !root.filterText) {\n root.goBack()" in menu, "real omarchy: Backspace and Left still go back (0018)") ok("property bool cardSettled: false" in menu, "real omarchy: the menu-first-frame bridge applies after 0018") - qml_parse(root) + qml_parse(root, selected_series) lock_glance(root) lock_battery(t, root) lock_media(root) @@ -404,7 +410,7 @@ def make_root(name, mtree_from): notification_phrasing(t, os.path.join(root, "usr/bin/omarchy-notification-send"), os.path.join(ex, "usr/bin/omarchy-notification-send")) lock_fingerprint_probe(t, root) - rc, out = run(root, "apply", series=SERIES) + rc, out = run(root, "apply", series=selected_series) ok(rc == 0 and "already applied" in out, "real omarchy: already applied") rc, _ = run(root, "verify") ok(rc == 0, "real omarchy: verify") @@ -418,7 +424,7 @@ def touches_no_links(path): names = [l[6:].split("\t")[0].rstrip("\n") for l in open(path) if l.startswith("+++ w/")] return names and not any(os.path.islink(os.path.join(root2, "usr/share/omarchy", n)) for n in names) - patch0000 = next(p for p in sorted(glob.glob(os.path.join(SERIES, "*.patch"))) if touches_no_links(p)) + patch0000 = next(p for p in sorted(glob.glob(os.path.join(selected_series, "*.patch"))) if touches_no_links(p)) p = mod_patch(root2, patch0000) subprocess.run(["patch", "-s", "-p1", "-d", root2, "-i", p], check=True) lines = ["#mtree", "/set type=file uid=0 gid=0 mode=644"] @@ -432,14 +438,14 @@ def touches_no_links(path): lines.append("./%s sha256digest=%s" % (rel, sha(open(full, "rb").read()))) with gzip.open(os.path.join(entry, "mtree"), "wt") as f: f.write("\n".join(lines) + "\n") - rc, out = run(root2, "apply", series=SERIES) + rc, out = run(root2, "apply", series=selected_series) status = json.load(open(os.path.join(root2, STATE, "status.json"))) ok(rc == 0 and status["upstream"] == [os.path.basename(patch0000)], "real omarchy with %s upstream: skipped and reported, the rest applied" % os.path.basename(patch0000)) - ok(len(status["applied"]) == len(glob.glob(os.path.join(SERIES, "*.patch"))) - 1, "real omarchy with one patch upstream: the others apply on it") + ok(len(status["applied"]) == len(glob.glob(os.path.join(selected_series, "*.patch"))) - 1, "real omarchy with one patch upstream: the others apply on it") -def qml_parse(root): +def qml_parse(root, series=None): """Every QML file the series touches still parses, when qmlformat is at hand (it reports syntax errors without needing the shell's imports).""" tool = shutil.which("qmlformat") or ("/usr/lib/qt6/bin/qmlformat" if os.path.isfile("/usr/lib/qt6/bin/qmlformat") else "") @@ -447,7 +453,7 @@ def qml_parse(root): print("ok - real omarchy: the patched QML parses # SKIP no qmlformat") return files = set() - for p in glob.glob(os.path.join(SERIES, "*.patch")): + for p in glob.glob(os.path.join(series or SERIES, "*.patch")): for line in open(p): if line.startswith("+++ w/") and line.rstrip().endswith(".qml"): files.add(line[6:].rstrip()) diff --git a/packages/omamobile-omarchy/test/port45.py b/packages/omamobile-omarchy/test/port45.py new file mode 100644 index 000000000..ec8e27f04 --- /dev/null +++ b/packages/omamobile-omarchy/test/port45.py @@ -0,0 +1,56 @@ +# SPDX-License-Identifier: MIT +"""Actual4.5package rehearsal; hooks/scripts are never executed.""" +import glob +import json +import os +import shutil +import subprocess + + +def actual(t, ex, version, make_root, run, ok, read, series, package, parse_qml): + root, _ = make_root('real45', os.path.join(ex,'.MTREE')) + for folder in ('patches','legacy-4.0.6'): + shutil.copytree(os.path.join(package,folder),os.path.join(root,'usr/share/omamobile/omarchy',folder)) + private=os.path.join(root,'home/fixture/.local/share/omarchy/plugins/pixel.lock/Service.qml') + os.makedirs(os.path.dirname(private));open(private,'w').write('synthetic private policy sentinel\n') + auth='usr/share/omarchy/shell/services/AuthServiceStore.js' + auth_before=read(root,auth) + rc,out=run(root,'apply') # actual version-selected production default + ok(rc==0,'real4.5: version-selected shipped runtime series applies to signed aarch64 package') + if rc: print(out);return + state='var/lib/omamobile/omarchy-patches' + status=json.load(open(os.path.join(root,state,'status.json'))) + ok(len(status['applied'])==len(glob.glob(os.path.join(series,'*.patch'))) and not status['upstream'], 'real4.5: all shipped runtime patches applied, not a source-only test') + ok(status['series'].endswith('/patches'),'real4.5: selects4.5series rather than legacy') + ok(open(private).read()=='synthetic private policy sentinel\n','real4.5: private clone untouched') + ok('omamobile-update' in read(root,'usr/bin/omarchy-update'),'real4.5: packaged absolute bin symlink routes updater handoff correctly') + notif='usr/share/omarchy/shell/plugins/notifications/' + ok('inlineReplySupported: true' in read(root,notif+'Service.qml'),'real4.5: live-only reply server capability present') + ok('card.replyOpen' in read(root,notif+'Toast.qml') and 'PointerDevice.TouchScreen' in read(root,notif+'Toast.qml'),'real4.5: scene toast touch/reply controls present') + ok(os.path.isfile(os.path.join(root,notif+'components/NotificationCard.qml')) and os.path.isfile(os.path.join(root,notif+'NotificationLogic.js')),'real4.5: privateglance legacy presentational import/API restored') + lock='usr/share/omarchy/shell/plugins/lock/' + ok('notifications/quiet.json' in read(root,lock+'LockGlance.qml'),'real4.5: DND follows newquietstore') + ok('Preserving existing mobile lock PAM' in read(root,'usr/bin/omarchy-apply-lock'),'real4.5: setup preserves existingmobilePAM/recoveryhooks') + ok('OverlayWindow {' in read(root,'usr/share/omarchy/shell/plugins/menu/Menu.qml') and 'contentReady' in read(root,'usr/share/omarchy/shell/Ui/OverlayWindow.qml'),'real4.5: obsolete first-framebridge replaced by actualupstream geometry/scale guard') + parse_qml(root, series) + rc,out=run(root,'verify');ok(rc==0,'real4.5: verify patched package state') + rc,out=run(root,'apply');ok(rc==0 and 'already applied' in out,'real4.5: apply idempotent') + # The full adapted upstream actual-function fixture exercises4.5's store, + # private address/markup policy, live ownership, reply and forget semantics. + env=dict(os.environ);env['OMARCHY_SHELL_DIR']=os.path.join(root,'usr/share/omarchy/shell') + node=shutil.which('node');r=subprocess.run([node,os.path.join(package,'test/upstream45/notifications/logic.cjs')],env=env,capture_output=True,text=True) + ok(r.returncode==0,'real4.5: upstream+mobile actualnotificationfunctions pass against packagedpatched files') + if r.returncode:print(r.stdout+r.stderr) + r=subprocess.run([node,os.path.join(package,'test/notification-store45.cjs'),env['OMARCHY_SHELL_DIR']],capture_output=True,text=True) + ok(r.returncode==0,'real4.5: keyed stores feed legacyglance with privacy/malformedrow/oldrecord coverage') + if r.returncode:print(r.stdout+r.stderr) + # Refuse a user-changed public target, never overwrite it on another apply. + p=os.path.join(root,lock+'Service.qml');patched=open(p).read();open(p,'a').write('\n// synthetic external edit\n') + rc,out=run(root,'apply');ok(rc!=0 and open(p).read().endswith('// synthetic external edit\n'),'real4.5: external publiclock edits cause refusal, preserved') + open(p,'w').write(patched) + rc,out=run(root,'restore');ok(rc==0,'real4.5: restore original packagedfiles') + ok(read(root,auth)==auth_before and open(private).read()=='synthetic private policy sentinel\n','real4.5: restore leaves authstore and privateclone unchanged') + # Unknown future families must not borrow4.5/legacy patch contexts. + root2,db=make_root('real-unknown',os.path.join(ex,'.MTREE')) + d=os.path.join(db,'desc');s=open(d).read().replace(version,'4.6.0-1');open(d,'w').write(s) + rc,out=run(root2,'apply');ok(rc!=0 and 'no qualified mobile patch series' in out,'unknown Omarchy family refuses before patch writes') diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Hyprland/Hyprland.qml b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Hyprland/Hyprland.qml new file mode 100644 index 000000000..6a7947645 --- /dev/null +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Hyprland/Hyprland.qml @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +pragma Singleton +import QtQuick +QtObject { + property var monitors: ({ values: [] }) + property var focusedMonitor: null + signal rawEvent(var event) + function dispatch(command) {} + function monitorFor(screen) { return null } +} diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Hyprland/qmldir b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Hyprland/qmldir new file mode 100644 index 000000000..4c43ca833 --- /dev/null +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Hyprland/qmldir @@ -0,0 +1,2 @@ +module Quickshell.Hyprland +singleton Hyprland 1.0 Hyprland.qml diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/IpcHandler.qml b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/IpcHandler.qml new file mode 100644 index 000000000..bb0e081d0 --- /dev/null +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/IpcHandler.qml @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: MIT +import QtQuick +QtObject { + property string target: "" + property bool enabled: true + property bool connected: false +} diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/Process.qml b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/Process.qml index 2592f407a..fab7c1020 100644 --- a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/Process.qml +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/Process.qml @@ -6,6 +6,8 @@ import Quickshell // the test's responder answers the command, finishes with that output. QtObject { id: proc + property bool stdinEnabled: false + function write(value) {} property var command: [] property bool running: false property var stdout: null diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/SplitParser.qml b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/SplitParser.qml new file mode 100644 index 000000000..9129028d3 --- /dev/null +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/SplitParser.qml @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +import QtQuick +QtObject { + property string text: "" + property string splitMarker: "\n" + signal read(string data) + signal streamFinished() +} diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/qmldir b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/qmldir index 3a532e8e6..0ea290560 100644 --- a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/qmldir +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Io/qmldir @@ -2,3 +2,6 @@ module Quickshell.Io Process 1.0 Process.qml StdioCollector 1.0 StdioCollector.qml FileView 1.0 FileView.qml + +SplitParser 1.0 SplitParser.qml +IpcHandler 1.0 IpcHandler.qml diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Services/Pipewire/Pipewire.qml b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Services/Pipewire/Pipewire.qml new file mode 100644 index 000000000..1e9491f10 --- /dev/null +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Services/Pipewire/Pipewire.qml @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma Singleton +import QtQuick +QtObject { + property var defaultAudioSource: null + property var defaultAudioSink: null + property var nodes: ({values: []}) +} diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Services/Pipewire/qmldir b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Services/Pipewire/qmldir new file mode 100644 index 000000000..e1875d0dd --- /dev/null +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Services/Pipewire/qmldir @@ -0,0 +1,2 @@ +module Quickshell.Services.Pipewire +singleton Pipewire 1.0 Pipewire.qml diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Singleton.qml b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Singleton.qml new file mode 100644 index 000000000..f56839815 --- /dev/null +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/Singleton.qml @@ -0,0 +1,3 @@ +// SPDX-License-Identifier: MIT +import QtQuick +Item {} diff --git a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/qmldir b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/qmldir index d4cee017a..a34f15a09 100644 --- a/packages/omamobile-omarchy/test/qml-stubs/Quickshell/qmldir +++ b/packages/omamobile-omarchy/test/qml-stubs/Quickshell/qmldir @@ -2,3 +2,5 @@ module Quickshell singleton Quickshell 1.0 Quickshell.qml SystemClock 1.0 SystemClock.qml singleton DesktopEntries 1.0 DesktopEntries.qml + +Singleton 1.0 Singleton.qml diff --git a/packages/omamobile-omarchy/test/source-family.py b/packages/omamobile-omarchy/test/source-family.py new file mode 100644 index 000000000..6d9486cc0 --- /dev/null +++ b/packages/omamobile-omarchy/test/source-family.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Exercise actual family selector and prove the archived legacy bytes.""" +from pathlib import Path +import runpy +pkg=Path(__file__).resolve().parent.parent +m=runpy.run_path(str(pkg/'bin/omamobile-omarchy-patches')) +select=m['default_series'] +assert select('/fixture',[('omarchy','4.0.6-2',None)]).endswith('/legacy-4.0.6') +assert select('/fixture',[('omarchy','4.5.0-3',None)]).endswith('/patches') +for version in ['4.6.0-1']: + try:select('/fixture',[('omarchy',version,None)]) + except m['Failure']:pass + else:raise AssertionError('unsupported family accepted: '+version) +assert len(list((pkg/'legacy-4.0.6').glob('*.patch')))==28 +print('PASS: actual selector rejects unimplemented families; legacy archive retained') diff --git a/packages/omamobile-omarchy/test/upstream45/migrations/1789764927.sh b/packages/omamobile-omarchy/test/upstream45/migrations/1789764927.sh new file mode 100644 index 000000000..e2d1541e4 --- /dev/null +++ b/packages/omamobile-omarchy/test/upstream45/migrations/1789764927.sh @@ -0,0 +1,17 @@ +echo "Enable OWE desktop video backgrounds and lock feed" + +omarchy-pkg-add owe owe-lockfeed +omarchy-hook-install theme-set /usr/share/owe/10-owe-sync + +systemctl --user daemon-reload >/dev/null 2>&1 || true +if ! systemctl --user enable owed.service; then + wants_dir="$HOME/.config/systemd/user/graphical-session.target.wants" + mkdir -p "$wants_dir" + ln -sfn /usr/lib/systemd/user/owed.service "$wants_dir/owed.service" +fi + +# A TTY update enables the next graphical login without starting a renderer +# against a missing Wayland session. A failed live start leaves this pending. +if [[ ${OMARCHY_UPGRADE_TO_QUATTRO_LIVE:-0} != 1 ]] && systemctl --user is-active --quiet graphical-session.target; then + systemctl --user start owed.service +fi diff --git a/packages/omamobile-omarchy/test/upstream45/migrations/1791125650.sh b/packages/omamobile-omarchy/test/upstream45/migrations/1791125650.sh new file mode 100644 index 000000000..d34bbd0a9 --- /dev/null +++ b/packages/omamobile-omarchy/test/upstream45/migrations/1791125650.sh @@ -0,0 +1,28 @@ +echo "Install the fingerprint resume hook on existing fingerprint setups" + +# Existing enrolled machines never rerun setup. Install only missing files +# so administrator changes survive an upgrade. + +hook_src="${OMARCHY_FPRINTD_RESUME_SRC:-$OMARCHY_PATH/default/systemd/system-sleep/fprintd-resume}" +hook_dst="${OMARCHY_FPRINTD_RESUME_DST:-/usr/lib/systemd/system-sleep/fprintd-resume}" +stop_timeout_src="${OMARCHY_FPRINTD_STOP_TIMEOUT_SRC:-$OMARCHY_PATH/default/systemd/system/fprintd.service.d/10-stop-timeout.conf}" +stop_timeout_dst="${OMARCHY_FPRINTD_STOP_TIMEOUT_DST:-/etc/systemd/system/fprintd.service.d/10-stop-timeout.conf}" +lock_pam="${OMARCHY_LOCK_FINGERPRINT_PAM:-/etc/pam.d/omarchy-lock-fingerprint}" + +[[ -f $lock_pam ]] || exit 0 + +if [[ -f $hook_src && ! -e $hook_dst ]]; then + echo "Installing the fprintd resume hook" + sudo install -Dm755 "$hook_src" "$hook_dst" +fi + +if [[ -f $stop_timeout_src && ! -e $stop_timeout_dst ]]; then + sudo install -Dm644 "$stop_timeout_src" "$stop_timeout_dst" +fi + +if [[ -f $stop_timeout_dst ]]; then + reload_needed=$(systemctl show fprintd.service --property=NeedDaemonReload --value) + if [[ $reload_needed == "yes" ]]; then + sudo systemctl daemon-reload + fi +fi diff --git a/packages/omamobile-omarchy/test/upstream45/migrations/1791367434.sh b/packages/omamobile-omarchy/test/upstream45/migrations/1791367434.sh new file mode 100644 index 000000000..84b5c2557 --- /dev/null +++ b/packages/omamobile-omarchy/test/upstream45/migrations/1791367434.sh @@ -0,0 +1,4 @@ +echo "Configure shared input-method defaults and free desktop shortcuts" + +omarchy-pkg-add fcitx5-mozc fcitx5-hangul fcitx5-chinese-addons fcitx5-chewing +omarchy-input-method configure --defaults diff --git a/packages/omamobile-omarchy/test/upstream45/migrations/1792648436.sh b/packages/omamobile-omarchy/test/upstream45/migrations/1792648436.sh new file mode 100644 index 000000000..515df9433 --- /dev/null +++ b/packages/omamobile-omarchy/test/upstream45/migrations/1792648436.sh @@ -0,0 +1,21 @@ +echo "Remove the files the 4.0 notification engine left behind" + +# They hold old message content: its per-popup files, history and images. +# rm and find never follow a symlink they are given. +dir="$HOME/.local/state/omarchy/notifications" +legacy="$HOME/.local/state/omarchy/notifications.json" + +# 4.0 kept Do Not Disturb on its own. It carries over unless the shell has +# already written quiet state of its own. +if [[ -f $legacy && ! -s $dir/quiet.json ]] && jq -e '.dnd == true' "$legacy" >/dev/null 2>&1; then + mkdir -p "$dir" + chmod 700 "$dir" + rm -f "$dir/quiet.json" + (umask 077 && printf '%s\n' '{"snoozes":{},"dnd":true,"silencedSince":0,"codesBypassQuiet":true}' >"$dir/quiet.json") +fi +rm -f "$legacy" + +rm -rf "$dir/history" "$dir/images" +if [[ -d $dir ]]; then + find "$dir/" -maxdepth 1 -type f -regex '.*/[0-9]+-[^/]+\.json' -delete +fi diff --git a/packages/omamobile-omarchy/test/upstream45/migrations/README.md b/packages/omamobile-omarchy/test/upstream45/migrations/README.md new file mode 100644 index 000000000..3f13d7b34 --- /dev/null +++ b/packages/omamobile-omarchy/test/upstream45/migrations/README.md @@ -0,0 +1,8 @@ + +# Inert Omarchy 4.5 migration inputs + +Exact MIT-licensed files from the verified Omarchy 4.5 source/package snapshot: +https://github.com/basecamp/omarchy/tree/v4.5.0/migrations + +The mobile hold regression reads these files; it never executes their commands. +They test the real release changes rather than invented keyword-only fixtures. diff --git a/packages/omamobile-omarchy/test/upstream45/notifications/loader.cjs b/packages/omamobile-omarchy/test/upstream45/notifications/loader.cjs new file mode 100644 index 000000000..b44883359 --- /dev/null +++ b/packages/omamobile-omarchy/test/upstream45/notifications/loader.cjs @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) David Heinemeier Hansson +// Load a notification-plugin JS module the way QML does: `.pragma library` +// dropped, each `.import "X.js" as Alias` resolved to that module's scope. +const fs = require('node:fs'), vm = require('node:vm'), path = require('node:path') +const dir = process.env.OMARCHY_SHELL_DIR ? path.join(process.env.OMARCHY_SHELL_DIR, 'plugins', 'notifications') + : path.join(__dirname, '..', '..', '..', 'shell', 'plugins', 'notifications') +const cache = {} +function load(name) { + if (cache[name]) return cache[name] + const scope = { console, Qt: { openUrlExternally: u => u } } + const code = fs.readFileSync(path.join(dir, name + '.js'), 'utf8') + .replace(/^\.pragma.*$/mg, '') + .replace(/^\.import "([^"]+)" as (\w+)$/mg, (_, file, alias) => { + scope[alias] = load(file.replace(/\.js$/, '')); return '' + }) + vm.createContext(scope) + vm.runInContext(code, scope) + return cache[name] = scope +} +load.dir = dir +module.exports = load diff --git a/packages/omamobile-omarchy/test/upstream45/notifications/logic.cjs b/packages/omamobile-omarchy/test/upstream45/notifications/logic.cjs new file mode 100644 index 000000000..e71e098b4 --- /dev/null +++ b/packages/omamobile-omarchy/test/upstream45/notifications/logic.cjs @@ -0,0 +1,1089 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) David Heinemeier Hansson +// The notification plugin's pure JS modules, plus the service's own functions +// lifted out of Service.qml and run against a fake ListModel and fake senders. +const assert = require('node:assert/strict'), fs = require('node:fs'), vm = require('node:vm') +const { URL } = require('node:url') +const load = require('./loader.cjs') +const S = load('Security'), M = load('Markup'), D = load('Detect'), Store = load('Store') +const Layout = load('Layout'), Delivery = load('Delivery'), Icons = load('Icons') +const snap = (n, key = 'k') => Store.snapshot(n, key, { Normal: 1 }) + +// ---------------------------------------------------------------- URL policy +// Hosts a WHATWG parser reads as IPv4. Node's URL proves each canonicalisation +// is real before the policy is checked to refuse it. +const numericHosts = [ + ['http://0x7f.0x0.0x0.0x1/', '127.0.0.1'], ['http://0X7F.0X0.0X0.0X1/', '127.0.0.1'], + ['http://0xa.0x0.0x0.0x1/', '10.0.0.1'], ['http://0177.0.0.1/', '127.0.0.1'], + ['http://0177.00.00.01/', '127.0.0.1'], ['http://2130706433/', '127.0.0.1'], + ['http://0x7f000001/', '127.0.0.1'], ['http://10.0.0x0.0x1/', '10.0.0.1'], + ['http://10.0.00.01/', '10.0.0.1'], ['http://127.0x/', '127.0.0.0'], ['https://127.1', '127.0.0.1'], +] +for (const [u, ip] of numericHosts) assert.equal(new URL(u).hostname, ip, 'sanity: ' + u) +const bad = ['https://paypal.com@evil.example', 'https://user:pass@example.com', 'javascript:alert(1)', 'file:///etc/passwd', + 'smb://server/share', 'data:text/html,test', 'https://example.com/\n', 'https://example.com/%0d%0a', 'https://example.com/%250a', + 'https://example.com%40evil.example', 'https://[::1]', 'https://[::ffff:127.0.0.1]', 'https://éxample.com', 'https://example..com', + 'https://example.com:99999', 'https://example.com\\@evil.example', 'https://example.com/' + 'x'.repeat(4096), + ...numericHosts.map(([u]) => u)] +for (const u of bad) { + assert.equal(S.safeExternalUrl(u), '', u) + assert.equal(S.openExternalUrl(u), false, u) + assert.ok(!M.render('click').includes('', '', '', + '