From 1c7c6b2a0f13c263105c59d86c4aac34343bd5ce Mon Sep 17 00:00:00 2001 From: "mr. M" Date: Sun, 10 Nov 2024 18:20:23 +0100 Subject: [PATCH] Enhance Zen animations and glance functionality with improved styles and closing behavior --- .../base/content/zen-styles/zen-animations.css | 6 +++--- .../base/content/zen-styles/zen-glance.css | 16 ++++++++-------- .../base/zen-components/ZenGlanceManager.mjs | 1 + .../zen-components/actors/ZenGlanceChild.sys.mjs | 7 ++++++- .../tabbrowser/content/tabbrowser-js.patch | 11 ++++++++++- 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/browser/base/content/zen-styles/zen-animations.css b/src/browser/base/content/zen-styles/zen-animations.css index 4dc7618a7..576c38d21 100644 --- a/src/browser/base/content/zen-styles/zen-animations.css +++ b/src/browser/base/content/zen-styles/zen-animations.css @@ -256,7 +256,7 @@ top: 50%; left: 50%; width: 87%; - height: 87%; + height: calc(102% + 10px); } 100% { @@ -264,7 +264,7 @@ transform: translate(-50%, -50%) translateZ(0); opacity: 1; width: 85%; - height: 85%; + height: calc(100% + 10px); top: 50%; left: 50%; } @@ -287,7 +287,7 @@ transform: translate(-50%, -50%); opacity: 1; width: 85%; - height: 85%; + height: calc(100% + 10px); top: 50%; left: 50%; } diff --git a/src/browser/base/content/zen-styles/zen-glance.css b/src/browser/base/content/zen-styles/zen-glance.css index 37fa1824e..9daa03c05 100644 --- a/src/browser/base/content/zen-styles/zen-glance.css +++ b/src/browser/base/content/zen-styles/zen-glance.css @@ -9,11 +9,11 @@ } #tabbrowser-tabpanels:has(.zen-glance-background) { - transform: scale(0.99); + transform: scale(0.97); backdrop-filter: blur(5px); & .zen-glance-background { - opacity: 0.8; + opacity: 0.6; transition: opacity 0.1s ease-in-out; } } @@ -32,7 +32,7 @@ opacity: 1; & .browserContainer { - animation: zen-glance-content-animation-out .3s ease-in-out forwards !important; + animation: zen-glance-content-animation-out .2s ease-in-out forwards !important; animation-direction: reverse !important; & browser { @@ -66,7 +66,7 @@ transition: 0s !important; transform: none !important; margin: auto !important; - top: 0 !important; + top: -5px !important; left: 0 !important; } @@ -105,13 +105,13 @@ width: 100%; height: 100%; opacity: 1; - transition: opacity 0.3s ease-in-out; - transition-delay: 0.2s; + transition: opacity 0.2s ease-in-out; + transition-delay: 0.1s; } &[animate-full='true'] { opacity: 1; - animation: zen-glance-buttons-animation-full 0.3s ease-in-out forwards !important; + animation: zen-glance-buttons-animation-full 0.2s ease-in-out forwards !important; & #zen-glance-sidebar-container { opacity: 0 !important; @@ -119,7 +119,7 @@ } &[animate='true'] { - animation: zen-glance-content-animation .4s ease-in-out forwards; + animation: zen-glance-content-animation .3s ease-in-out forwards; animation-delay: 0.1s; &:not([animate-end='true']) { diff --git a/src/browser/base/zen-components/ZenGlanceManager.mjs b/src/browser/base/zen-components/ZenGlanceManager.mjs index 26b723bfd..45423e846 100644 --- a/src/browser/base/zen-components/ZenGlanceManager.mjs +++ b/src/browser/base/zen-components/ZenGlanceManager.mjs @@ -189,6 +189,7 @@ this.contentWrapper = null; this.lastCurrentTab.removeAttribute("zen-glance-tab"); + this.lastCurrentTab._closingGlance = true; gBrowser.tabContainer._invalidateCachedTabs(); gBrowser.removeTab(this.lastCurrentTab, { animate: true }); diff --git a/src/browser/base/zen-components/actors/ZenGlanceChild.sys.mjs b/src/browser/base/zen-components/actors/ZenGlanceChild.sys.mjs index 836558fe1..fc6c6eca5 100644 --- a/src/browser/base/zen-components/actors/ZenGlanceChild.sys.mjs +++ b/src/browser/base/zen-components/actors/ZenGlanceChild.sys.mjs @@ -56,9 +56,14 @@ export class ZenGlanceChild extends JSWindowActorChild { } openGlance(target) { + let url = target.href; + // Add domain to relative URLs + if (!url.match(/^(?:[a-z]+:)?\/\//i)) { + url = this.contentWindow.location.origin + url; + } const rect = target.getBoundingClientRect(); this.sendAsyncMessage('ZenGlance:OpenGlance', { - url: target.href, + url, x: rect.left, y: rect.top, width: rect.width, diff --git a/src/browser/components/tabbrowser/content/tabbrowser-js.patch b/src/browser/components/tabbrowser/content/tabbrowser-js.patch index 6c33d9e97..d88020037 100644 --- a/src/browser/components/tabbrowser/content/tabbrowser-js.patch +++ b/src/browser/components/tabbrowser/content/tabbrowser-js.patch @@ -1,5 +1,5 @@ diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js -index 14de79b543cf07b04d06ef5a3f94d9aa988ea39a..af0f2a13e957331d48643fe4430408924c55b08c 100644 +index 14de79b543cf07b04d06ef5a3f94d9aa988ea39a..d2cd8709007b6d36b055ffff45b103a55f8656ee 100644 --- a/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js @@ -462,11 +462,26 @@ @@ -195,6 +195,15 @@ index 14de79b543cf07b04d06ef5a3f94d9aa988ea39a..af0f2a13e957331d48643fe443040892 if ( !this._beginRemoveTab(aTab, { closeWindowFastpath: true, +@@ -4311,7 +4384,7 @@ + + var closeWindow = false; + var newTab = false; +- if (aTab.visible && this.visibleTabs.length == 1) { ++ if (aTab.visible && this.visibleTabs.length == 1 && !aTab._closingGlance) { + closeWindow = + closeWindowWithLastTab != null + ? closeWindowWithLastTab @@ -5123,10 +5196,10 @@ SessionStore.deleteCustomTabValue(aTab, "hiddenBy"); },