From 38fcc6d6bd02c98a2abdb76afbd70c9fa24c5849 Mon Sep 17 00:00:00 2001 From: jelveh Date: Thu, 7 May 2026 22:17:27 -0700 Subject: [PATCH] Detect fullpage apps early and skip desktop load --- src/gui/src/UI/UIDesktop.js | 31 ++++++++----------- src/gui/src/css/style.css | 14 --------- src/gui/src/initgui.js | 60 ++++++++++++++++++++++++++++++++----- 3 files changed, 65 insertions(+), 40 deletions(-) diff --git a/src/gui/src/UI/UIDesktop.js b/src/gui/src/UI/UIDesktop.js index fe332aeda..6613cc7ae 100644 --- a/src/gui/src/UI/UIDesktop.js +++ b/src/gui/src/UI/UIDesktop.js @@ -646,10 +646,10 @@ async function UIDesktop (options) { // Desktop // If desktop is not in fullpage/embedded mode, we hide it until files and directories are loaded and then fade in the UI // This gives a calm and smooth experience for the user - h += `
`; @@ -1261,18 +1261,16 @@ async function UIDesktop (options) { // i.e. https://puter.com/app/ //-------------------------------------------------------------------------------------- if ( window.url_paths[0]?.toLocaleLowerCase() === 'app' && window.url_paths[1] ) { - window.app_launched_from_url = window.url_paths[1]; - // get app metadata - try { - window.app_launched_from_url = await puter.apps.get(window.url_paths[1], { icon_size: 64 }); - window.is_fullpage_mode = window.app_launched_from_url.metadata?.fullpage_on_landing ?? window.is_fullpage_mode ?? false; - - // show 'Show Desktop' button - if ( window.is_fullpage_mode ) { - $('.show-desktop-btn').removeClass('hidden'); + // If app metadata was already fetched early (for fullpage detection), reuse it + if ( !window.app_launched_from_url?.name ) { + window.app_launched_from_url = window.url_paths[1]; + // get app metadata + try { + window.app_launched_from_url = await puter.apps.get(window.url_paths[1], { icon_size: 64 }); + window.is_fullpage_mode = window.app_launched_from_url.metadata?.fullpage_on_landing ?? window.is_fullpage_mode ?? false; + } catch (e) { + console.error('UIDesktop app path launch error', e); } - } catch (e) { - console.error('UIDesktop app path launch error', e); } // get query params, any param that doesn't start with 'puter.' will be passed to the app @@ -2472,9 +2470,6 @@ window.exit_fullpage_mode = (el_window) => { // reset dektop height to take into account the taskbar height $('.desktop').css('height', `calc(100vh - ${window.taskbar_height + window.toolbar_height}px)`); - // hide the 'Show Desktop' button in toolbar - $('.show-desktop-btn').hide(); - // refresh desktop background window.refresh_desktop_background(); }; diff --git a/src/gui/src/css/style.css b/src/gui/src/css/style.css index 4cfcd7815..f8d1e6442 100644 --- a/src/gui/src/css/style.css +++ b/src/gui/src/css/style.css @@ -1972,20 +1972,6 @@ label { box-shadow: rgb(255 255 255 / 44%) 0px 0px 0px 0.5px inset, rgba(0, 0, 0, 0.2) 0px 0px 0px 0.5px, rgba(0, 0, 0, 0.2) 0px 2px 14px; } -.show-desktop-btn { - color: white; - font-size: 11px !important; - padding: 2px 5px 2px !important; - border: 1px solid; - border-radius: 4px; - height: 18px !important; - width: 110px !important; - margin-top: 2px; - text-decoration: none; - margin-left: 10px !important; - font-weight: 500; -} - .device-phone .toolbar { z-index: 1; } diff --git a/src/gui/src/initgui.js b/src/gui/src/initgui.js index 42c75d931..f03e1b26d 100644 --- a/src/gui/src/initgui.js +++ b/src/gui/src/initgui.js @@ -521,6 +521,24 @@ window.initgui = async function (options) { window.history.replaceState(null, document.title, cleanUrl); } + //-------------------------------------------------------------------------------------- + // Early check for fullpage mode from app metadata + // If the user navigated to /app/ and the app has fullpage_on_landing, + // set fullpage mode now so we can skip loading the desktop background and items. + //-------------------------------------------------------------------------------------- + if ( !window.is_fullpage_mode && window.url_paths[0]?.toLocaleLowerCase() === 'app' && window.url_paths[1] ) { + try { + const app_info = await puter.apps.get(window.url_paths[1], { icon_size: 64 }); + if ( app_info?.metadata?.fullpage_on_landing ) { + window.is_fullpage_mode = true; + window.taskbar_height = 0; + window.app_launched_from_url = app_info; + } + } catch (e) { + // App metadata fetch failed; will retry later in UIDesktop + } + } + //-------------------------------------------------------------------------------------- // Desktop background (early) // Set before action=login/signup so OIDC error redirects show the background behind the form. @@ -860,10 +878,15 @@ window.initgui = async function (options) { // Load desktop, only if we're not embedded in a popup and not on the dashboard page // ------------------------------------------------------------------------------------- if ( !window.embedded_in_popup && !window.is_dashboard_mode ) { - await window.get_auto_arrange_data(); - puter.fs.stat({ path: window.desktop_path, consistency: 'eventual' }).then(desktop_fsentry => { - UIDesktop({ desktop_fsentry: desktop_fsentry }); - }); + if ( window.is_fullpage_mode ) { + // In fullpage mode, skip loading desktop items and background + UIDesktop({}); + } else { + await window.get_auto_arrange_data(); + puter.fs.stat({ path: window.desktop_path, consistency: 'eventual' }).then(desktop_fsentry => { + UIDesktop({ desktop_fsentry: desktop_fsentry }); + }); + } } // ------------------------------------------------------------------------------------- // Dashboard mode @@ -1408,14 +1431,35 @@ window.initgui = async function (options) { await UIWindowCopyToken({ show_header: true }); } + // ------------------------------------------------------------------------------------- + // Early check for fullpage mode from app metadata (after login) + // ------------------------------------------------------------------------------------- + if ( !window.is_fullpage_mode && window.url_paths[0]?.toLocaleLowerCase() === 'app' && window.url_paths[1] ) { + try { + const app_info = await puter.apps.get(window.url_paths[1], { icon_size: 64 }); + if ( app_info?.metadata?.fullpage_on_landing ) { + window.is_fullpage_mode = true; + window.taskbar_height = 0; + window.app_launched_from_url = app_info; + } + } catch (e) { + // App metadata fetch failed; will retry later in UIDesktop + } + } + // ------------------------------------------------------------------------------------- // Load desktop, if not embedded in a popup and not on the dashboard page // ------------------------------------------------------------------------------------- if ( !window.embedded_in_popup && !window.is_dashboard_mode ) { - await window.get_auto_arrange_data(); - puter.fs.stat({ path: window.desktop_path, consistency: 'eventual' }).then(desktop_fsentry => { - UIDesktop({ desktop_fsentry: desktop_fsentry }); - }); + if ( window.is_fullpage_mode ) { + // In fullpage mode, skip loading desktop items and background + UIDesktop({}); + } else { + await window.get_auto_arrange_data(); + puter.fs.stat({ path: window.desktop_path, consistency: 'eventual' }).then(desktop_fsentry => { + UIDesktop({ desktop_fsentry: desktop_fsentry }); + }); + } } // ------------------------------------------------------------------------------------- // Dashboard mode: open explorer pointing to home directory