Skip to content

Commit 4519569

Browse files
element-desktop: fix the patch for 1.12.8
Signed-off-by: Brian McGillion <bmg.avoin@gmail.com>
1 parent ef3eb43 commit 4519569

File tree

1 file changed

+34
-26
lines changed

1 file changed

+34
-26
lines changed
Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
1-
diff --git a/src/electron-main.ts b/src/electron-main.ts
2-
index d907312..8ed7061 100644
31
--- a/src/electron-main.ts
42
+++ b/src/electron-main.ts
5-
@@ -466,11 +466,10 @@ app.on("ready", async () => {
3+
@@ -448,11 +448,10 @@
64
// https://www.electronjs.org/docs/faq#the-font-looks-blurry-what-is-this-and-what-can-i-do
75
backgroundColor: "#fff",
8-
6+
97
- titleBarStyle: process.platform === "darwin" ? "hidden" : "default",
108
trafficLightPosition: { x: 9, y: 8 },
11-
9+
1210
icon: global.trayConfig.icon_path,
1311
- show: false,
1412
+ show: true,
1513
autoHideMenuBar: store.get("autoHideMenuBar"),
16-
14+
1715
x: mainWindowState.x,
18-
@@ -496,7 +495,6 @@ app.on("ready", async () => {
16+
@@ -478,7 +477,6 @@
1917
app.exit(1);
2018
}
21-
19+
2220
- void global.mainWindow.loadURL("vector://vector/webapp/");
23-
21+
2422
if (process.platform === "darwin") {
2523
setupMacosTitleBar(global.mainWindow);
26-
@@ -507,79 +505,31 @@ app.on("ready", async () => {
24+
@@ -489,89 +487,34 @@
2725
global.mainWindow.webContents.session.setSpellCheckerEnabled(store.get("spellCheckerEnabled", true));
28-
26+
2927
// Create trayIcon icon
3028
- if (store.get("minimizeToTray")) tray.create(global.trayConfig);
3129
+ //if (store.get("minimizeToTray")) tray.create(global.trayConfig);
32-
30+
3331
- global.mainWindow.once("ready-to-show", () => {
3432
+ global.mainWindow.webContents.once('did-finish-load',function() {
3533
if (!global.mainWindow) return;
3634
mainWindowState.manage(global.mainWindow);
37-
35+
3836
if (!argv["hidden"]) {
3937
global.mainWindow.show();
4038
+ global.mainWindow.restore();
@@ -44,13 +42,20 @@ index d907312..8ed7061 100644
4442
global.mainWindow.hide();
4543
}
4644
});
47-
45+
4846
- global.mainWindow.webContents.on("before-input-event", (event: Event, input: Input): void => {
49-
- const shouldWarnBeforeExit = store.get("warnBeforeExit", true);
5047
- const exitShortcutPressed =
5148
- input.type === "keyDown" && exitShortcuts.some((shortcutFn) => shortcutFn(input, process.platform));
5249
-
53-
- if (shouldWarnBeforeExit && exitShortcutPressed && global.mainWindow) {
50+
- // We only care about the exit shortcuts here
51+
- if (!exitShortcutPressed || !global.mainWindow) return;
52+
-
53+
- // Prevent the default behaviour
54+
- event.preventDefault();
55+
-
56+
- // Let's ask the user if they really want to exit the app
57+
- const shouldWarnBeforeExit = store.get("warnBeforeExit", true);
58+
- if (shouldWarnBeforeExit) {
5459
- const shouldCancelCloseRequest =
5560
- dialog.showMessageBoxSync(global.mainWindow, {
5661
- type: "question",
@@ -64,14 +69,14 @@ index d907312..8ed7061 100644
6469
- defaultId: 1,
6570
- cancelId: 0,
6671
- }) === 0;
67-
-
68-
- if (shouldCancelCloseRequest) {
69-
- event.preventDefault();
70-
- }
72+
- if (shouldCancelCloseRequest) return;
7173
- }
74+
-
75+
- // Exit the app
76+
- app.exit();
7277
- });
7378
+ void global.mainWindow.loadURL("vector://vector/webapp/");
74-
79+
7580
global.mainWindow.on("closed", () => {
7681
global.mainWindow = null;
7782
});
@@ -90,12 +95,11 @@ index d907312..8ed7061 100644
9095
- } else {
9196
- global.mainWindow?.hide();
9297
- }
93-
-
98+
9499
- return false;
95100
- }
96-
+
97101
});
98-
102+
99103
- if (process.platform === "win32") {
100104
- // Handle forward/backward mouse buttons in Windows
101105
- global.mainWindow.on("app-command", (e, cmd) => {
@@ -106,6 +110,10 @@ index d907312..8ed7061 100644
106110
- }
107111
- });
108112
- }
109-
113+
-
110114
webContentsHandler(global.mainWindow.webContents);
111-
115+
116+
+
117+
session.defaultSession.setDisplayMediaRequestHandler(
118+
(_, callback) => {
119+
if (process.env.XDG_SESSION_TYPE === "wayland") {

0 commit comments

Comments
 (0)