Skip to content

Commit

Permalink
Added different transparency modes for macos and stopped initializing…
Browse files Browse the repository at this point in the history
… workspaces on closed windows
  • Loading branch information
mauro-balades committed Feb 27, 2025
1 parent 7585514 commit a409016
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 20 deletions.
8 changes: 8 additions & 0 deletions src/browser/app/profile/zen-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,14 @@ pref('browser.download.autohideButton', false);
// Enable transparent background for macos
#ifdef XP_MACOSX
pref('widget.macos.titlebar-blend-mode.behind-window', true);
// 1. hudWindow
// 2. fullScreenUI
// 3. popover
// 4. menu
// 5. toolTip
// 6. headerView
// 7. underlay
pref('zen.widget.macos.window-material', 7);
#endif

// Urlbar and autocomplete
Expand Down
18 changes: 10 additions & 8 deletions src/browser/base/zen-components/ZenCompactMode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,16 @@ var gZenCompactModeManager = {
}
)
.then(() => {
this.sidebar.removeAttribute('animate');
this.sidebar.style.removeProperty('margin-right');
this.sidebar.style.removeProperty('margin-left');
this.sidebar.style.removeProperty('transform');
this.sidebar.style.transition = 'none';
setTimeout(() => {
this._animating = false;
this.sidebar.style.removeProperty('transition');
window.requestAnimationFrame(() => {
this.sidebar.removeAttribute('animate');
this.sidebar.style.removeProperty('margin-right');
this.sidebar.style.removeProperty('margin-left');
this.sidebar.style.removeProperty('transform');
this.sidebar.style.transition = 'none';
setTimeout(() => {
this._animating = false;
this.sidebar.style.removeProperty('transition');
});
});
});
} else if (canHideSidebar && !isCompactMode) {
Expand Down
18 changes: 12 additions & 6 deletions src/browser/base/zen-components/ZenWorkspaces.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
if (typeof this._workspaceEnabled === 'undefined') {
this._workspaceEnabled =
!Services.prefs.getBoolPref('zen.workspaces.disabled_for_testing', false) && this.shouldHaveWorkspaces;
return this._workspaceEnabled;
}
return this._workspaceEnabled;
return this._workspaceEnabled && !window.closed;
}

getActiveWorkspaceFromCache() {
Expand Down Expand Up @@ -591,6 +590,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
console.error('ZenWorkspaces: Error initializing theme picker', e);
}
this._selectStartPage();
this._fixTabPositions();
}
}

Expand Down Expand Up @@ -1538,10 +1538,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}

_moveEmptyTabToWorkspace(workspaceUuid) {
const emptyTab = this._emptyTab;
if (emptyTab) {
this.moveTabToWorkspace(emptyTab, workspaceUuid);
}
this._makeSureEmptyTabIsLast();
}

_makeSureEmptyTabIsLast() {
Expand All @@ -1552,6 +1549,15 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
container.insertBefore(emptyTab, container.lastChild);
}
}
this._fixTabPositions();
}

_fixTabPositions() {
// Fix tabs _tPos values relative to the actual order
const tabs = gBrowser.tabs;
for (let i = 0; i < tabs.length; i++) {
tabs[i]._tPos = i;
}
}

_updateMarginTopPinnedTabs(arrowscrollbox, pinnedContainer) {
Expand Down
12 changes: 9 additions & 3 deletions src/modules/libpref/init/StaticPrefList-yaml.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
index ce2393978f77f55f42ae9b97e5d40328ce8eaae4..a426679de76c2d172974ec87f5fe48e22d5ab7b0 100644
index a9863858f9a28b2c633edd9689d4379203eef1e6..a0c121d934313f272ade1061146fbc4b96e2ddda 100644
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -18060,7 +18060,7 @@
@@ -18305,7 +18305,7 @@
# Whether we use the mica backdrop. Off by default for now.
- name: widget.windows.mica
type: bool
Expand All @@ -11,7 +11,7 @@ index ce2393978f77f55f42ae9b97e5d40328ce8eaae4..a426679de76c2d172974ec87f5fe48e2
mirror: once
#endif

@@ -18173,6 +18173,19 @@
@@ -18418,6 +18418,25 @@
mirror: always
#endif

Expand All @@ -21,6 +21,12 @@ index ce2393978f77f55f42ae9b97e5d40328ce8eaae4..a426679de76c2d172974ec87f5fe48e2
+ value: true
+ mirror: never
+
+#ifdef XP_MACOSX
+- name: zen.widget.macos.window-material
+ type: uint32_t
+ value: 0
+ mirror: once
+
+#ifdef XP_WIN
+- name: zen.widget.windows.acrylic
+ type: bool
Expand Down
30 changes: 27 additions & 3 deletions src/widget/cocoa/VibrancyManager-mm.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
diff --git a/widget/cocoa/VibrancyManager.mm b/widget/cocoa/VibrancyManager.mm
index e8263ee480a0249cae760ee5b9037bb87acafecc..aefc887208659e46191eebfde1f9f74f1eac77a5 100644
index 849b62c9976a7bc5fee35e074e54c8f556ed9c38..92ddc9022055f518cb371d64e8e644c4b3ada798 100644
--- a/widget/cocoa/VibrancyManager.mm
+++ b/widget/cocoa/VibrancyManager.mm
@@ -39,7 +39,7 @@ static NSVisualEffectMaterial VisualEffectMaterialForVibrancyType(
@@ -13,6 +13,7 @@

#include "nsChildView.h"
#include "mozilla/StaticPrefs_widget.h"
+#include "mozilla/StaticPrefs_zen.h"

using namespace mozilla;

@@ -40,7 +41,23 @@ static NSVisualEffectMaterial VisualEffectMaterialForVibrancyType(
case VibrancyType::Sidebar:
return NSVisualEffectMaterialSidebar;
case VibrancyType::Titlebar:
- return NSVisualEffectMaterialTitlebar;
+ return NSVisualEffectMaterialUnderWindowBackground;
+ switch (StaticPrefs::zen_widget_macos_window_material_AtStartup()) {
+ case 1:
+ return NSVisualEffectMaterialHUDWindow;
+ case 2:
+ return NSVisualEffectMaterialFullScreenUI;
+ case 3:
+ return NSVisualEffectMaterialPopover;
+ case 4:
+ return NSVisualEffectMaterialMenu;
+ case 5:
+ return NSVisualEffectMaterialToolTip;
+ case 6:
+ return NSVisualEffectMaterialHeaderView;
+ case 7:
+ default:
+ return NSVisualEffectMaterialUnderWindowBackground;
+ }
}
}

0 comments on commit a409016

Please sign in to comment.