Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ if (dataDirFlag) {
// ─── Root detection (macOS + Linux) ─────────────────────────
// Chromium refuses to run as root without --no-sandbox. Also required
// on macOS for clipboard access (paste) in the elevated process.
if (
const isRoot =
(process.platform === 'linux' || process.platform === 'darwin') &&
typeof process.getuid === 'function' &&
process.getuid() === 0
) {

if (isRoot) {
app.commandLine.appendSwitch('no-sandbox')
}

Expand Down Expand Up @@ -319,7 +320,11 @@ function createWindow(): void {
preload: join(__dirname, '../preload/index.js'),
contextIsolation: true,
nodeIntegration: false,
sandbox: true
// Chromium's renderer sandbox uses Linux namespaces that fail
// when running as root (e.g. after pkexec relaunch). The
// --no-sandbox switch only covers the browser/GPU processes;
// this flag must also be false to prevent a blank grey window.
sandbox: !isRoot
}
})

Expand Down
Loading