1
0
Fork 1
mirror of https://github.com/zen-browser/desktop.git synced 2025-07-10 18:15:30 +02:00

Added paltform specific preferences for themes

This commit is contained in:
Mauro Balades 2024-08-19 19:43:33 +02:00
parent ae723290d7
commit 26a9e255c1
3 changed files with 51 additions and 3 deletions

View file

@ -111,7 +111,7 @@
--input-border-color: var(--zen-input-border-color) !important;
--zen-themed-toolbar-bg: var(--zen-colors-tertiary);
--toolbar-field-background-color: var(--zen-colors-input-bg);
--toolbar-field-background-color: var(--zen-colors-input-bg) !important;
--arrowpanel-background: var(--zen-dialog-background) !important;
}

View file

@ -15,6 +15,12 @@ const kZenColors = [
"#d4bbff",
];
const kZenOSToSmallName = {
WINNT: "windows",
Darwin: "macos",
Linux: "linux",
};
var gZenMarketplaceManager = {
init() {
this._buildThemesList();
@ -70,12 +76,45 @@ var gZenMarketplaceManager = {
return this._themes;
},
get currentOperatingSystem() {
let os = Services.appinfo.OS;
return kZenOSToSmallName[os];
},
_getValidPreferences(preferences) {
for (let key in preferences) {
// [!][os:]key
let restOfPreferences = key;
let isNegation = false;
if (key.startsWith("!")) {
isNegation = true;
restOfPreferences = key.slice(1);
}
let os = "";
if (restOfPreferences.includes(":")) {
[os, restOfPreferences] = restOfPreferences.split(":");
}
if (isNegation && os === this.currentOperatingSystem) {
delete preferences[key];
} else if (os && os !== this.currentOperatingSystem) {
delete preferences[key];
} else {
// Change the key to contain only the rest of the preferences.
preferences[restOfPreferences] = preferences[key];
if (key !== restOfPreferences) {
delete preferences[key];
}
}
}
return preferences;
},
async _getThemePreferences(theme) {
const themePath = PathUtils.join(this.themesRootPath, theme.id, "preferences.json");
if (!(await IOUtils.exists(themePath)) || !theme.preferences) {
return {};
}
return await IOUtils.readJSON(themePath);
return this._getValidPreferences(await IOUtils.readJSON(themePath));
},
async _buildThemesList() {

View file

@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
index e9aa0f03c26dc26e1a2e56d28fadb70e60c8e8ca..9c209752b01bd07a3f38452da4bc8efc7433466c 100644
index e9aa0f03c26dc26e1a2e56d28fadb70e60c8e8ca..f66f9c168ab560e41ea9d03c2d0727e4a5c15132 100644
--- a/browser/components/tabbrowser/content/tabs.js
+++ b/browser/components/tabbrowser/content/tabs.js
@@ -552,19 +552,36 @@
@ -146,6 +146,15 @@ index e9aa0f03c26dc26e1a2e56d28fadb70e60c8e8ca..9c209752b01bd07a3f38452da4bc8efc
children.pop();
this._allTabs = children;
return children;
@@ -1386,7 +1430,7 @@
let tabsToReset = [];
for (let i = numPinned; i < tabs.length; i++) {
let tab = tabs[i];
- tab.style.setProperty("max-width", aTabWidth, "important");
+ //tab.style.setProperty("max-width", aTabWidth, "important");
if (!isEndTab) {
// keep tabs the same width
tab.style.transition = "none";
@@ -1476,11 +1520,11 @@
for (let i = numPinned - 1; i >= 0; i--) {
let tab = tabs[i];