-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Window Controls Overlay #8707
Changes from 9 commits
2f1c388
e38b826
f10b8c0
4edc0be
d2bdb55
539c213
9c86376
9638be5
af515e0
2fa612f
8af3c95
c501f54
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,12 +94,19 @@ export class Window { | |
} else { | ||
if (process.platform === 'darwin') { | ||
bwOptions.titleBarStyle = 'hidden' | ||
// If not macOS and native appearance is not toggled, use WCO. | ||
} else { | ||
bwOptions.titleBarStyle = 'hidden' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can be moved out of the |
||
bwOptions.titleBarOverlay = { | ||
color: '#00000000', | ||
} | ||
} | ||
} | ||
|
||
if (process.platform === 'darwin') { | ||
this.window = new BrowserWindow(bwOptions) as GlasstronWindow | ||
} else { | ||
// this.window = new BrowserWindow(bwOptions) as GlasstronWindow | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please clean up commented code across the PR |
||
this.window = new glasstron.BrowserWindow(bwOptions) | ||
} | ||
|
||
|
@@ -186,6 +193,7 @@ export class Window { | |
} catch (error) { | ||
console.error('Failed to set window blur', error) | ||
} | ||
// } | ||
} else { | ||
DwmEnableBlurBehindWindow(this.window.getNativeWindowHandle(), enabled) | ||
} | ||
|
@@ -384,6 +392,23 @@ export class Window { | |
this.setVibrancy(enabled, type) | ||
}) | ||
|
||
ipcMain.on('window-set-window-controls-color', (event, theme) => { | ||
if (!this.window || event.sender !== this.window.webContents) { | ||
return | ||
} | ||
|
||
// let color: string = theme.backgroundMore | ||
const symbolColor: string = theme.foreground | ||
|
||
this.window.setTitleBarOverlay( | ||
{ | ||
// color: '#00000000', | ||
symbolColor: symbolColor, | ||
height: 32, | ||
}, | ||
) | ||
}) | ||
|
||
ipcMain.on('window-set-title', (event, title) => { | ||
if (!this.window || event.sender !== this.window.webContents) { | ||
return | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
title-bar( | ||
*ngIf='ready && !hostWindow.isFullscreen && config.store.appearance.frame == "full" && config.store.appearance.dock == "off"', | ||
(dblclick)='hostWindow.toggleMaximize()', | ||
[class.hide-controls]='hostApp.platform !== Platform.Linux && !hostWindow.isFullscreen', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be controlled via an @input on TitleBarComponent, not a class There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in the latest commit, window controls in the titlebar component is an ngIf now ✨ |
||
[class.inset]='hostApp.platform == Platform.macOS && !hostWindow.isFullscreen' | ||
) | ||
|
||
.content( | ||
*ngIf='ready', | ||
[class.tabs-on-top]='config.store.appearance.tabsLocation == "top" || config.store.appearance.tabsLocation == "left"', | ||
[class.tabs-on-side]='hasVerticalTabs()', | ||
[class.tabs-on-left]='hasVerticalTabs() && config.store.appearance.tabsLocation == "left"', | ||
[class.tabs-titlebar-enabled]='config.store.appearance.frame == "full"', | ||
[class.tabs-on-right]='hasVerticalTabs() && config.store.appearance.tabsLocation == "right"', | ||
) | ||
.tab-bar( | ||
*ngIf='!hostWindow.isFullscreen || config.store.appearance.tabsInFullscreen', | ||
[class.tab-bar-no-controls-overlay]='hostApp.platform == Platform.macOS', | ||
(dblclick)='hostWindow.toggleMaximize()' | ||
) | ||
.inset.background(*ngIf='hostApp.platform == Platform.macOS \ | ||
|
@@ -81,9 +85,12 @@ title-bar( | |
|
||
window-controls.background( | ||
*ngIf='config.store.appearance.frame == "thin" \ | ||
&& (hostApp.platform == Platform.Windows || hostApp.platform == Platform.Linux)', | ||
&& (hostApp.platform == Platform.Linux)', | ||
) | ||
|
||
div.window-controls-spacer( | ||
*ngIf='config.store.appearance.frame == "thin" && (hostApp.platform == Platform.Windows) && (config.store.appearance.tabsLocation == "top")', | ||
) | ||
.content | ||
start-page.content-tab.content-tab-active(*ngIf='ready && app.tabs.length == 0') | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does WCO work on Linux? This code path implies it does, the comment in titleBar.component.scss implies it doesn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't, but good catch, will fix