Skip to content

Commit

Permalink
🍎 Improve 'Toggle Fullscreen' functionality on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
tterb committed Nov 20, 2017
1 parent ff417a4 commit 5c53c4a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions assets/js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ var updateWindowTitle = (path) => {
filename,
title;
if(path) {
title = appName + ' - ' + path.toString();
title = path.toString().replace(os.homedir(),'~');
filename = parsePath(path).basename;
} else {
title = appName;
Expand All @@ -147,6 +147,8 @@ var updateWindowTitle = (path) => {
};

function toggleMaximize() {
if(process.platform === 'darwin')
toggleFullScreen();
var window = electron.remote.getCurrentWindow();
if(window.isMaximized()) {
window.unmaximize();
Expand All @@ -157,6 +159,17 @@ function toggleMaximize() {
}
}

function toggleFullScreen() {
var window = electron.remote.getCurrentWindow();
if(window.isFullScreen()) {
window.setFullScreen(false);
settings.set('isMaximized', false);
} else {
window.setFullScreen(true);
settings.set('isMaximized', true);
}
}

function toggleSearch(opt) {
var dialog = $('#search-container'),
searchBar = $('.CodeMirror-dialog-top');
Expand All @@ -168,7 +181,7 @@ function toggleSearch(opt) {
cm.execCommand('replace');
else return;
}
}
}

function appendCustomCSS() {
var input = $('#custom-css').val();
Expand Down

0 comments on commit 5c53c4a

Please sign in to comment.