Added support for macos monochrome titlebar buttons, on by default

This commit is contained in:
mr. m
2025-02-15 18:37:13 +01:00
committed by mr. m
parent a6ec05da49
commit 3da54549ea
5 changed files with 32 additions and 41 deletions

View File

@@ -143,6 +143,7 @@ pref('zen.view.sidebar-expanded.max-width', 500);
#ifdef XP_MACOSX
pref('zen.view.mac.show-three-dot-menu', false);
pref('zen.widget.mac.mono-window-controls', true);
#endif
pref('zen.view.show-bottom-border', false);
pref('zen.view.use-single-toolbar', true);

View File

@@ -152,12 +152,32 @@
gap: var(--zen-element-separation);
}
.titlebar-buttonbox-container {
height: 100%;
@media not (-moz-platform: macos) {
.titlebar-buttonbox-container {
height: 100%;
}
}
@media (-moz-platform: macos) {
.titlebar-buttonbox-container {
margin-inline-end: 8px;
& > .titlebar-buttonbox {
margin-inline-start: var(--zen-toolbox-padding);
}
}
@media (-moz-bool-pref: 'zen.widget.mac.mono-window-controls') {
.titlebar-buttonbox-container {
/* Draw 3 dots as background to represent the window controls,
all with the same cololr as the titlebar */
background-image: radial-gradient(circle, #4d4c4a 6px, transparent 0.5px);
background-size: 20px 22px;
background-position: 52% 50%;
&:not([zen-has-hover='true']) > .titlebar-buttonbox {
opacity: 0;
}
}
}
}

View File

@@ -292,6 +292,9 @@ var gZenCompactModeManager = {
element: document.getElementById('zen-appcontent-navbar-container'),
screenEdge: 'top',
},
{
element: gZenVerticalTabsManager.actualWindowButtons,
}
];
},
@@ -336,8 +339,9 @@ var gZenCompactModeManager = {
target.addEventListener('mouseleave', (event) => {
// If on Mac, ignore mouseleave in the area of window buttons
if (AppConstants.platform == 'macosx') {
const MAC_WINDOW_BUTTONS_X_BORDER = 75;
const MAC_WINDOW_BUTTONS_Y_BORDER = 40;
const buttonRect = gZenVerticalTabsManager.actualWindowButtons.getBoundingClientRect();
const MAC_WINDOW_BUTTONS_X_BORDER = buttonRect.width + buttonRect.x;
const MAC_WINDOW_BUTTONS_Y_BORDER = buttonRect.height + buttonRect.y;
if (event.clientX < MAC_WINDOW_BUTTONS_X_BORDER && event.clientY < MAC_WINDOW_BUTTONS_Y_BORDER) {
return;
}

View File

@@ -1,8 +1,8 @@
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index 7364514f74703184462e8dbce3f0aafc3f850a3d..560671beddf6c216e918a47bd5dbd4e770a24ec7 100644
index ce2393978f77f55f42ae9b97e5d40328ce8eaae4..a426679de76c2d172974ec87f5fe48e22d5ab7b0 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -18067,7 +18067,7 @@
@@ -18060,7 +18060,7 @@
# Whether we use the mica backdrop. Off by default for now.
- name: widget.windows.mica
type: bool
@@ -11,7 +11,7 @@ index 7364514f74703184462e8dbce3f0aafc3f850a3d..560671beddf6c216e918a47bd5dbd4e7
mirror: once
#endif
@@ -18180,6 +18180,26 @@
@@ -18173,6 +18173,19 @@
mirror: always
#endif
@@ -21,13 +21,6 @@ index 7364514f74703184462e8dbce3f0aafc3f850a3d..560671beddf6c216e918a47bd5dbd4e7
+ value: true
+ mirror: never
+
+#ifdef XP_MACOSX
+- name: zen.widget.mac.mono-window-controls
+ type: RelaxedAtomicBool
+ value: false
+ mirror: always
+#endif
+
+#ifdef XP_WIN
+- name: zen.widget.windows.acrylic
+ type: bool

View File

@@ -1,27 +0,0 @@
diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm
index f1c87dd8faef8c6caf9248ce7d9f40c12f5db9f6..f5280b8fc6cf46d3941d1ff04835b12dd2755170 100644
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -51,6 +51,7 @@
#include "mozilla/ScopeExit.h"
#include "mozilla/StaticPrefs_gfx.h"
#include "mozilla/StaticPrefs_widget.h"
+#include "mozilla/StaticPrefs_zen.h"
#include "mozilla/WritingModes.h"
#include "mozilla/layers/CompositorBridgeChild.h"
#include "mozilla/widget/Screen.h"
@@ -682,9 +683,11 @@ static unsigned int WindowMaskForBorderStyle(BorderStyle aBorderStyle) {
continue;
}
NSWindow* win = ancestor->GetCocoaWindow();
- [[win standardWindowButton:NSWindowCloseButton] setEnabled:!aModal];
- [[win standardWindowButton:NSWindowMiniaturizeButton] setEnabled:!aModal];
- [[win standardWindowButton:NSWindowZoomButton] setEnabled:!aModal];
+
+ auto zenBtnEnabled = StaticPrefs::zen_widget_mac_mono_window_controls() ? false : !aModal;
+ [[win standardWindowButton:NSWindowCloseButton] setEnabled:zenBtnEnabled];
+ [[win standardWindowButton:NSWindowMiniaturizeButton] setEnabled:zenBtnEnabled];
+ [[win standardWindowButton:NSWindowZoomButton] setEnabled:zenBtnEnabled];
}
if (aModal) {
mWindow.level = NSModalPanelWindowLevel;