34 lines
811 B
JavaScript
34 lines
811 B
JavaScript
import State from '../core/state.js';
|
|
import MeridianWM from '../core/wm.js';
|
|
import Registry from '../core/registry.js';
|
|
|
|
function renderApps(apps) {
|
|
const container = document.getElementById('active-apps-list');
|
|
if (!container) return;
|
|
|
|
if (!apps || apps.length === 0) {
|
|
container.innerHTML = '<div class="active-apps-empty">No apps open</div>';
|
|
return;
|
|
}
|
|
|
|
container.innerHTML = '';
|
|
for (const win of apps) {
|
|
const btn = document.createElement('button');
|
|
btn.className = 'active-app-chip';
|
|
btn.setAttribute('aria-label', `Focus ${win.title}`);
|
|
btn.textContent = win.title;
|
|
|
|
btn.addEventListener('click', () => {
|
|
MeridianWM.focusWindow(win.id);
|
|
});
|
|
|
|
container.appendChild(btn);
|
|
}
|
|
}
|
|
|
|
function init() {
|
|
State.subscribe('windows', renderApps);
|
|
}
|
|
|
|
init();
|