Last active
March 22, 2020 21:30
-
-
Save wisniewski94/50751acfa513561df5c03d91770c1de3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { | |
app, BrowserWindow, TouchBar, nativeImage, | |
} = require('electron'); | |
const { TouchBarScrubber, TouchBarButton } = TouchBar; | |
const image = nativeImage.createFromPath('./m.png').resize({ height: 30 }); | |
app.on('ready', () => { | |
const win = new BrowserWindow({ | |
width: 800, | |
height: 600, | |
webPreferences: { | |
nodeIntegration: true, | |
}, | |
}); | |
const button = new TouchBarButton({ | |
label: 'Emoji works aswell 🦁', | |
backgroundColor: '#7851A9', | |
click: () => {}, | |
}); | |
const touchBar = new TouchBar({ | |
items: [ | |
new TouchBarScrubber({ | |
items: [{ label: 'foo' }, { label: 'bar' }, { | |
icon: image, | |
}], | |
selectedStyle: 'outline', | |
mode: 'free', | |
showArrowButtons: true, | |
}), | |
], | |
escapeItem: button, | |
}); | |
win.loadFile('index.html'); | |
win.webContents.openDevTools(); | |
win.setTouchBar(touchBar); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment