Skip to content

Commit 7660625

Browse files
authored
Merge pull request #10503 from vector-im/t3chguy/electron_keep_alt_menu
Allow setting electron autoHideMenuBar and persist it
2 parents 91fb5ae + 509839e commit 7660625

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

electron_app/src/electron-main.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ ipcMain.on('ipcCall', async function(ev, payload) {
156156
case 'setMinimizeToTrayEnabled':
157157
store.set('minimizeToTray', global.minimizeToTray = args[0]);
158158
break;
159+
case 'getAutoHideMenuBarEnabled':
160+
ret = global.mainWindow.isMenuBarAutoHide();
161+
break;
162+
case 'setAutoHideMenuBarEnabled':
163+
store.set('autoHideMenuBar', args[0]);
164+
global.mainWindow.setAutoHideMenuBar(args[0]);
165+
global.mainWindow.setMenuBarVisibility(!args[0]);
166+
break;
159167
case 'getAppVersion':
160168
ret = app.getVersion();
161169
break;
@@ -320,7 +328,7 @@ app.on('ready', () => {
320328
mainWindow = global.mainWindow = new BrowserWindow({
321329
icon: iconPath,
322330
show: false,
323-
autoHideMenuBar: true,
331+
autoHideMenuBar: store.get('autoHideMenuBar', true),
324332

325333
x: mainWindowState.x,
326334
y: mainWindowState.y,

src/vector/platform/ElectronPlatform.js

+17-5
Original file line numberDiff line numberDiff line change
@@ -174,31 +174,43 @@ export default class ElectronPlatform extends VectorBasePlatform {
174174
}
175175

176176
async getAppVersion(): Promise<string> {
177-
return await this._ipcCall('getAppVersion');
177+
return this._ipcCall('getAppVersion');
178178
}
179179

180180
supportsAutoLaunch(): boolean {
181181
return true;
182182
}
183183

184184
async getAutoLaunchEnabled(): boolean {
185-
return await this._ipcCall('getAutoLaunchEnabled');
185+
return this._ipcCall('getAutoLaunchEnabled');
186186
}
187187

188188
async setAutoLaunchEnabled(enabled: boolean): void {
189-
return await this._ipcCall('setAutoLaunchEnabled', enabled);
189+
return this._ipcCall('setAutoLaunchEnabled', enabled);
190+
}
191+
192+
supportsAutoHideMenuBar(): boolean {
193+
return true;
194+
}
195+
196+
async getAutoHideMenuBarEnabled(): boolean {
197+
return this._ipcCall('getAutoHideMenuBarEnabled');
198+
}
199+
200+
async setAutoHideMenuBarEnabled(enabled: boolean): void {
201+
return this._ipcCall('setAutoHideMenuBarEnabled', enabled);
190202
}
191203

192204
supportsMinimizeToTray(): boolean {
193205
return true;
194206
}
195207

196208
async getMinimizeToTrayEnabled(): boolean {
197-
return await this._ipcCall('getMinimizeToTrayEnabled');
209+
return this._ipcCall('getMinimizeToTrayEnabled');
198210
}
199211

200212
async setMinimizeToTrayEnabled(enabled: boolean): void {
201-
return await this._ipcCall('setMinimizeToTrayEnabled', enabled);
213+
return this._ipcCall('setMinimizeToTrayEnabled', enabled);
202214
}
203215

204216
async canSelfUpdate(): boolean {

0 commit comments

Comments
 (0)