Move GUI apps from left dock to right panel only, refresh panel on add/remove

- Remove dock button creation from display.js initGuiApps (apps belong in right panel)
- Register GUI app modules dynamically in loadPanelApps for newly added apps
- Refresh right panel immediately after adding/removing apps in Settings
- Expose loadPanelApps globally for cross-module panel refresh

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
roberts 2026-03-14 23:55:52 -05:00
parent 076ca348d7
commit f8fe4e1296
3 changed files with 23 additions and 32 deletions

View file

@ -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 = `
<span class="dock-icon">${app.icon || '🖥'}</span>
<span class="dock-label">${app.name || app.command}</span>
`;
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);
})();

View file

@ -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();
});
}

View file

@ -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);