diff --git a/locales/language-maps b/locales/language-maps new file mode 100644 index 000000000..e12f62b15 --- /dev/null +++ b/locales/language-maps @@ -0,0 +1 @@ +nb:nb-NO \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index db79a9ecd..289e49bff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "MPL-2.0", "dependencies": { - "@zen-browser/surfer": "^1.12.0" + "@zen-browser/surfer": "^1.12.1" }, "devDependencies": { "@babel/preset-typescript": "^7.27.0", @@ -1115,9 +1115,9 @@ "license": "MIT" }, "node_modules/@zen-browser/surfer": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/@zen-browser/surfer/-/surfer-1.12.0.tgz", - "integrity": "sha512-I5nxDgGpFGtdOAC9DZkoQp9GJ4cAqCW+0p0DoQRjW/jdnQJUH20ygvPyPr+sgjXISPFclYX+KrVoT2kJqTdlTw==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@zen-browser/surfer/-/surfer-1.12.1.tgz", + "integrity": "sha512-0KoJtT9awH0ZxC1G5i3gppL8SEkgqeOqxAYY7B5WOgaPv4uUyHfj8btQnmLasA7051iVn9EaCpUDOHV1JDs9pg==", "license": "MPL-2.0", "dependencies": { "@resvg/resvg-js": "^1.4.0", diff --git a/package.json b/package.json index 963e0b0b2..07f9eda3a 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "sync:raw": "surfer update", "sync:rc": "python3 scripts/update_ff.py --rc", "sync:l10n": "python3 scripts/update_ff.py --just-l10n", - "pretty": "prettier . --write --cache && autopep8 -r --in-place scripts/ src/", + "pretty": "prettier . --write --cache && autopep8 -r --in-place scripts/ src/ --exclude */tests/*", "lint": "npx eslint src/ && prettier . --check --cache", "lint:fix": "npm run pretty && npx eslint src/ --fix", "prepare": "husky", @@ -50,7 +50,7 @@ }, "homepage": "https://github.com/zen-browser/desktop#readme", "dependencies": { - "@zen-browser/surfer": "^1.12.0" + "@zen-browser/surfer": "^1.12.1" }, "devDependencies": { "@babel/preset-typescript": "^7.27.0", diff --git a/scripts/copy_language_pack.py b/scripts/copy_language_pack.py index eb471b0bf..857cc55d8 100644 --- a/scripts/copy_language_pack.py +++ b/scripts/copy_language_pack.py @@ -10,13 +10,32 @@ import sys BROWSER_LOCALES = "engine/browser/locales" +def get_language_code(lang_id: str) -> str: + """ + Retrieves the language code from the language-maps file. + + :param lang_id: Language identifier (e.g., 'nb', 'fr', etc.) + :return: Corresponding language code (e.g., 'nb-NO', 'fr-FR', etc.) + """ + language_maps_path = os.path.join("locales", "language-maps") + if not os.path.exists(language_maps_path): + return lang_id # Return the original if the file doesn't exist + + with open(language_maps_path, "r", encoding="utf-8") as f: + for line in f: + if line.startswith(f"{lang_id}:"): + return line.split(":", 1)[1].strip() + return lang_id # Return the original if no mapping is found + + def copy_browser_locales(lang_id: str): """ Copies language pack files to the specified browser locale directory. :param lang_id: Language identifier (e.g., 'en-US', 'fr', etc.) """ - lang_path = os.path.join(BROWSER_LOCALES, lang_id) + lang_code = get_language_code(lang_id) + lang_path = os.path.join(BROWSER_LOCALES, lang_code) # Create the directory for the language pack if it doesn't exist os.makedirs(lang_path, exist_ok=True) diff --git a/scripts/download-language-packs.sh b/scripts/download-language-packs.sh index d14b78164..aa4633ef7 100644 --- a/scripts/download-language-packs.sh +++ b/scripts/download-language-packs.sh @@ -39,10 +39,20 @@ fi set -e -update_language() { +get_code_for_language() { + # Get the language code from locales/language-maps langId=$1 + code=$(grep "^$langId:" ./locales/language-maps | cut -d':' -f2) + if [ -z "$code" ]; then + code=$langId + fi + echo $code +} + +update_language() { + langId=$(get_code_for_language $1) cd ./locales - cd $langId + cd $1 echo "Updating $langId" # move the contents from ../firefox-l10n/$langId to ./locales/$langId diff --git a/src/browser/components/sessionstore/SessionStore-sys-mjs.patch b/src/browser/components/sessionstore/SessionStore-sys-mjs.patch index b66f67824..f354ceada 100644 --- a/src/browser/components/sessionstore/SessionStore-sys-mjs.patch +++ b/src/browser/components/sessionstore/SessionStore-sys-mjs.patch @@ -1,5 +1,5 @@ diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs -index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..1ab8d85dd39a6d5e3def0ee8a2e89bdd1ad3ca35 100644 +index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..450316b7e18852cc088479e9a5fb5832cee88ace 100644 --- a/browser/components/sessionstore/SessionStore.sys.mjs +++ b/browser/components/sessionstore/SessionStore.sys.mjs @@ -127,6 +127,8 @@ const TAB_EVENTS = [ @@ -133,11 +133,11 @@ index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..1ab8d85dd39a6d5e3def0ee8a2e89bdd // collect the data for all windows for (ix in this._windows) { - if (this._windows[ix]._restoring || this._windows[ix].isTaskbarTab) { -+ if (this._windows[ix]._restoring || this._windows[ix].isTaskbarTab || this._windows[ix].isZenUnsynced) { ++ if (this._windows[ix]._restoring || this._windows[ix].isTaskbarTab && !this._windows[ix].isZenUnsynced) { // window data is still in _statesToRestore continue; } -@@ -5625,11 +5650,16 @@ var SessionStoreInternal = { +@@ -5625,11 +5650,12 @@ var SessionStoreInternal = { } let tabbrowser = aWindow.gBrowser; @@ -147,15 +147,21 @@ index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..1ab8d85dd39a6d5e3def0ee8a2e89bdd let winData = this._windows[aWindow.__SSi]; let tabsData = (winData.tabs = []); -+ winData.activeZenSpace = aWindow.gZenWorkspaces?.activeWorkspace || null; + winData.splitViewData = aWindow.gZenViewSplitter?.storeDataForSessionStore(); -+ winData.folders = aWindow.gZenFolders?.storeDataForSessionStore() || []; -+ winData.spaces = aWindow.gZenWorkspaces?.getWorkspaces(); -+ // update the internal state data for this window for (let tab of tabs) { if (tab == aWindow.FirefoxViewHandler.tab) { -@@ -5652,7 +5682,7 @@ var SessionStoreInternal = { +@@ -5640,6 +5666,9 @@ var SessionStoreInternal = { + tabsData.push(tabData); + } + ++ winData.folders = aWindow.gZenFolders?.storeDataForSessionStore() || []; ++ winData.activeZenSpace = aWindow.gZenWorkspaces?.activeWorkspace || null; ++ winData.spaces = aWindow.gZenWorkspaces?.getWorkspaces(); + // update tab group state for this window + winData.groups = []; + for (let tabGroup of aWindow.gBrowser.tabGroups) { +@@ -5652,7 +5681,7 @@ var SessionStoreInternal = { // a window is closed, point to the first item in the tab strip instead (it will never be the Firefox View tab, // since it's only inserted into the tab strip after it's selected). if (aWindow.FirefoxViewHandler.tab?.selected) { @@ -164,7 +170,7 @@ index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..1ab8d85dd39a6d5e3def0ee8a2e89bdd winData.title = tabbrowser.tabs[0].label; } winData.selected = selectedIndex; -@@ -5765,8 +5795,8 @@ var SessionStoreInternal = { +@@ -5765,8 +5794,8 @@ var SessionStoreInternal = { // selectTab represents. let selectTab = 0; if (overwriteTabs) { @@ -175,6 +181,14 @@ index 2c2f43bf743ef458b378e85e9ed44a971711e1d9..1ab8d85dd39a6d5e3def0ee8a2e89bdd selectTab = Math.min(selectTab, winData.tabs.length); } +@@ -5788,6 +5817,7 @@ var SessionStoreInternal = { + if (overwriteTabs) { + for (let i = tabbrowser.browsers.length - 1; i >= 0; i--) { + if (!tabbrowser.tabs[i].selected) { ++ aWindow.gZenWorkspaces._shouldOverrideTabs = true; + tabbrowser.removeTab(tabbrowser.tabs[i]); + } + } @@ -5821,6 +5851,9 @@ var SessionStoreInternal = { savedTabGroup => !openTabGroupIdsInWindow.has(savedTabGroup.id) ); diff --git a/src/zen/split-view/ZenViewSplitter.mjs b/src/zen/split-view/ZenViewSplitter.mjs index 8fd03aa9a..cab32e721 100644 --- a/src/zen/split-view/ZenViewSplitter.mjs +++ b/src/zen/split-view/ZenViewSplitter.mjs @@ -1038,14 +1038,20 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature { let tab = window.gBrowser.getTabForBrowser(browser); const ignoreSplit = tab.hasAttribute('zen-dont-split-glance'); tab.removeAttribute('zen-dont-split-glance'); + let isGlanceTab = false; if (tab.hasAttribute('zen-glance-tab') && !ignoreSplit) { // Extract from parent node so we are not selecting the wrong (current) tab tab = tab.parentNode.closest('.tabbrowser-tab'); + isGlanceTab = true; console.assert(tab, 'Tab not found for zen-glance-tab'); } if (tab) { this.updateSplitView(tab); tab.linkedBrowser.docShellIsActive = true; + if (isGlanceTab) { + // See issues https://github.com/zen-browser/desktop/issues/11641 + this.removeSplitters(); + } } this._maybeRemoveFakeBrowser(); { @@ -1192,7 +1198,9 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature { const oldView = this.currentView; const newView = this._data.findIndex((group) => group.tabs.includes(tab)); - if (oldView === newView) return; + if (newView === oldView && oldView < 0) { + return; + } if (newView < 0 && oldView >= 0) { this.deactivateCurrentSplitView(); return; @@ -1980,40 +1988,43 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature { this._data.push(data); this.activateSplitView(data); gBrowser.selectedTab = emptyTab; - window.addEventListener( - 'ZenURLBarClosed', - (event) => { - const { onElementPicked, onSwitch } = event.detail; - const groupIndex = this._data.findIndex((group) => group.tabs.includes(emptyTab)); - const newSelectedTab = gBrowser.selectedTab; - const cleanup = () => { - this.removeTabFromGroup(emptyTab, groupIndex, { changeTab: !onSwitch, forUnsplit: true }); - const command = document.getElementById('cmd_zenNewEmptySplit'); - command.removeAttribute('disabled'); - }; - if (onElementPicked) { - if ( - newSelectedTab === emptyTab || - newSelectedTab === selectedTab || - selectedTab.getAttribute('zen-workspace-id') !== - newSelectedTab.getAttribute('zen-workspace-id') - ) { - cleanup(); - return; - } - this.removeTabFromGroup(emptyTab, groupIndex, { forUnsplit: true }); - gBrowser.selectedTab = selectedTab; - this.resetTabState(emptyTab, false); - this.splitTabs([selectedTab, newSelectedTab], 'grid', 1); - } else { - cleanup(); - } - }, - { once: true } - ); setTimeout(() => { + window.addEventListener( + 'ZenURLBarClosed', + (event) => { + const { onElementPicked, onSwitch } = event.detail; + const groupIndex = this._data.findIndex((group) => group.tabs.includes(emptyTab)); + const newSelectedTab = gBrowser.selectedTab; + const cleanup = () => { + this.removeTabFromGroup(emptyTab, groupIndex, { + changeTab: !onSwitch, + forUnsplit: true, + }); + const command = document.getElementById('cmd_zenNewEmptySplit'); + command.removeAttribute('disabled'); + }; + if (onElementPicked) { + if ( + newSelectedTab === emptyTab || + newSelectedTab === selectedTab || + selectedTab.getAttribute('zen-workspace-id') !== + newSelectedTab.getAttribute('zen-workspace-id') + ) { + cleanup(); + return; + } + this.removeTabFromGroup(emptyTab, groupIndex, { forUnsplit: true }); + gBrowser.selectedTab = selectedTab; + this.resetTabState(emptyTab, false); + this.splitTabs([selectedTab, newSelectedTab], 'grid', 1); + } else { + cleanup(); + } + }, + { once: true } + ); gZenUIManager.handleNewTab(false, false, 'tab', true); - }, 0); + }); } get splitViewBrowsers() { diff --git a/src/zen/split-view/zen-decks.css b/src/zen/split-view/zen-decks.css index 9c4ff3f3a..6678a395f 100644 --- a/src/zen/split-view/zen-decks.css +++ b/src/zen/split-view/zen-decks.css @@ -67,7 +67,7 @@ #tabbrowser-tabpanels[zen-split-view='true'] .browserSidebarContainer.deck-selected { &:not(.zen-glance-overlay) { - outline: 2px solid var(--zen-primary-color) !important; + outline: 2px solid light-dark(var(--zen-primary-color), var(--button-background-color-primary)) !important; } &.zen-glance-overlay { diff --git a/src/zen/tabs/zen-tabs/vertical-tabs.css b/src/zen/tabs/zen-tabs/vertical-tabs.css index 5414b54db..d28936b74 100644 --- a/src/zen/tabs/zen-tabs/vertical-tabs.css +++ b/src/zen/tabs/zen-tabs/vertical-tabs.css @@ -141,7 +141,10 @@ position: relative; opacity: 1; align-items: center; - padding: 0 5px; + + @media (-moz-platform: macos) { + padding: 0 5px; + } & toolbarseparator { height: 1px; diff --git a/src/zen/workspaces/ZenWorkspaces.mjs b/src/zen/workspaces/ZenWorkspaces.mjs index 0b78e8359..57ea9dfc3 100644 --- a/src/zen/workspaces/ZenWorkspaces.mjs +++ b/src/zen/workspaces/ZenWorkspaces.mjs @@ -912,6 +912,7 @@ class nsZenWorkspaces { const cleanup = () => { delete this._tabToSelect; delete this._tabToRemoveForEmpty; + delete this._shouldOverrideTabs; resolveSelectPromise(); }; @@ -927,7 +928,7 @@ class nsZenWorkspaces { delete this._initialTab; } - if (this._tabToRemoveForEmpty && !removedEmptyTab) { + if (this._tabToRemoveForEmpty && !removedEmptyTab && !this._shouldOverrideTabs) { const tabs = gBrowser.tabs.filter((tab) => !tab.collapsed); if ( typeof this._tabToSelect === 'number' &&