From af95a0bf4927a7001be372f06fe319d90890dc46 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Thu, 30 May 2024 16:24:52 +1000 Subject: [PATCH] style(tweaks): rounded & bubble tab styles --- src/extensions/tweaks/client.css | 24 ++++++++++++++++++++++++ src/extensions/tweaks/mod.json | 10 +++++++++- src/extensions/tweaks/tabs.cjs | 12 ++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/extensions/tweaks/tabs.cjs diff --git a/src/extensions/tweaks/client.css b/src/extensions/tweaks/client.css index f1b668b..138aed3 100644 --- a/src/extensions/tweaks/client.css +++ b/src/extensions/tweaks/client.css @@ -42,6 +42,30 @@ body[data-tweaks*=",snappyTransitions,"] * { transition-duration: 0s !important; } +body[data-tweaks*=",tabStyle=Rounded,"] > #root .hide-scrollbar { + padding-top: 4px; + > [draggable] { + overflow: hidden; + border-top-right-radius: 8px; + border-top-left-radius: 8px; + [style*="height: 36px"] { + top: -2px !important; + } + } +} + +body[data-tweaks*=",tabStyle=Bubble,"] > #root .hide-scrollbar { + padding-top: 3px; + height: 30px !important; + > [draggable] { + overflow: hidden; + border-radius: 5px; + [style*="height: 36px"] { + top: -4px !important; + } + } +} + /* pages */ body[data-break-columns], diff --git a/src/extensions/tweaks/mod.json b/src/extensions/tweaks/mod.json index 0706db4..b2d15f0 100644 --- a/src/extensions/tweaks/mod.json +++ b/src/extensions/tweaks/mod.json @@ -49,6 +49,13 @@ "description": "Disables style animations for a snappier experience across the board. This will not affect JavaScript-powered animations, e.g. the left sidebar popping out.", "value": false }, + { + "type": "select", + "key": "tabStyle", + "description": "Changes the shape of open tab controls to look like Chrome or Firefox's rounded tabs.", + "platforms": ["linux", "win32", "darwin"], + "values": ["Rectangular", "Rounded", "Bubble"] + }, { "type": "heading", "label": "Pages" }, { "type": "toggle", @@ -131,5 +138,6 @@ } ], "clientStyles": ["client.css"], - "clientScripts": ["client.mjs"] + "clientScripts": ["client.mjs"], + "electronScripts": [[".webpack/renderer/tabs/preload.js", "tabs.cjs"]] } diff --git a/src/extensions/tweaks/tabs.cjs b/src/extensions/tweaks/tabs.cjs new file mode 100644 index 0000000..44540c2 --- /dev/null +++ b/src/extensions/tweaks/tabs.cjs @@ -0,0 +1,12 @@ +/** + * notion-enhancer: tweaks + * (c) 2024 dragonwocky (https://dragonwocky.me/) + * (https://notion-enhancer.github.io/) under the MIT license + */ + +"use strict"; + +module.exports = async (api, db) => { + const tabStyle = await db.get("tabStyle"); + document.body.dataset.tweaks = ",tabStyle=" + tabStyle + ","; +};