mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
Merge pull request #2327 from mikaoelitiana/fix-1155
Add osx touchbar support
This commit is contained in:
@@ -78,9 +78,11 @@ app.on('ready', function () {
|
||||
|
||||
var template = require('./main-menu')
|
||||
var menu = Menu.buildFromTemplate(template)
|
||||
var touchBarMenu = require('./touchbar-menu')
|
||||
switch (process.platform) {
|
||||
case 'darwin':
|
||||
Menu.setApplicationMenu(menu)
|
||||
mainWindow.setTouchBar(touchBarMenu)
|
||||
break
|
||||
case 'win32':
|
||||
mainWindow.setMenu(menu)
|
||||
|
||||
41
lib/touchbar-menu.js
Normal file
41
lib/touchbar-menu.js
Normal file
@@ -0,0 +1,41 @@
|
||||
const {TouchBar} = require('electron')
|
||||
const {TouchBarButton, TouchBarSpacer} = TouchBar
|
||||
const mainWindow = require('./main-window')
|
||||
|
||||
const allNotes = new TouchBarButton({
|
||||
label: '📒',
|
||||
click: () => {
|
||||
mainWindow.webContents.send('list:navigate', '/home')
|
||||
}
|
||||
})
|
||||
|
||||
const starredNotes = new TouchBarButton({
|
||||
label: '⭐️',
|
||||
click: () => {
|
||||
mainWindow.webContents.send('list:navigate', '/starred')
|
||||
}
|
||||
})
|
||||
|
||||
const trash = new TouchBarButton({
|
||||
label: '🗑',
|
||||
click: () => {
|
||||
mainWindow.webContents.send('list:navigate', '/trashed')
|
||||
}
|
||||
})
|
||||
|
||||
const newNote = new TouchBarButton({
|
||||
label: '✎',
|
||||
click: () => {
|
||||
mainWindow.webContents.send('list:navigate', '/home')
|
||||
mainWindow.webContents.send('top:new-note')
|
||||
}
|
||||
})
|
||||
|
||||
module.exports = new TouchBar([
|
||||
allNotes,
|
||||
starredNotes,
|
||||
trash,
|
||||
new TouchBarSpacer({size: 'small'}),
|
||||
newNote
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user