From 4a1b881dc2193c33cdc471a811974fb346e8e170 Mon Sep 17 00:00:00 2001 From: matt1 Date: Sun, 5 Aug 2018 18:08:09 +0100 Subject: [PATCH] Full-height tabs in maximised win32 windows Makes sure that tabs on maximised win32 windows go all the way to the top (like they do in Chrome, Firefox, Edge). This hugely improves usability since you cannot overshoot the tab. --- app/background-process/ui/windows.js | 2 ++ app/shell-window/ui.js | 2 ++ app/stylesheets/shell-window/chrome-tabs.less | 15 +++++++++++++-- app/stylesheets/shell-window/toolbar.less | 5 +++++ app/stylesheets/shell-window/win32-titlebar.less | 11 +++++++++++ 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/app/background-process/ui/windows.js b/app/background-process/ui/windows.js index 49d814c3aa..8b2af20d8b 100644 --- a/app/background-process/ui/windows.js +++ b/app/background-process/ui/windows.js @@ -189,6 +189,8 @@ export function createShellWindow (windowState) { unregisterShortcut(win, 'Esc') sendToWebContents('leave-full-screen')(e) }) + win.on('maximize', sendToWebContents('maximize')) + win.on('unmaximize', sendToWebContents('unmaximize')) win.on('closed', onClosed(win)) return win diff --git a/app/shell-window/ui.js b/app/shell-window/ui.js index e869852ac3..a8e0b5a922 100644 --- a/app/shell-window/ui.js +++ b/app/shell-window/ui.js @@ -61,6 +61,8 @@ function onWindowEvent (event, type) { break case 'enter-full-screen': return document.body.classList.add('fullscreen') case 'leave-full-screen': return document.body.classList.remove('fullscreen') + case 'maximize': return document.body.classList.add('maximized') + case 'unmaximize': return document.body.classList.remove('maximized') case 'leave-page-full-screen': pages.leavePageFullScreen() } } diff --git a/app/stylesheets/shell-window/chrome-tabs.less b/app/stylesheets/shell-window/chrome-tabs.less index d637f36791..948fd17b14 100644 --- a/app/stylesheets/shell-window/chrome-tabs.less +++ b/app/stylesheets/shell-window/chrome-tabs.less @@ -257,8 +257,8 @@ body.darwin .chrome-tabs { -webkit-app-region: drag; } -// make room for resizing on the top -body.win32 { +// make room for resizing on the top when not maximized. +body:not(.maximized).win32{ .chrome-tabs-shell { padding-top: 4px; } @@ -272,6 +272,17 @@ body.win32 { } } +// Ensure tabs go right to top of screen when maximized on win32. +body.maximized.win32 { + .chrome-tab { + top: 0px; + } + + .chrome-tabs-shell { + height: 30px; + } +} + // make room for the traffic lights .darwin:not(.fullscreen) .chrome-tabs { padding-left: 75px; diff --git a/app/stylesheets/shell-window/toolbar.less b/app/stylesheets/shell-window/toolbar.less index d14e0a473f..8d3ee1303f 100644 --- a/app/stylesheets/shell-window/toolbar.less +++ b/app/stylesheets/shell-window/toolbar.less @@ -22,6 +22,11 @@ body.fullscreen #toolbar { background: #e0e0e0; } +// Ensure toolbar resizes correctly when maximized on win32. +body.maximized.win32 { + height: 68px; +} + .download-started-animation { position: fixed; bottom: 20px; diff --git a/app/stylesheets/shell-window/win32-titlebar.less b/app/stylesheets/shell-window/win32-titlebar.less index 450b0bda01..9151ec9ebb 100644 --- a/app/stylesheets/shell-window/win32-titlebar.less +++ b/app/stylesheets/shell-window/win32-titlebar.less @@ -61,4 +61,15 @@ } body.win32 #win32-titlebar { display: flex; +} + +// Ensure that the controls are properly sized when maximized. +body.maximized.win32 { + #win32-titlebar { + height: 30px; + } + + #win32-titlebar .win32-titlebar-close:after { + line-height: 30px; + } } \ No newline at end of file