From 03975cc394226bfbeacb483e0505bdb9fc88af79 Mon Sep 17 00:00:00 2001 From: kat witch Date: Thu, 26 Aug 2021 03:23:34 +0100 Subject: [PATCH] Firefox userChrome Package + Substitutor --- config/users/kat/gui/firefox-ucc.nix | 106 ------------------ config/users/kat/gui/firefox.nix | 5 +- overlays/default.nix | 8 +- .../{firefox-tst => ff-tst-style}/default.nix | 6 +- .../{firefox-tst => ff-tst-style}/tst.sass | 2 - overlays/ff-uc-style/default.nix | 21 ++++ overlays/ff-uc-style/userChrome.sass | 98 ++++++++++++++++ 7 files changed, 132 insertions(+), 114 deletions(-) delete mode 100644 config/users/kat/gui/firefox-ucc.nix rename overlays/{firefox-tst => ff-tst-style}/default.nix (62%) rename overlays/{firefox-tst => ff-tst-style}/tst.sass (99%) create mode 100644 overlays/ff-uc-style/default.nix create mode 100644 overlays/ff-uc-style/userChrome.sass diff --git a/config/users/kat/gui/firefox-ucc.nix b/config/users/kat/gui/firefox-ucc.nix deleted file mode 100644 index 82b01a5e..00000000 --- a/config/users/kat/gui/firefox-ucc.nix +++ /dev/null @@ -1,106 +0,0 @@ -{ profile, base16 }: - -'' - * { - font-family: "Cozette", monospace; - } - - :root { - --animationSpeed : 0.15s; - } - - /* Hide main tabs toolbar */ - #TabsToolbar { - visibility: collapse; - } - /* Hide splitter, when using Tree Style Tab. */ - #sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] + #sidebar-splitter { - display: none !important; - } - /* Hide sidebar header, when using Tree Style Tab. */ - #sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] #sidebar-header { - visibility: collapse; - } - - - #back-button { display: none !important } - #forward-button { display: none !important } - #urlbar-search-mode-indicator { display: none !important } - #urlbar *|input::placeholder { opacity: 0 !important; } - - #nav-bar, toolbar-menubar, #menubar-items, #main-menubar { - background: ${base16.base00} !important; - } - - #urlbar-background { - background: ${base16.base01} !important; - } - - #urlbar { - text-align: center; - } - - #urlbar-container { - width: 50vw !important; - } - - #star-button{ - display:none; - } - - #navigator-toolbox { - border : none !important; - } - - .titlebar-spacer { - display : none !important; - } - - #urlbar:not(:hover):not([breakout][breakout-extend]) > #urlbar-background { - box-shadow : none !important; - background : ${base16.base01} !important; - } - - .urlbar-icon, #userContext-indicator, #userContext-label { - fill : transparent !important; - background : transparent !important; - color : transparent !important; - } - - #nav-bar-customization-target > toolbarspring { max-width: none !important } - - #urlbar:hover .urlbar-icon, - #urlbar:active .urlbar-icon, - #urlbar[focused] .urlbar-icon { - fill : var(--toolbar-color) !important; - } - - #urlbar-container { - -moz-box-pack: center !important; - } - - /* animations */ - toolbarbutton, - .toolbarbutton-icon, - .subviewbutton, - #urlbar-background, - .urlbar-icon, - #userContext-indicator, - #userContext-label, - .urlbar-input-box, - #identity-box, - #tracking-protection-icon-container, - [anonid=urlbar-go-button], - .urlbar-icon-wrapper, - #tracking-protection-icon, - #identity-box image, - stack, - vbox, - tab:not(:active) .tab-background, - tab:not([beforeselected-visible])::after, - tab[visuallyselected] .tab-background::before, - tab[visuallyselected] .tab-background::before, - .tab-close-button { - transition : var(--animationSpeed) !important; - } -'' diff --git a/config/users/kat/gui/firefox.nix b/config/users/kat/gui/firefox.nix index 1d333d8b..f5c104a6 100644 --- a/config/users/kat/gui/firefox.nix +++ b/config/users/kat/gui/firefox.nix @@ -9,6 +9,7 @@ let "browser.urlbar.placeholderName" = "DuckDuckGo"; "toolkit.legacyUserProfileCustomizations.stylesheets" = true; "svg.context-properties.content.enabled" = true; + "extensions.pocket.enabled" = false; }; in { @@ -63,8 +64,8 @@ in main = { id = 0; isDefault = true; - settings = commonSettings // { }; - userChrome = import ./firefox-ucc.nix { profile = "main"; base16 = config.kw.hexColors; }; + settings = commonSettings; + userChrome = builtins.readFile (pkgs.firefox-uc { base16 = config.kw.hexColors; }); }; }; }; diff --git a/overlays/default.nix b/overlays/default.nix index 0dae2c27..05a5d11f 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -6,7 +6,13 @@ let (import ./nur { inherit sources; }) (import sources.emacs-overlay) (import ./rustfmt) - (import ./firefox-tst) + (import ./ff-tst-style) + (import ./ff-uc-style) + /* # TODO: implement these + (import ./waybar-style) + (import ./wofi-style) + (import ./vimrc) + */ ] ++ (map (path: import "${path}/overlay.nix") [ sources.arcexprs sources.katexprs diff --git a/overlays/firefox-tst/default.nix b/overlays/ff-tst-style/default.nix similarity index 62% rename from overlays/firefox-tst/default.nix rename to overlays/ff-tst-style/default.nix index 29b87c03..53b42efa 100644 --- a/overlays/firefox-tst/default.nix +++ b/overlays/ff-tst-style/default.nix @@ -2,7 +2,7 @@ final: prev: { firefox-tst = final.callPackage ({ stdenv, sass }: { base16 }: stdenv.mkDerivation ({ - pname = "firefox-tst-css"; + pname = "ff-tst-style"; version = "0.0.1"; phases = [ "buildPhase" ]; @@ -14,8 +14,8 @@ final: prev: { ]; buildPhase = '' - substituteAll $src firefox-tst-substituted.sass - sass firefox-tst-substituted.sass $out --sourcemap=none --style expanded + substituteAll $src tst-sub.sass + sass tst-sub.sass $out --sourcemap=none --style expanded ''; } // base16)) {}; } diff --git a/overlays/firefox-tst/tst.sass b/overlays/ff-tst-style/tst.sass similarity index 99% rename from overlays/firefox-tst/tst.sass rename to overlays/ff-tst-style/tst.sass index 33470560..4356a840 100644 --- a/overlays/firefox-tst/tst.sass +++ b/overlays/ff-tst-style/tst.sass @@ -1,4 +1,3 @@ -// Colours $base00: @base00@ $base01: @base01@ $base02: @base02@ @@ -15,7 +14,6 @@ $base0C: @base0C@ $base0D: @base0D@ $base0E: @base0E@ $base0F: @base0F@ -// Fonts $font_0: "Cozette" $font_1: "monospace !important" diff --git a/overlays/ff-uc-style/default.nix b/overlays/ff-uc-style/default.nix new file mode 100644 index 00000000..1016ec0f --- /dev/null +++ b/overlays/ff-uc-style/default.nix @@ -0,0 +1,21 @@ +final: prev: { + firefox-uc = final.callPackage ({ stdenv, sass }: { base16 }: + + stdenv.mkDerivation ({ + pname = "ff-uc-style"; + version = "0.0.1"; + + phases = [ "buildPhase" ]; + + src = ./userChrome.sass; + + buildInputs = [ + sass + ]; + + buildPhase = '' + substituteAll $src userChrome-sub.sass + sass userChrome-sub.sass $out --sourcemap=none --style expanded + ''; + } // base16)) {}; +} diff --git a/overlays/ff-uc-style/userChrome.sass b/overlays/ff-uc-style/userChrome.sass new file mode 100644 index 00000000..fb039d73 --- /dev/null +++ b/overlays/ff-uc-style/userChrome.sass @@ -0,0 +1,98 @@ +$base00: @base00@ +$base01: @base01@ +$base02: @base02@ +$base03: @base03@ +$base04: @base04@ +$base05: @base05@ +$base06: @base06@ +$base07: @base07@ +$base08: @base08@ +$base09: @base09@ +$base0A: @base0A@ +$base0B: @base0B@ +$base0C: @base0C@ +$base0D: @base0D@ +$base0E: @base0E@ +$base0F: @base0F@ +$font_0: "Cozette" +$font_1: "monospace !important" + +$animations: "toolbarbutton", ".toolbarbutton-icon", ".subviewbutton", "#urlbar-background", ".urlbar-icon", "#userContext-indicator", "#userContext-label", ".urlbar-input-box", "#identity-box", "#tracking-protection-icon-container", "[anonid=urlbar-go-button]", ".urlbar-icon-wrapper", "#tracking-protection-icon", "#identity-box image", "stack", "vbox", "tab:not(:active) .tab-background", "tab:not([beforeselected-visible])::after", "tab[visuallyselected] .tab-background::before", "tab[visuallyselected] .tab-background::before", ".tab-close-button" +$base00_backgrounds: "#nav-bar", "toolbar-menubar", "#menubar-items", "#main-menubar" +$extendables: ".urlbar-icon", "#userContext-indicator", "#userContext-label" + +%extend_1 + fill: transparent !important + background: transparent !important + color: transparent !important + +@each $selector in $extendables + #{$selector} + @extend %extend_1 + +\:root + --animationSpeed: 0.15s + +* + font-family: $font_0, $font_1 + +#TabsToolbar + visibility: collapse + +#sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] + #sidebar-header + visibility: collapse + + + #sidebar-splitter + display: none !important + + +#back-button + display: none !important + +#forward-button + display: none !important + +#urlbar-search-mode-indicator + display: none !important + +#urlbar + text-align: center + *|input::placeholder + opacity: 0 !important + + &:not(:hover):not([breakout][breakout-extend]) > #urlbar-background + box-shadow: none !important + background: @base01@ !important + + &:hover .urlbar-icon + fill: var(--toolbar-color) !important + + &:active .urlbar-icon + fill: var(--toolbar-color) !important + +@each $selector in $base00_backgrounds + #{$selector} + background: @base00@ !important + +#urlbar-background + background: @base01@ !important + +#star-button + display: none + +#navigator-toolbox + border: none !important + +.titlebar-spacer + display: none !important + +@each $selector in $animations + #{$selector} + transition: var(--animationSpeed) !important + +#nav-bar-customization-target > toolbarspring + max-width: none !important + +#urlbar[focused] .urlbar-icon + fill: var(--toolbar-color) !important