Added monochrome preference to macos window buttons

This commit is contained in:
mr. m
2025-01-28 21:18:03 +01:00
parent 67a6d9c844
commit c004cd47f0
3 changed files with 33 additions and 1929 deletions

1927
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,20 @@
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index c63a259a51c4862bc8f73eabdc5730bfe2f28da4..f9b8431071e73ce55972c12354ed44bc3a4df9c0 100644
index 5c5992d7b32e4c16d6a92815ca6fd54e8fcec824..03d3ae7af3addf76a3f4a79b49b7560aa5431e31 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -17651,7 +17651,7 @@
@@ -17384,6 +17384,11 @@
value: false
mirror: always
+- name: zen.widget.mac.mono-window-controls
+ type: RelaxedAtomicBool
+ value: true
+ mirror: always
+
#ifdef XP_MACOSX
# Whether to shift by the menubar height on fullscreen mode.
@@ -17810,7 +17815,7 @@
# Whether we use the mica backdrop. Off by default for now.
- name: widget.windows.mica
type: bool

View File

@@ -0,0 +1,19 @@
diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm
index f1c87dd8faef8c6caf9248ce7d9f40c12f5db9f6..6057495421c8cfe05a2dc83f21ee4353c8ad9958 100644
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -682,9 +682,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;