mirror of
https://github.com/zen-browser/desktop.git
synced 2026-01-06 05:17:51 +00:00
Merge branch 'dev' into window-sync
This commit is contained in:
1
locales/language-maps
Normal file
1
locales/language-maps
Normal file
@@ -0,0 +1 @@
|
||||
nb:nb-NO
|
||||
8
package-lock.json
generated
8
package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -141,7 +141,10 @@
|
||||
position: relative;
|
||||
opacity: 1;
|
||||
align-items: center;
|
||||
padding: 0 5px;
|
||||
|
||||
@media (-moz-platform: macos) {
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
& toolbarseparator {
|
||||
height: 1px;
|
||||
|
||||
@@ -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' &&
|
||||
|
||||
Reference in New Issue
Block a user