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:
parent
ae723290d7
commit
26a9e255c1
3 changed files with 51 additions and 3 deletions
|
@ -111,7 +111,7 @@
|
||||||
--input-border-color: var(--zen-input-border-color) !important;
|
--input-border-color: var(--zen-input-border-color) !important;
|
||||||
--zen-themed-toolbar-bg: var(--zen-colors-tertiary);
|
--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;
|
--arrowpanel-background: var(--zen-dialog-background) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,12 @@ const kZenColors = [
|
||||||
"#d4bbff",
|
"#d4bbff",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const kZenOSToSmallName = {
|
||||||
|
WINNT: "windows",
|
||||||
|
Darwin: "macos",
|
||||||
|
Linux: "linux",
|
||||||
|
};
|
||||||
|
|
||||||
var gZenMarketplaceManager = {
|
var gZenMarketplaceManager = {
|
||||||
init() {
|
init() {
|
||||||
this._buildThemesList();
|
this._buildThemesList();
|
||||||
|
@ -70,12 +76,45 @@ var gZenMarketplaceManager = {
|
||||||
return this._themes;
|
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) {
|
async _getThemePreferences(theme) {
|
||||||
const themePath = PathUtils.join(this.themesRootPath, theme.id, "preferences.json");
|
const themePath = PathUtils.join(this.themesRootPath, theme.id, "preferences.json");
|
||||||
if (!(await IOUtils.exists(themePath)) || !theme.preferences) {
|
if (!(await IOUtils.exists(themePath)) || !theme.preferences) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return await IOUtils.readJSON(themePath);
|
return this._getValidPreferences(await IOUtils.readJSON(themePath));
|
||||||
},
|
},
|
||||||
|
|
||||||
async _buildThemesList() {
|
async _buildThemesList() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
|
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
|
--- a/browser/components/tabbrowser/content/tabs.js
|
||||||
+++ b/browser/components/tabbrowser/content/tabs.js
|
+++ b/browser/components/tabbrowser/content/tabs.js
|
||||||
@@ -552,19 +552,36 @@
|
@@ -552,19 +552,36 @@
|
||||||
|
@ -146,6 +146,15 @@ index e9aa0f03c26dc26e1a2e56d28fadb70e60c8e8ca..9c209752b01bd07a3f38452da4bc8efc
|
||||||
children.pop();
|
children.pop();
|
||||||
this._allTabs = children;
|
this._allTabs = children;
|
||||||
return 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 @@
|
@@ -1476,11 +1520,11 @@
|
||||||
for (let i = numPinned - 1; i >= 0; i--) {
|
for (let i = numPinned - 1; i >= 0; i--) {
|
||||||
let tab = tabs[i];
|
let tab = tabs[i];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue