From 180152426c51b685af3cd49fb6118613768e982f Mon Sep 17 00:00:00 2001 From: Ahmad Ansori Palembani Date: Tue, 5 Nov 2024 20:07:16 +0700 Subject: [PATCH] refactor(nix): Use userChrome from `include/` dir Also move stuff --- .include/ff-chrome/userChrome.css | 65 ------------------- .../floorp/ziro-userChrome.css | 3 +- nix/users/ziro/default.nix | 2 +- user-chrome-setup.py | 2 +- 4 files changed, 3 insertions(+), 69 deletions(-) delete mode 100644 .include/ff-chrome/userChrome.css rename {nix/files => include}/floorp/ziro-userChrome.css (96%) diff --git a/.include/ff-chrome/userChrome.css b/.include/ff-chrome/userChrome.css deleted file mode 100644 index 97de426..0000000 --- a/.include/ff-chrome/userChrome.css +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Better Floorp vertical tabs - * - * This makes Floorp's (expanded) vertical tabs not affecting sites' width, - * which can cause lag on heavy websites like Twitch and YouTube. - * - * This also fixed vertical tabs' width breaking when some preference related - * to browser's "head" is changed - * - * Based on my changes for Pulse, but Pulse is dead. - * REF: https://github.com/null2264/pulse/commit/fce966a110c2987b08d35bcd04c5992655b24b13 - */ -:root { - /* from Floorp source code, too big for me */ - /*--default-verticaltab-width: 45px;*/ - /*--hoverd-verticaltab-width: 20em;*/ - - --default-verticaltab-width: 35px !important; - --hoverd-verticaltab-width: 18em; -} - -@charset "UTF-8"; -@-moz-document url(chrome://browser/content/browser.xhtml) { -.browserContainer { - border-inline-width: 0 !important; -} - -/* >> Fix height being inconsistent on hover */ -.tab-icon-stack, -.tab-label-container { - height: 2.7em !important; -} - -.tab-icon-stack { - align-items: center; -} -/* << Fix height being inconsistent on hover */ - -#sidebar-select-box { - width: var(--default-verticaltab-width) !important; - min-width: var(--default-verticaltab-width) !important; - max-width: var(--default-verticaltab-width) !important; -} - -#TabsToolbar { - position: relative !important; - transition: all 300ms !important; - width: calc(var(--default-verticaltab-width) + 5px) !important; - min-width: calc(var(--default-verticaltab-width) + 5px) !important; - max-width: calc(var(--default-verticaltab-width) + 5px) !important; - z-index: 1; /* Probably not needed, since Floorp already handle this */ -} -#TabsToolbar:not(:hover) { - scrollbar-width: none !important; -} - -#TabsToolbar:hover { - transition: all 300ms !important; - width: var(--hoverd-verticaltab-width) !important; - min-width: var(--hoverd-verticaltab-width) !important; - max-width: var(--hoverd-verticaltab-width) !important; - z-index: 2; /* Probably not needed, since Floorp already handle this */ - margin-right: calc((var(--hoverd-verticaltab-width) - var(--default-verticaltab-width) - 5px) * -1) !important; -} -} diff --git a/nix/files/floorp/ziro-userChrome.css b/include/floorp/ziro-userChrome.css similarity index 96% rename from nix/files/floorp/ziro-userChrome.css rename to include/floorp/ziro-userChrome.css index 13f66de..6a88304 100644 --- a/nix/files/floorp/ziro-userChrome.css +++ b/include/floorp/ziro-userChrome.css @@ -16,7 +16,7 @@ /*--hoverd-verticaltab-width: 20em;*/ --default-verticaltab-width: 4.125em !important; - --hoverd-verticaltab-width: /*ZI:VERTICAL-TAB-HOVER-WIDTH-IN-EM*/ !important; + --hoverd-verticaltab-width: /*ZI:*/18em/*:VERTICAL-TAB-HOVER-WIDTH-IN-EM*/ !important; } @charset "UTF-8"; @@ -94,4 +94,3 @@ z-index: 2; /* Probably not needed, since Floorp already handle this */ margin-right: calc((var(--hoverd-verticaltab-width) - var(--default-verticaltab-width) - 0.125em) * -1) !important; } -} diff --git a/nix/users/ziro/default.nix b/nix/users/ziro/default.nix index cc7019a..a8aba4b 100644 --- a/nix/users/ziro/default.nix +++ b/nix/users/ziro/default.nix @@ -2,7 +2,7 @@ let username = "ziro"; - userChrome = builtins.replaceStrings ["/*ZI:VERTICAL-TAB-HOVER-WIDTH-IN-EM*/"] ["${builtins.toString vars.floorp.verticalTabHoverWidthInEm}em"] (builtins.readFile ../../files/floorp/ziro-userChrome.css); + userChrome = builtins.replaceStrings ["/*ZI:*/18em/*:VERTICAL-TAB-HOVER-WIDTH-IN-EM*/"] ["${builtins.toString vars.floorp.verticalTabHoverWidthInEm}em"] (builtins.readFile ../../../include/floorp/ziro-userChrome.css); settings = { "browser.toolbars.bookmarks.visibility" = "newtab"; "floorp.browser.sidebar.is.displayed" = false; diff --git a/user-chrome-setup.py b/user-chrome-setup.py index f223749..c758dce 100755 --- a/user-chrome-setup.py +++ b/user-chrome-setup.py @@ -70,7 +70,7 @@ for default_path in default_paths: chrome_path = pathlib.Path(f"{profile_path}/chrome") chrome_path.mkdir(parents=True, exist_ok=True) user_chrome_path = chrome_path / "userChrome.css" - target_path = f"{dotfiles}/.include/ff-chrome/userChrome.css" + target_path = f"{dotfiles}/include/floorp/ziro-userChrome.css" try: user_chrome_path.symlink_to(target_path) installed += 1