Skip to content

Commit 7e384d0

Browse files
committed
add macOS touchbar for about dialog
1 parent a5dda44 commit 7e384d0

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

browser/bootstrap.js

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@ angular.element(document).ready(function() {
77
angular.bootstrap(document, [mainModule.name], { strictDi: true });
88
});
99

10+
// Determine version
11+
const semver = require('semver');
12+
let version = remote.app.getVersion();
13+
let shortVersion = `${semver.major(version)}.${semver.minor(version)}`;
14+
1015
// Importing this adds a right-click menu with 'Inspect Element' option
11-
const { BrowserWindow } = require('electron').remote;
16+
const { BrowserWindow, TouchBar } = require('electron').remote;
1217
const { Menu, MenuItem } = remote;
18+
const {TouchBarLabel, TouchBarButton, TouchBarSpacer} = TouchBar;
1319

1420
let rightClickPosition = null;
1521

@@ -40,10 +46,35 @@ function openAboutWindow() {
4046
resizable: false,
4147
show: false
4248
});
49+
50+
const about = new TouchBarButton({
51+
label: 'About',
52+
click: () => {
53+
require('electron').shell.openExternal(`https://access.redhat.com/documentation/en/red-hat-development-suite?version=${shortVersion}`);
54+
}
55+
});
56+
57+
const releaseNotes = new TouchBarButton({
58+
label: 'Release Notes',
59+
click: () => {
60+
require('electron').shell.openExternal(`https://access.redhat.com/documentation/en-us/red_hat_development_suite/${shortVersion}/html/release_notes_and_known_issues/`);
61+
}
62+
});
63+
64+
const issues = new TouchBarButton({
65+
label: 'Report Issues',
66+
click: () => {
67+
require('electron').shell.openExternal(`https://github.com/redhat-developer-tooling/developer-platform-install/blob/master/CONTRIBUTING.md#reporting-an-issue`);
68+
}
69+
});
70+
71+
const touchBar = new TouchBar([about, releaseNotes, issues]);
72+
4373
let baseLocation = encodeURI(__dirname.replace(/\\/g, '/')).replace(/#/g, '%23');
4474

4575
// Load the about.html of the app
4676
aboutWindow.loadURL(`file://${baseLocation}/about.html`);
77+
aboutWindow.setTouchBar(touchBar);
4778
aboutWindow.setMenu(null);
4879
aboutWindow.once('ready-to-show', () => {
4980
aboutWindow.show();

0 commit comments

Comments
 (0)