diff --git a/frontend/js/apps/display.js b/frontend/js/apps/display.js index 496c307..21cae09 100644 --- a/frontend/js/apps/display.js +++ b/frontend/js/apps/display.js @@ -274,7 +274,7 @@ }); } - // ---- Dynamic dock + app registration ---- + // ---- App registration (no left dock — apps live in the right panel) ---- async function initGuiApps() { try { @@ -285,45 +285,19 @@ if (guiApps.length === 0) return; - // Check if display system is available - const statusRes = await Atlus.apiFetch('/api/display/status'); - if (!statusRes || !statusRes.ok) return; - const status = await statusRes.json(); - if (!status.available) return; - - const dockApps = document.querySelector('.dock-apps'); - if (!dockApps) return; - - // Find the separator to insert before it - const separator = dockApps.querySelector('.dock-separator'); - guiApps.forEach(app => { if (!app.id || !app.command) return; - - // Register the app module + // Register the app module so openApp('gui-xxx') works from the right panel createGuiApp(app); - - // Create dock button - const btn = document.createElement('button'); - btn.className = 'dock-item'; - btn.dataset.app = 'gui-' + app.id; - btn.innerHTML = ` - ${app.icon || '🖥'} - ${app.name || app.command} - `; - btn.addEventListener('click', () => Atlus.openApp('gui-' + app.id)); - - if (separator) { - dockApps.insertBefore(btn, separator); - } else { - dockApps.appendChild(btn); - } }); } catch (e) { // Display not available — silently skip } } + // Expose for dynamic re-registration when apps are added via Settings + window._atlusRegisterGuiApp = createGuiApp; + // Initialize after a brief delay to ensure Atlus core is ready setTimeout(initGuiApps, 200); })(); diff --git a/frontend/js/apps/settings.js b/frontend/js/apps/settings.js index bfbd14d..517c389 100644 --- a/frontend/js/apps/settings.js +++ b/frontend/js/apps/settings.js @@ -838,6 +838,13 @@ return str.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, ''); } + /** Trigger a right-panel apps refresh (calls loadPanelApps if exposed). */ + function _refreshPanel() { + if (typeof window._atlusLoadPanelApps === 'function') { + window._atlusLoadPanelApps(); + } + } + async function renderApplications() { const cfgRes = await Atlus.apiFetch('/api/settings'); const cfg = await cfgRes.json(); @@ -969,6 +976,7 @@ method: 'PUT', body: { gui_apps: apps }, }); + _refreshPanel(); renderApplications(); }); }); @@ -1009,7 +1017,7 @@ body: { gui_apps: apps }, }); - alert(`${name} added. It will appear in the dock and panel.`); + _refreshPanel(); renderApplications(); }); } diff --git a/frontend/js/atlus.js b/frontend/js/atlus.js index 8d7708c..0eef45d 100644 --- a/frontend/js/atlus.js +++ b/frontend/js/atlus.js @@ -351,6 +351,14 @@ if (runRes.ok) runningApps = await runRes.json(); } catch (e) { /* ignore */ } + // Ensure all GUI apps are registered as Atlus app modules + for (const app of guiApps) { + const appId = 'gui-' + app.id; + if (!Atlus.apps[appId] && window._atlusRegisterGuiApp) { + window._atlusRegisterGuiApp(app); + } + } + container.innerHTML = ''; if (guiApps.length === 0) { @@ -699,6 +707,7 @@ window.Atlus.closeApp = closeApp; window.Atlus.focusApp = focusApp; window.Atlus.saveDesktopState = saveDesktopState; + window._atlusLoadPanelApps = loadPanelApps; // Restore previous session (after a brief delay to let app modules register) setTimeout(restoreSession, 100);