Skip to content

Commit 67d1cb2

Browse files
committed
Set X11 environment variable at top of bundle
1 parent 812f965 commit 67d1cb2

File tree

2 files changed

+31
-25
lines changed

2 files changed

+31
-25
lines changed

rollup.config.mjs

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const isLite = process.env.ASCOPE_DISTRIBUTION === "LITE";
2121
const licenseHeader =
2222
"// Copyright (c) 2021-2026 Littleton Robotics\n// http://github.com/Mechanical-Advantage\n//\n// Use of this source code is governed by a BSD\n// license that can be found in the LICENSE file\n// at the resources directory of this application.\n";
2323

24-
function bundle(input, output, isMain, isXRClient, external = []) {
24+
function bundle(input, output, isMain, isXRClient, external = [], intro = "") {
2525
const packageJson = JSON.parse(
2626
fs.readFileSync("package.json", {
2727
encoding: "utf-8"
@@ -32,7 +32,8 @@ function bundle(input, output, isMain, isXRClient, external = []) {
3232
output: {
3333
file: (isLite ? "lite/static/" : "") + "bundles/" + output,
3434
format: isMain ? "cjs" : "es",
35-
banner: licenseHeader
35+
banner: licenseHeader,
36+
intro: intro
3637
},
3738
context: "this",
3839
external: external,
@@ -111,23 +112,34 @@ function bundle(input, output, isMain, isXRClient, external = []) {
111112
const mainBundles = isLite
112113
? [bundle("main/lite/main.ts", "main.js", false, false)]
113114
: [
114-
bundle("main/electron/main.ts", "main.js", true, false, [
115-
"electron",
116-
"electron-fetch",
117-
"fs",
118-
"jsonfile",
119-
"net",
120-
"os",
121-
"ws",
122-
"http",
123-
"path",
124-
"basic-ftp",
125-
"download",
126-
"youtube-dl-exec",
127-
"tesseract.js",
128-
"lzma-native",
129-
"@rev-robotics/revlog-converter"
130-
]),
115+
bundle(
116+
"main/electron/main.ts",
117+
"main.js",
118+
true,
119+
false,
120+
[
121+
"electron",
122+
"electron-fetch",
123+
"fs",
124+
"jsonfile",
125+
"net",
126+
"os",
127+
"ws",
128+
"http",
129+
"path",
130+
"basic-ftp",
131+
"download",
132+
"youtube-dl-exec",
133+
"tesseract.js",
134+
"lzma-native",
135+
"@rev-robotics/revlog-converter"
136+
],
137+
`
138+
if (process.platform === "linux") {
139+
process.env.XDG_SESSION_TYPE = "x11";
140+
}
141+
`
142+
),
131143
bundle("preload.ts", "preload.js", true, false, ["electron"])
132144
];
133145
const largeRendererBundles = [

src/main/electron/main.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ try {
9494
lzma = require("lzma-native");
9595
} catch (e) {}
9696

97-
// Force X11 on Linux
98-
if (process.platform === "linux") {
99-
app.commandLine.appendSwitch("ozone-platform", "x11");
100-
process.env.XDG_SESSION_TYPE = "x11";
101-
}
102-
10397
// Global variables
10498
let hubWindows: BrowserWindow[] = []; // Ordered by last focus time (recent first)
10599
let downloadWindow: BrowserWindow | null = null;

0 commit comments

Comments
 (0)