This commit is contained in:
2026-01-09 09:41:47 +00:00
parent 51c83f846a
commit 5234411c9d
7 changed files with 71 additions and 33 deletions

View File

@@ -193,33 +193,23 @@ for_window [app_id="chromium-browser"] fullscreen enable
};
// Chromium arguments for kiosk mode on Wayland
// Hardware acceleration is enabled where available but falls back gracefully
const browserArgs = [
// Wayland/Ozone configuration
'--ozone-platform=wayland',
'--enable-features=UseOzonePlatform',
// Kiosk mode settings
'--kiosk',
'--no-first-run',
'--disable-infobars',
'--disable-session-crashed-bubble',
'--disable-restore-session-state',
'--noerrdialogs',
// Disable unnecessary features for kiosk
'--disable-background-networking',
'--disable-sync',
'--disable-translate',
'--noerrdialogs',
// Required for VM/headless/sandboxed environments
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
// GPU/rendering flags for VM environments
'--disable-gpu',
'--disable-gpu-compositing',
'--disable-gpu-sandbox',
'--disable-software-rasterizer',
'--disable-accelerated-2d-canvas',
'--disable-accelerated-video-decode',
'--use-gl=swiftshader',
'--in-process-gpu',
// Disable features that may cause issues in kiosk mode
'--disable-features=TranslateUI,VizDisplayCompositor',
'--disable-features=TranslateUI',
'--disable-hang-monitor',
'--disable-breakpad',
'--disable-component-update',
@@ -281,8 +271,15 @@ for_window [app_id="chromium-browser"] fullscreen enable
return this.swayProcess !== null;
}
isBrowserRunning(): boolean {
return this.browserProcess !== null;
async isBrowserRunning(): Promise<boolean> {
// Check if any chromium process is running (Chromium forks, so we can't just track the parent)
try {
const cmd = new Deno.Command('pgrep', { args: ['-f', 'chromium'], stdout: 'null', stderr: 'null' });
const result = await cmd.output();
return result.success;
} catch {
return false;
}
}
async stopSway(): Promise<void> {
@@ -335,12 +332,12 @@ for_window [app_id="chromium-browser"] fullscreen enable
}
})();
// Monitor process exit
// Monitor process exit - only nullify if still the same process (prevents race condition on restart)
process.status.then((status) => {
console.log(`[${name}] Process exited with code ${status.code}`);
if (name === 'sway') {
if (name === 'sway' && this.swayProcess === process) {
this.swayProcess = null;
} else if (name === 'chromium') {
} else if (name === 'chromium' && this.browserProcess === process) {
this.browserProcess = null;
}
});