Skip to content

Commit

Permalink
Added MVC touchbar to mac app.
Browse files Browse the repository at this point in the history
  • Loading branch information
imolorhe committed Nov 26, 2017
1 parent 8a3c56d commit f3fe9ae
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
22 changes: 22 additions & 0 deletions electron/touchbar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const { TouchBar } = require('electron');

const { TouchBarLabel, TouchBarButton, TouchBarSpacer } = TouchBar

// Spin button
const spin = new TouchBarButton({
label: 'Would you like touchbar support in Altair?',
// backgroundColor: '#7851A9',
click: () => {
console.log('Button clicked.');
const issueUrl = 'https://github.com/imolorhe/altair/issues/180';
require('electron').shell.openExternal(issueUrl);
}
});

const touchBar = new TouchBar([
spin
]);

module.exports = {
touchBar
};
4 changes: 4 additions & 0 deletions electron/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const fs = require('fs');
const mime = require('mime-types');

const { createMenu } = require('./menu');
const { touchBar } = require('./touchbar');

let instance = null;

Expand Down Expand Up @@ -76,6 +77,9 @@ const createWindow = () => {
// Open the DevTools.
// instance.webContents.openDevTools();

// Set the touchbar
instance.setTouchBar(touchBar);

// Prevent the app from navigating away from the app
instance.webContents.on('will-navigate', (e, url) => e.preventDefault());

Expand Down

0 comments on commit f3fe9ae

Please sign in to comment.