Merge pull request #48 from FilipAlexander/pr/wake
Shell: double-tap wake returns to the last app (setting default off)
This commit is contained in:
commit
e59b3becb4
4 files changed
+19
-3
No files matched your search
@@ -2356,7 +2356,7 @@ class DashboardController {
|
||||
let shellPreWoke = false;
|
||||
if (wakewordShouldWake || displayShouldWake) {
|
||||
if (!shell.isScreenOn()) {
|
||||
shellPreWoke = shell.wake("sidebar");
|
||||
shellPreWoke = shell.wake(displayShouldWake ? shell.userWakeFocus() : "sidebar");
|
||||
}
|
||||
if (shellPreWoke || this.evenHubSessionSuspended || this.evenHubResumePromise) {
|
||||
const ready = await frameTimings.spanAsync(frameId, "wake-barrier", () =>
|
||||
|
||||
@@ -570,6 +570,14 @@ export function getBrightnessPreferences() {
|
||||
curve: autoBrightnessCurveSetting.getValidValue(), fadeMs: scaleAnimationDuration(SCREEN_FADE_MS, screenFadeSetting.get()) };
|
||||
}
|
||||
|
||||
export const wakeToLastAppSetting = new ConfigSettingBoolean({
|
||||
id: "wake-to-last-app",
|
||||
label: "Wake into last app",
|
||||
storageKey: "display.wakeToLastApp",
|
||||
defaultValue: false,
|
||||
description: "Waking the display with a double tap returns to the app you were using. Off: wake into the app switcher.",
|
||||
});
|
||||
|
||||
export const screenTimeoutSetting = new ConfigSettingEnum<ScreenTimeoutSetting>({
|
||||
id: "screen-timeout",
|
||||
label: "Screen timeout",
|
||||
|
||||
@@ -75,6 +75,7 @@ import {
|
||||
useMicControlSetting,
|
||||
voiceProviderSetting,
|
||||
screenTimeoutSetting,
|
||||
wakeToLastAppSetting,
|
||||
wakeWordActionSetting,
|
||||
watchCanUnlockSetting,
|
||||
watchCrownClockwiseNextSetting,
|
||||
@@ -106,6 +107,7 @@ function settingsSections(): SettingsSection[] {
|
||||
},
|
||||
}),
|
||||
toggleSettingMenuItem(lockScreenEnabledSetting),
|
||||
toggleSettingMenuItem(wakeToLastAppSetting),
|
||||
// A band (at one of five heights) / Tall / Full Screen; the
|
||||
// dashboard controller moves or reflows windows on change.
|
||||
enumSettingMenuItem(displayLayoutSetting),
|
||||
|
||||
@@ -45,6 +45,7 @@ import {
|
||||
statusBarVisibilitySetting,
|
||||
timeFormatSetting,
|
||||
wakeWordActionSetting,
|
||||
wakeToLastAppSetting,
|
||||
windowBorderSetting,
|
||||
} from "../dashboard-settings";
|
||||
import { onAmbientCardsChanged } from "./ambient-cards";
|
||||
@@ -1003,7 +1004,7 @@ class Shell {
|
||||
// "wake". Keep that directionality if delivery is delayed or duplicated.
|
||||
if (event.type === "display-wake") {
|
||||
this.lastInputAtMs = Date.now();
|
||||
const wokeScreen = !this.screenOn && this.wake("sidebar");
|
||||
const wokeScreen = !this.screenOn && this.wake(this.userWakeFocus());
|
||||
return { shell: wokeScreen, window: false };
|
||||
}
|
||||
|
||||
@@ -1042,7 +1043,7 @@ class Shell {
|
||||
|
||||
if (!this.screenOn) {
|
||||
if (event.type === "double-click") {
|
||||
this.wake("sidebar");
|
||||
this.wake(this.userWakeFocus());
|
||||
return { shell: true, window: false };
|
||||
}
|
||||
return { shell: false, window: false };
|
||||
@@ -1145,6 +1146,11 @@ class Shell {
|
||||
return { shell: false, window: false };
|
||||
}
|
||||
|
||||
/** Where a user's double-tap wake lands: the last app, or the switcher (setting). */
|
||||
userWakeFocus(): FocusKind {
|
||||
return wakeToLastAppSetting.get() && this.foregroundWindow() ? "window" : "sidebar";
|
||||
}
|
||||
|
||||
foregroundWindow(): ShellWindow | undefined {
|
||||
return this.windows[this.selectedIndex] ?? this.windows[0];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user