Repository navigation
Conversation
…ification:` (owl 23) shows a title, a text, a countdown or count up that Android keeps running, and up to three buttons whose presses run `onNotification`, so a timer shows what's left on the lock screen and pauses or stops from there Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…5, the level not yet released, as 23 and 24 have shipped (1.7.0 has 24); the top-level handler check keeps main's widget-or-face condition, now that strips check their own; registerNotExported and EmbeddedTerminal are imported from dev.omalauncher.system and dev.omalauncher.ui.home, where the source tree reorganisation moved them (40c8a10) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ian and Japanese too, as lint asks now that main speaks them (SimonSchubert#280) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A widget or a face can keep a notification of its own (owl 23).
notification:is a live property, likelock:andfps:: posted while it's a map, taken away while it's null, and posted again when what it says changes.onNotificationruns when one of its buttons is pressed, with the button'svalue.widget "tea" { meta { owl: 23 } source now = clock every 1s state endsAt = 0 persist notification: endsAt > 0 ? {title: "tea", until: endsAt, buttons: ["+1m", "stop"]} : null onNotification: endsAt = value == "stop" ? 0 : max(endsAt, now) + 60 at endsAt { notify("tea", "it's ready"); endsAt = 0 } onTap: endsAt = now + 3 * 60 Text { text: endsAt > now ? fmtTime(endsAt - now, "m:ss", "UTC") : "tea" } }The map takes
title(the widget's name without it),text,until(a Unix time it counts down to) orsince(one it counts up from), and up to 3buttons, each a text or{text, value}. The clock is a chronometer Android runs, so the lock screen keeps time while the widget, off screen, doesn't redraw. On Android 16 QPR2 and later, a notification with a running clock asks to be a live update: it's at the top of the lock screen and a chip in the status bar.Why
notify()posts a new notification each time and can't change or take one back, so nothing a widget follows can show outside home. My case is a countdown timer tile (no Linux: a clock, states andat). Once the phone is locked there's no way to see how long is left, and pausing or adding a minute means unlocking and finding the page. With this, the timer counts down on the lock screen like the Clock app's, and pause, +1m and stop work from there.Other uses: a pomodoro or workout interval, a stopwatch (
since), a parking meter, a build or download a widget already follows.How
notification:on widgets and faces (not apps, which only run while open), andonNotificationnext toonTap, withvalue.onNotificationwithoutnotification:doesn't compile. InSINCEas "a widget's notification", since plainnotificationis the owl 4 action.LEVELgoes to 23, as 22 shipped in 1.3.0.WidgetNotification(runtime): the map as data. What's wrong with it (an unknown field, bothuntilandsince, over 3 buttons, a button without text) goes to.errors/like other runtime errors. Unit-tested.WidgetNotifications: one notification per widget file, tagged with its name, on a new channel "Widget timers and status". The channel is default importance with no sound or vibration, so the lock screen shows it where it hides silent ones and updates make no noise. Public visibility,setOnlyAlertOnce, ongoing. Buttons are immutable broadcast PendingIntents to a not-exported receiver the engine registers, carrying the file and the button's index; the value comes from what was last shown.WidgetInstance: evaluatesnotification:withsnapshotFlowfromstart, whether its page shows or not.pressNotificationsets the widget'sclocksources to now before runningonNotification, because they stand still off screen and a pause pressed on the lock screen has to count from now.WidgetEngine: after each reload, notifications of widgets that are gone, not compiling, waiting for Linux or withoutnotification:are taken away. At startup that includes those a launcher that stopped left behind.now), a row in its table, a pointer fromnotifyin handlers.md, versions.md, and the README's level and index.POST_PROMOTED_NOTIFICATIONSin the manifest (a normal permission), and one new string with de, es, in, pt and zh.Screenshots
On a Pixel 9 Pro XL with Android 17, with my timer widget (its owl 23 version, not part of this PR):
The live update's chip in the status bar while it runs:
What to look at
untilorsinceruns a clock, which is what Android means them for: something under way and time-sensitive. A paused timer has no clock, so it's an ordinary notification, collapsed on the lock screen until expanded. If you'd rather a widget ask for it itself, or not have it at all, it's one line.notify(...)from anat; this notification makes no sound. The countdown is Android's and runs without the launcher. Theat, the ring and the buttons need the launcher's process, which as home it nearly always has; the docs already say anatcan run a little late while the phone sleeps. If it does, the chronometer runs past zero until it fires.notify's do. Opening the widget's screen would suit a timer better; I left it out to keep this small.Testing
On a Pixel 9 Pro XL with Android 17, as the side-by-side debug copy (an
applicationIdSuffixfrom a Gradle init script, not in the branch), with the timer widget on its home:./gradlew :owl:test :app:testDebugUnitTest :owl:owlJarand./gradlew :app:assembleDebug :app:lintDebugpass. New tests:LangTest.aWidgetHasANotificationOfItsOwn, andWidgetNotificationTest(parsing, errors, a press runningonNotificationwith the clock set to now).owl checkpasses on the docs example.dumpsys notificationshows it posted withPROMOTED_ONGOING, a countdown chronometer, three actions andvis=PUBLIC, in the alerting section, not the silent one. On the lock screen it counts down with pause, +1m and stop, and the status bar shows the chip.notify, while this one turned to "time's up", counting up, with +1m and stop), +1m after the ring (a fresh minute), and stop (gone).🤖 Generated with Claude Code