Skip to content

Commit

Permalink
Hide native toolbar on macOS (#449)
Browse files Browse the repository at this point in the history
* Use a hidden title bar for macOS when running in electron. Some special styles are applied to add padding to the top bar.

* Add some top padding to the tags list and note info

* Removed unnecessary isElectron() call and made use of `matchesProperty`.

h/t @dmsnell
  • Loading branch information
roundhill authored Dec 2, 2016
1 parent 3a0fb8d commit d19a824
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
3 changes: 2 additions & 1 deletion desktop/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ module.exports = function main() {
height: 768,
minWidth: 370,
minHeight: 520,
icon: iconPath
icon: iconPath,
titleBarStyle: 'hidden'
} );

// and load the index of the app.
Expand Down
6 changes: 5 additions & 1 deletion lib/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
includes,
isObject,
map,
matchesProperty,
overEvery,
pick,
values,
Expand Down Expand Up @@ -99,6 +100,8 @@ const isElectron = ( () => {
return () => foundElectron;
} )();

const isElectronMac = () => matchesProperty( 'process.platform', 'darwin' )( window );

const includesSearch = ( text, search ) =>
( text || '' )
.toLocaleLowerCase()
Expand Down Expand Up @@ -490,7 +493,8 @@ export const App = connect( mapStateToProps, mapDispatchToProps )( React.createC
'note-open': selectedNote,
'note-info-open': state.showNoteInfo,
'navigation-open': state.showNavigation,
'is-electron': isElectron()
'is-electron': isElectron(),
'is-macos': isElectronMac()
} );

return (
Expand Down
18 changes: 18 additions & 0 deletions scss/general.scss
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,21 @@ a {
}
}

.is-macos {
.note-editor-controls {
box-sizing: border-box;
-webkit-app-region: drag;
padding: 40px 0 30px;
}

.search-bar {
padding: 40px 15px 30px;
box-sizing: border-box;
-webkit-app-region: drag;
}

.navigation, .note-info {
padding-top: 10px;
}
}

0 comments on commit d19a824

Please sign in to comment.