forked from Blendman974/faceclaw
Wear watchface design
Makes the button-row appear and disappear with a slide-in/out gesture.
Rearranges the other UI elements for a more watchface-like view.
<details>
<summary>Prompts used</summary>
In faceclaw/wear, we have an Android Wear watch app which can be used as a glasses controller. Currently, its UI is a bit chaotic: we have a bottom row of buttons, the time, a foreground-window title, some help text, and a ring of indicators. The core interaction is tapping, double tapping, long tapping, and swiping (which have the same effect as on the R1 ring), which aren't location sensitive except that they can't hit the row of buttons. There is also a crown, which can be rotated as a prev/next input.
First, let's make a crown-direction setting (in the Watch section of the on-glasses Settings app), which is a toggle that can swap which crown-rotation direction is considered next vs prev. The default will be off, which will be opposite the direction that is currently default.
Next, we will make it so that the row of buttons is hidden by default. They will slide in from the bottom when the user swipes up from off-screen (distinguished from a swipe-up gesture sent to the glasses by the starting position of the swipe). They will slide out with a swipe down starting from anywhere below the top of the buttons (distinguishing from a swipe-down gesture sent to the glasses by the starting position of the swipe).
Next, we will remove the circle and four arrows; change the time from being small, curved and at the top of the screen to being larger, straight and vertically centered. We'll delete the gesture current hint ("● select ●● back"), and take the current foreground-window display (which is currently either "Disconnected", "Screen off", or an app title) and place it below the time. When the current state is "Screen off", it will display as "●● Wake". We'll then make it so that when the glasses screen is off, all gestures except for double tap (which wakes the screen) are ignored.
gpt-5.6-Sol:
> Implemented the Wear controller redesign.
>
> - Added on-glasses Settings → Watch toggle: “Clockwise crown = next.” Default off maps clockwise to previous, opposite the former default.
> - Replaced the obsolete “Watch input wakes display” setting.
> - Bottom buttons are hidden initially, slide up from a bottom-edge swipe, and dismiss with a downward swipe anywhere in the tray.
> - Removed the ring, arrows, and gesture hint.
> - Added a large centered straight clock with foreground status beneath it; screen-off status is now “●● Wake.”
> - While the glasses display is off, non-double-tap gestures are ignored locally and defensively on the phone.
> - Updated faceclaw/wear/README.md and faceclaw/wear/PROTOCOL.md.
>
> Verification:
>
> - TypeScript type-check passed.
> - All 59 tests passed.
> - git diff --check passed.
> - Wear Gradle compilation could not start because the sandbox blocks Gradle’s local lock socket/cache access.
</details>
This commit is contained in:
1 parent
b9e5e56ac8
commit
f858f10ce2
13 files changed
+220
-173
No files matched your search
@@ -58,7 +58,7 @@ import { type InProcessAppOptions, type InProcessWindow } from "../ui/shell/in-p
|
||||
import { loadPersistedOpenApps, savePersistedOpenApps } from "../ui/shell/open-apps-persistence";
|
||||
import { appViewportRect, SIDEBAR_WIDTH, sidebarStripVisible, type WindowHeightMode } from "../ui/shell/geometry";
|
||||
import { type LayerActions } from "../ui/layers";
|
||||
import { assistantAllowProactiveSetting, assistantBackendSetting, assistantBridgeHostSetting, assistantBridgePortSetting, assistantBridgeTokenSetting, brightnessSetting, brightnessSettingToLevel, displayModeSetting, watchWakesDisplaySetting, elevenLabsApiKeySetting, getStringSettingById, openAiApiKeySetting, nightscoutApiTokenSetting, firmwareDebugFlagsSetting, lockScreenEnabledSetting, nightscoutSiteUrlSetting, onAnySettingChanged, previewColorSetting, saveVoiceRecordingsSetting, sonioxApiKeySetting, screenTimeoutSetting, screenTimeoutSettingToMs, suspendEvenHubWhenScreenOffSetting, verticalPositionSetting, voiceProviderSetting, wakeWordActionSetting, type ConfigSettingString } from "../ui/dashboard-settings";
|
||||
import { assistantAllowProactiveSetting, assistantBackendSetting, assistantBridgeHostSetting, assistantBridgePortSetting, assistantBridgeTokenSetting, brightnessSetting, brightnessSettingToLevel, displayModeSetting, elevenLabsApiKeySetting, getStringSettingById, openAiApiKeySetting, nightscoutApiTokenSetting, firmwareDebugFlagsSetting, lockScreenEnabledSetting, nightscoutSiteUrlSetting, onAnySettingChanged, previewColorSetting, saveVoiceRecordingsSetting, sonioxApiKeySetting, screenTimeoutSetting, screenTimeoutSettingToMs, suspendEvenHubWhenScreenOffSetting, verticalPositionSetting, voiceProviderSetting, wakeWordActionSetting, type ConfigSettingString } from "../ui/dashboard-settings";
|
||||
import { isIgnoringBatteryOptimizations, requestIgnoreBatteryOptimizations } from "../native/battery-optimization";
|
||||
import {
|
||||
getInstalledEvenHubAppById,
|
||||
@@ -1409,22 +1409,17 @@ class DashboardController {
|
||||
* finger-down/finger-up (the watch) hold for as long as the user does.
|
||||
*/
|
||||
async injectSyntheticRingInput(kind: WearRemoteInputKind, origin: SyntheticInputOrigin = "ring"): Promise<void> {
|
||||
// Watch-scheme input (the Wear app, the phone's pad/d-pad, mirror touches)
|
||||
// wakes a dark display and then lands normally, resuming the previous
|
||||
// focus. The ring's own scheme keeps its double-tap-only wake.
|
||||
// Match the ring while the display is dark: only a double-click wakes it,
|
||||
// and that wake is handled by Shell.receiveInput. This check also protects
|
||||
// against a watch acting on a stale state snapshot.
|
||||
if (
|
||||
origin === "watch" &&
|
||||
!shell.isScreenOn() &&
|
||||
!this.glassesLocked &&
|
||||
(this.phase === "connected" || this.phase === "charging") &&
|
||||
watchWakesDisplaySetting.get() &&
|
||||
kind !== "double-click" &&
|
||||
kind !== "wakeword" &&
|
||||
kind !== "long-press-release"
|
||||
) {
|
||||
shell.wake(shell.getFocus());
|
||||
this.requestShellRender();
|
||||
this.appendLog(`${kind} (watch scheme) woke the display`);
|
||||
this.appendLog(`${kind} (watch scheme) ignored while display is off`);
|
||||
return;
|
||||
}
|
||||
if (kind === "long-press") {
|
||||
// Hardware delivers a press event and then a release when the finger
|
||||
@@ -1452,15 +1447,8 @@ class DashboardController {
|
||||
return;
|
||||
}
|
||||
if (!shell.isScreenOn()) {
|
||||
// The same wake policy as the rest of the watch scheme: honour the
|
||||
// "input wakes display" setting; with it off, only a double-tap (a
|
||||
// normal double-click) reaches the dark display.
|
||||
if (!watchWakesDisplaySetting.get()) {
|
||||
if (kind === "double-tap") await this.injectSyntheticRingInput("double-click", "watch");
|
||||
return;
|
||||
}
|
||||
shell.wake(shell.getFocus());
|
||||
this.requestShellRender();
|
||||
if (kind === "double-tap") await this.injectSyntheticRingInput("double-click", "watch");
|
||||
return;
|
||||
}
|
||||
if (kind !== "tap") {
|
||||
await this.injectSyntheticRingInput(MIRROR_TOUCH_GESTURES[kind], "watch");
|
||||
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
displayModeSetting,
|
||||
onAnySettingChanged,
|
||||
watchCanUnlockSetting,
|
||||
watchCrownClockwiseNextSetting,
|
||||
watchMirrorAssistantSetting,
|
||||
watchRemoteEnabledSetting,
|
||||
} from "../ui/dashboard-settings";
|
||||
@@ -209,6 +210,7 @@ export class WearRemote {
|
||||
apps: this.listApps(),
|
||||
displayMode: displayModeSetting.get(),
|
||||
remoteEnabled: watchRemoteEnabledSetting.get(),
|
||||
crownClockwiseNext: watchCrownClockwiseNextSetting.get(),
|
||||
canUnlock: watchCanUnlockSetting.get(),
|
||||
mirrorAssistant: watchMirrorAssistantSetting.get(),
|
||||
assistantAvailable: shell.isAssistantAvailable(),
|
||||
@@ -294,10 +296,8 @@ export class WearRemote {
|
||||
ack(false, "The glasses are not connected.");
|
||||
return;
|
||||
}
|
||||
// The lock only yields to a double-click, exactly as the ring's does
|
||||
// (handled inside the controller); a dark display wakes on any watch-
|
||||
// scheme gesture (injectSyntheticRingInput, shared with the phone's own
|
||||
// pad and d-pad).
|
||||
// The lock and a dark display only yield to a double-click, exactly as
|
||||
// the ring does (handled inside the controller).
|
||||
const repeatable = kind === "scroll-up" || kind === "scroll-down" || kind === "swipe-up" || kind === "swipe-down";
|
||||
const steps = repeatable ? Math.min(MAX_SCROLL_STEPS, Math.max(1, Math.round(readNumber(payload.steps, 1)))) : 1;
|
||||
for (let i = 0; i < steps; i++) {
|
||||
@@ -339,6 +339,10 @@ export class WearRemote {
|
||||
ack(false, "The glasses are not connected.");
|
||||
return;
|
||||
}
|
||||
if (payload.source === "gesture" && !shell.isScreenOn()) {
|
||||
ack(true);
|
||||
return;
|
||||
}
|
||||
if (state.glassesLocked && command !== "unlock" && command !== "lock") {
|
||||
ack(false, "The glasses are locked.");
|
||||
return;
|
||||
|
||||
@@ -328,13 +328,13 @@ export const watchCanUnlockSetting = new ConfigSettingBoolean({
|
||||
"Let the watch unlock the glasses' lock screen (which otherwise waits for the phone to be unlocked). Your watch is on your wrist; turn this off if you would rather it stay a phone-only unlock.",
|
||||
});
|
||||
|
||||
export const watchWakesDisplaySetting = new ConfigSettingBoolean({
|
||||
id: "watch-wakes-display",
|
||||
label: "Watch input wakes display",
|
||||
storageKey: "watch.wakesDisplay",
|
||||
defaultValue: true,
|
||||
export const watchCrownClockwiseNextSetting = new ConfigSettingBoolean({
|
||||
id: "watch-crown-clockwise-next",
|
||||
label: "Clockwise crown = next",
|
||||
storageKey: "watch.crownClockwiseNext",
|
||||
defaultValue: false,
|
||||
description:
|
||||
"Any gesture from the watch turns the glasses display on (the ring only wakes it with a double-tap). Off: watch input is ignored while the display is off, as ring input is.",
|
||||
"Choose which crown direction moves to the next item. Off: clockwise moves to the previous item. On: clockwise moves to the next item.",
|
||||
});
|
||||
|
||||
export const watchMirrorAssistantSetting = new ConfigSettingBoolean({
|
||||
|
||||
@@ -60,9 +60,9 @@ import {
|
||||
screenTimeoutSetting,
|
||||
wakeWordActionSetting,
|
||||
watchCanUnlockSetting,
|
||||
watchCrownClockwiseNextSetting,
|
||||
watchMirrorAssistantSetting,
|
||||
watchRemoteEnabledSetting,
|
||||
watchWakesDisplaySetting,
|
||||
} from "../dashboard-settings";
|
||||
import { wearBridge } from "../../native/wear-bridge";
|
||||
import { SettingsPanelLayer, type SettingsSection } from "./settings-panel";
|
||||
@@ -167,7 +167,7 @@ function settingsSections(): SettingsSection[] {
|
||||
// a watch running the companion app is currently reachable.
|
||||
items: [
|
||||
toggleSettingMenuItem(watchRemoteEnabledSetting),
|
||||
toggleSettingMenuItem(watchWakesDisplaySetting),
|
||||
toggleSettingMenuItem(watchCrownClockwiseNextSetting),
|
||||
toggleSettingMenuItem(watchCanUnlockSetting),
|
||||
toggleSettingMenuItem(watchMirrorAssistantSetting),
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user