-
Notifications
You must be signed in to change notification settings - Fork 37
feat(v3): add desktop-only "Start in fullscreen" system option #938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,6 +100,7 @@ export async function loadSettings() { | |
| // failed fetch below still leaves the desktop updater wired up. | ||
| // setupAppUpdates() is idempotent via _appUpdatesWired. | ||
| setupAppUpdates(); | ||
| setupWindowOptions(); | ||
| const resp = await fetch('/api/settings'); | ||
| const data = await resp.json(); | ||
| // Null-guard the form fields: on the v3 tabbed settings page the markup is | ||
|
|
@@ -167,6 +168,47 @@ export async function loadSettings() { | |
| hwcInitSettingsUI(); | ||
| } | ||
|
|
||
| // ── Window options (desktop-only) ──────────────────────────────────────── | ||
| // Desktop-only window preferences (start-in-fullscreen, …). The whole block | ||
| // stays hidden in the plain web / Docker app; unhide + wire only when the | ||
| // feedBack-desktop bridge (window.feedBackDesktop.window) exposes the getter | ||
| // and setter. Persistence lives desktop-side because only the Electron main | ||
| // process can read the pref at window-creation time — core just proxies. | ||
| export let _windowOptionsWired = false; | ||
|
|
||
| export function setupWindowOptions() { | ||
| const block = document.getElementById('window-options-block'); | ||
| if (!block) return; | ||
| const winApi = window.feedBackDesktop?.window; | ||
| // Per-method capability check: a partial/older bridge may expose `window` | ||
| // without this shape. Leave the block hidden rather than half-wiring it. | ||
| if (!winApi | ||
| || typeof winApi.getStartFullscreen !== 'function' | ||
| || typeof winApi.setStartFullscreen !== 'function') { | ||
| return; | ||
| } | ||
|
|
||
| block.classList.remove('hidden'); | ||
|
|
||
| const cb = document.getElementById('setting-start-fullscreen'); | ||
| if (!cb) return; | ||
|
|
||
| // Hydrate from the desktop-persisted value. The getter may be sync or | ||
| // async (IPC round-trip); Promise.resolve normalises both. | ||
| Promise.resolve(winApi.getStartFullscreen()).then(function (on) { | ||
| cb.checked = !!on; | ||
| }).catch(function () { /* leave unchecked on error */ }); | ||
|
Comment on lines
+198
to
+200
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Prevent late hydration from overwriting a user toggle. When the getter is asynchronous, the checkbox is enabled immediately. A user can change it before the getter resolves, after which 🤖 Prompt for AI Agents |
||
|
|
||
| // Guard only the listener against double-binding; unhide + re-hydrate | ||
| // stay idempotent so re-entering Settings refreshes the checkbox. | ||
| if (!_windowOptionsWired) { | ||
| _windowOptionsWired = true; | ||
| cb.addEventListener('change', function () { | ||
| try { winApi.setStartFullscreen(cb.checked); } catch (_) { /* best-effort */ } | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| export const APP_UPDATE_CHANNELS = ['stable', 'rc', 'beta', 'alpha']; | ||
|
|
||
| export let _appUpdatesWired = false; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Protect settings hydration from a synchronous getter throw.
Promise.resolve(winApi.getStartFullscreen())evaluates the getter before creating the promise. A synchronous bridge exception therefore escapessetupWindowOptions(). SinceloadSettings()calls it at Line 103, the outer catch instatic/app.jsonly logs the error and skips the remaining settings hydration.Proposed fix
Also applies to: 196-200
🤖 Prompt for AI Agents