Skip to content

Commit

Permalink
Merge pull request #10503 from vector-im/t3chguy/electron_keep_alt_menu
Browse files Browse the repository at this point in the history
Allow setting electron autoHideMenuBar and persist it
  • Loading branch information
t3chguy committed Aug 6, 2019
2 parents 91fb5ae + 509839e commit 7660625
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
10 changes: 9 additions & 1 deletion electron_app/src/electron-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ ipcMain.on('ipcCall', async function(ev, payload) {
case 'setMinimizeToTrayEnabled':
store.set('minimizeToTray', global.minimizeToTray = args[0]);
break;
case 'getAutoHideMenuBarEnabled':
ret = global.mainWindow.isMenuBarAutoHide();
break;
case 'setAutoHideMenuBarEnabled':
store.set('autoHideMenuBar', args[0]);
global.mainWindow.setAutoHideMenuBar(args[0]);
global.mainWindow.setMenuBarVisibility(!args[0]);
break;
case 'getAppVersion':
ret = app.getVersion();
break;
Expand Down Expand Up @@ -320,7 +328,7 @@ app.on('ready', () => {
mainWindow = global.mainWindow = new BrowserWindow({
icon: iconPath,
show: false,
autoHideMenuBar: true,
autoHideMenuBar: store.get('autoHideMenuBar', true),

x: mainWindowState.x,
y: mainWindowState.y,
Expand Down
22 changes: 17 additions & 5 deletions src/vector/platform/ElectronPlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,31 +174,43 @@ export default class ElectronPlatform extends VectorBasePlatform {
}

async getAppVersion(): Promise<string> {
return await this._ipcCall('getAppVersion');
return this._ipcCall('getAppVersion');
}

supportsAutoLaunch(): boolean {
return true;
}

async getAutoLaunchEnabled(): boolean {
return await this._ipcCall('getAutoLaunchEnabled');
return this._ipcCall('getAutoLaunchEnabled');
}

async setAutoLaunchEnabled(enabled: boolean): void {
return await this._ipcCall('setAutoLaunchEnabled', enabled);
return this._ipcCall('setAutoLaunchEnabled', enabled);
}

supportsAutoHideMenuBar(): boolean {
return true;
}

async getAutoHideMenuBarEnabled(): boolean {
return this._ipcCall('getAutoHideMenuBarEnabled');
}

async setAutoHideMenuBarEnabled(enabled: boolean): void {
return this._ipcCall('setAutoHideMenuBarEnabled', enabled);
}

supportsMinimizeToTray(): boolean {
return true;
}

async getMinimizeToTrayEnabled(): boolean {
return await this._ipcCall('getMinimizeToTrayEnabled');
return this._ipcCall('getMinimizeToTrayEnabled');
}

async setMinimizeToTrayEnabled(enabled: boolean): void {
return await this._ipcCall('setMinimizeToTrayEnabled', enabled);
return this._ipcCall('setMinimizeToTrayEnabled', enabled);
}

async canSelfUpdate(): boolean {
Expand Down

0 comments on commit 7660625

Please sign in to comment.