Skip to content

Commit

Permalink
chore: zen compatibility update
Browse files Browse the repository at this point in the history
  • Loading branch information
onemen committed Feb 5, 2025
1 parent 7ee168c commit 9e2da5a
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 8 deletions.
2 changes: 1 addition & 1 deletion addon/chrome/content/minit/tablib.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ Tabmix.tablib = {
}

if (!Tabmix.isVersion(1300)) {
Object.defineProperty(gBrowser, 'pinnedTabCount', {
Object.defineProperty(gBrowser, "pinnedTabCount", {
get: function pinnedTabCount() {
return gBrowser._numPinnedTabs;
},
Expand Down
52 changes: 52 additions & 0 deletions addon/chrome/content/overlay/zen_browser.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/* for zen browser */

#tabbrowser-tabs[orient="vertical"][closebuttons="noclose"] {
& #tabbrowser-arrowscrollbox .tabbrowser-tab {
& .tab-close-button {
display: none !important;
}
}
}

#tabbrowser-tabs[orient="vertical"][closebuttons="alltabs"] {
& #tabbrowser-arrowscrollbox .tabbrowser-tab:not(:is([pinned], [protected])) {
& .tab-close-button {
display: block !important;
--tab-inline-padding: 0 !important;
margin-inline-end: 0 !important;
}
}
}

#tabbrowser-tabs[orient="vertical"][closebuttons="activetab"] {
& #tabbrowser-arrowscrollbox .tabbrowser-tab:not(:is([pinned], [protected]))[selected="true"] {
& .tab-close-button {
display: block !important;
--tab-inline-padding: 0 !important;
margin-inline-end: 0 !important;
}
}
}

#tabbrowser-tabs[orient="vertical"][closebuttons-hover="notactivetab"] {
& #tabbrowser-arrowscrollbox .tabbrowser-tab:not(:is([pinned], [protected], [selected="true"]))[showbutton=on] {
& .tab-close-button {
display: block !important;
--tab-inline-padding: 0 !important;
margin-inline-end: 0 !important;
}
}
}

#tabbrowser-tabs[orient="vertical"][closebuttons-hover="alltabs"] {
& #tabbrowser-arrowscrollbox .tabbrowser-tab:not(:is([pinned], [protected]))[showbutton=on] {
& .tab-close-button {
display: block !important;
--tab-inline-padding: 0 !important;
margin-inline-end: 0 !important;
}
}
}


/* button on left???? */
14 changes: 10 additions & 4 deletions addon/chrome/content/preferences/appearance.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var gAppearancePane = {
_tabmixCustomizeToolbar: null,
init() {
var browserWindow = Tabmix.getTopWin();
const isZen = TabmixSvc.isZen;
// disable options for position the tabbar and scroll mode if TreeStyleTab extension installed
if (browserWindow.Tabmix.tabsUtils.isVerticalTabBar) {
const floorpVerticalTabbar = Tabmix.isVersion({fp: "128.0.0"});
Expand All @@ -16,8 +17,9 @@ var gAppearancePane = {
description.style.width = "25em";
}
const tabBarDisplay = $("tabBarDisplay");
const tabBarPosition = $("tabBarPosition");
Tabmix.setItem(tabBarDisplay, "tstInstalled", true);
Tabmix.setItem("tabBarPosition", "disabled", true);
Tabmix.setItem(tabBarPosition, "disabled", true);
Tabmix.setItem("tabsScroll", "disabled", true);
Tabmix.setItem("maxrow", "disabled", true);
Tabmix.setItem("pinnedTabScroll", "disabled", true);
Expand All @@ -26,11 +28,15 @@ var gAppearancePane = {
$("theme-background").disabled = true;

if (Tabmix.isVersion(1330) || floorpVerticalTabbar) {
const nextItem = isZen ? tabBarPosition.parentElement : tabBarDisplay.firstChild;
tabBarDisplay.insertBefore(description, nextItem);
}

if (!isZen && (Tabmix.isVersion(1330) || floorpVerticalTabbar)) {
const hideTabbar = $("hideTabbar");
Tabmix.setItem(hideTabbar, "disabled", true);
Tabmix.setItem(hideTabbar.previousElementSibling, "disabled", true);
Tabmix.setItem("show-hideTabbar-context-menu", "disabled", true);
tabBarDisplay.insertBefore(description, tabBarDisplay.firstChild);
}
}

Expand All @@ -47,10 +53,10 @@ var gAppearancePane = {
}

let treeStyleTab = browserWindow.Tabmix.extensions.treeStyleTab;
let disableButtonOnLefSide = !browserWindow.Tabmix.defaultCloseButtons || treeStyleTab;
let disableButtonOnLefSide = !browserWindow.Tabmix.defaultCloseButtons || treeStyleTab || isZen;
let comment = $("onLeftDisabled");
Tabmix.setItem("tabXLeft", "disabled", disableButtonOnLefSide || null);
Tabmix.setItem(comment, "hidden", !disableButtonOnLefSide || null);
Tabmix.setItem(comment, "hidden", !disableButtonOnLefSide || isZen || null);
if (treeStyleTab) {
comment.value = comment.getAttribute("tst") ?? "";
}
Expand Down
8 changes: 5 additions & 3 deletions addon/chrome/content/tabmix.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,11 @@ var TMP_eventListener = {
// TabmixSessionManager.updateSettings();

Tabmix.changeCode(tabBar, "gBrowser.tabContainer._updateCloseButtons")._replace(
Tabmix.isVersion(1300) ?
'this.visibleTabs[gBrowser.pinnedTabCount];' :
'this._getVisibleTabs()[gBrowser._numPinnedTabs];',
TabmixSvc.isZen ?
'this.visibleTabs[gBrowser._numVisiblePinTabs];' :
Tabmix.isVersion(1300) ?
'this.visibleTabs[gBrowser.pinnedTabCount];' :
'this._getVisibleTabs()[gBrowser._numPinnedTabs];',
'TMP_TabView.checkTabs(Tabmix.visibleTabs.tabs);'
).toCode(false, tabBar, "tabmix_updateCloseButtons");

Expand Down
4 changes: 4 additions & 0 deletions addon/modules/TabmixSvc.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ ChromeUtils.defineLazyGetter(TabmixSvc, "isFloorp", () => {
return Services.appinfo.name == "Floorp";
});

ChromeUtils.defineLazyGetter(TabmixSvc, "isZen", () => {
return Services.appinfo.name == "Zen";
});

ChromeUtils.defineLazyGetter(TabmixSvc, "console", () => {
return ChromeUtils.importESModule("chrome://tabmix-resource/content/log.sys.mjs").console;
});
Expand Down
4 changes: 4 additions & 0 deletions addon/modules/bootstrap/ScriptsLoader.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const CSS_URLS = [
"chrome://tabmix-os/skin/browser.css",
];

if (Services.appinfo.name == "Zen") {
CSS_URLS.push("chrome://tabmixplus/content/overlay/zen_browser.css");
}

const SCRIPTS = [
"chrome://tabmixplus/content/broadcaster.js",
"chrome://tabmixplus/content/utils.js",
Expand Down
1 change: 1 addition & 0 deletions types/tabmix.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ declare namespace TabmixModules {
isMac: boolean;
isWaterfox: boolean;
isWindows: boolean;
isZen: boolean;
loadDefaultPreferences(): void;
newtabUrl: string;
prefBranch: nsIPrefBranchXpcom;
Expand Down

0 comments on commit 9e2da5a

Please sign in to comment.