diff --git a/config/modules/home/theme.nix b/config/modules/home/theme.nix index 2bf7dd30..b15b9bd9 100644 --- a/config/modules/home/theme.nix +++ b/config/modules/home/theme.nix @@ -35,6 +35,14 @@ let cfg = config.kw.theme; in default = "${toString (cfg.font.size + 3)}px"; }; }; + variables = mkOption { + type = types.attrsOf types.str; + default = (cfg.base16 // { + font = cfg.font.name; + font_size = cfg.font.size_css; + inherit (cfg) alpha; + }); + }; }; config = mkIf (cfg.enable) { kw.theme = { @@ -43,19 +51,22 @@ let cfg = config.kw.theme; in alpha = "80"; }; - lib.kw.sassTemplate = pkgs.callPackage ({ sass, stdenv }: { name, src }: stdenv.mkDerivation ({ - inherit name src; - nativeBuildInputs = lib.singleton sass; - phases = [ "buildPhase" ]; - buildPhase = '' - substituteAll $src sub.sass - sass sub.sass $out --sourcemap=none --style=${cfg.css_style} + lib.kw.sassTemplate = { name, src }: let + variables = pkgs.writeText "base-variables.sass" '' + ${(concatStringsSep "\n" (mapAttrsToList(var: con: "\$${var}: ${con}") cfg.variables))} ''; - } // cfg.base16 // { - font = cfg.font.name; - font_size = cfg.font.size_css; - inherit (cfg) alpha; - })) {}; + source = pkgs.callPackage ({ sass, stdenv }: stdenv.mkDerivation ({ + inherit name src variables; + nativeBuildInputs = lib.singleton sass; + phases = [ "buildPhase" ]; + buildPhase = '' + cat $variables $src > src-mut.sass + sass src-mut.sass $out --sourcemap=none --style=${cfg.css_style} + ''; + } // cfg.variables)) {}; in { + inherit source; + text = builtins.readFile source; + }; _module.args = { inherit (config.lib) kw; }; }; } diff --git a/config/users/kat/gui/default.nix b/config/users/kat/gui/default.nix index 3b071028..680d3360 100644 --- a/config/users/kat/gui/default.nix +++ b/config/users/kat/gui/default.nix @@ -1,5 +1,5 @@ { config, ... }: { - imports = [ ./firefox.nix ./packages.nix ./gtk.nix ./foot.nix ./xdg.nix ./ranger.nix ./fonts.nix ./qt.nix ]; + imports = [ ./firefox ./packages.nix ./gtk.nix ./foot.nix ./xdg.nix ./ranger.nix ./fonts.nix ./qt.nix ]; } diff --git a/config/users/kat/gui/firefox.nix b/config/users/kat/gui/firefox/default.nix similarity index 86% rename from config/users/kat/gui/firefox.nix rename to config/users/kat/gui/firefox/default.nix index 54ee438e..eec4c5db 100644 --- a/config/users/kat/gui/firefox.nix +++ b/config/users/kat/gui/firefox/default.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, nixos, ... }: +{ config, lib, pkgs, nixos, kw, ... }: let commonSettings = { @@ -13,7 +13,7 @@ let }; in { - home.file.".mozilla/tst.css".source = pkgs.firefox-tst { inherit (config.kw.theme) base16; }; + home.file.".mozilla/tst.css" = { inherit (kw.sassTemplate { name = "tst"; src = ./tst.sass; }) source; }; programs.zsh.shellAliases = { ff-pm = "firefox --ProfileManager"; @@ -65,7 +65,7 @@ in id = 0; isDefault = true; settings = commonSettings; - userChrome = builtins.readFile (pkgs.firefox-uc { inherit (config.kw.theme) base16; }); + userChrome = (kw.sassTemplate { name = "userChrome"; src = ./userChrome.sass; }).text; }; }; }; diff --git a/overlays/ff-tst-style/tst.sass b/config/users/kat/gui/firefox/tst.sass similarity index 82% rename from overlays/ff-tst-style/tst.sass rename to config/users/kat/gui/firefox/tst.sass index 03bd3669..83a02a15 100644 --- a/overlays/ff-tst-style/tst.sass +++ b/config/users/kat/gui/firefox/tst.sass @@ -1,24 +1,5 @@ -$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" - * - font-family: $font_0, $font_1 + font-family: $font !important #tabbar margin-top: calc(var(--pinned-tabs-area-size) - .15em) diff --git a/overlays/ff-uc-style/userChrome.sass b/config/users/kat/gui/firefox/userChrome.sass similarity index 81% rename from overlays/ff-uc-style/userChrome.sass rename to config/users/kat/gui/firefox/userChrome.sass index d95b529c..4052c3f8 100644 --- a/overlays/ff-uc-style/userChrome.sass +++ b/config/users/kat/gui/firefox/userChrome.sass @@ -1,22 +1,3 @@ -$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" @@ -34,7 +15,7 @@ $extendables: ".urlbar-icon", "#userContext-indicator", "#userContext-label" --animationSpeed: 0.15s * - font-family: $font_0, $font_1 + font-family: $font !important #TabsToolbar visibility: collapse @@ -62,7 +43,7 @@ $extendables: ".urlbar-icon", "#userContext-indicator", "#userContext-label" &:not(:hover):not([breakout][breakout-extend]) > #urlbar-background box-shadow: none !important - background: @base01@ !important + background: $base01 !important &:hover .urlbar-icon fill: var(--toolbar-color) !important @@ -72,10 +53,10 @@ $extendables: ".urlbar-icon", "#userContext-indicator", "#userContext-label" @each $selector in $base00_backgrounds #{$selector} - background: @base00@ !important + background: $base00 !important #urlbar-background - background: @base01@ !important + background: $base01 !important #star-button display: none diff --git a/config/users/kat/sway/default.nix b/config/users/kat/sway/default.nix index 538fd7fa..d1b06dde 100644 --- a/config/users/kat/sway/default.nix +++ b/config/users/kat/sway/default.nix @@ -3,8 +3,8 @@ { imports = [ ./xkb.nix - ./waybar.nix - ./wofi.nix + ./waybar + ./wofi ./mako.nix ./sway.nix ./gammastep.nix diff --git a/config/users/kat/sway/waybar.nix b/config/users/kat/sway/waybar/default.nix similarity index 95% rename from config/users/kat/sway/waybar.nix rename to config/users/kat/sway/waybar/default.nix index 2e97e757..2663e42d 100644 --- a/config/users/kat/sway/waybar.nix +++ b/config/users/kat/sway/waybar/default.nix @@ -1,7 +1,7 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, kw, ... }: { - xdg.configFile."waybar/style.css".source = pkgs.waybar-style { inherit (config.kw.theme) base16; }; + xdg.configFile."waybar/style.css" = { inherit (kw.sassTemplate { name = "waybar-style"; src = ./waybar.sass; }) source; }; programs.waybar = { enable = true; diff --git a/overlays/waybar-style/waybar.sass b/config/users/kat/sway/waybar/waybar.sass similarity index 89% rename from overlays/waybar-style/waybar.sass rename to config/users/kat/sway/waybar/waybar.sass index e248eb46..5d190b1e 100644 --- a/overlays/waybar-style/waybar.sass +++ b/config/users/kat/sway/waybar/waybar.sass @@ -1,23 +1,3 @@ -$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@ -$alpha: @alpha@ -$font: "Cozette" -$font_size: 12px - %extend_1 padding: 0 8px transition: none diff --git a/config/users/kat/sway/wofi.nix b/config/users/kat/sway/wofi.nix deleted file mode 100644 index 597a5cb0..00000000 --- a/config/users/kat/sway/wofi.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ config, pkgs, ... }: - -{ - xdg.configFile."wofi/wofi.css".source = pkgs.wofi-style { inherit (config.kw.theme) base16; }; -} diff --git a/config/users/kat/sway/wofi/default.nix b/config/users/kat/sway/wofi/default.nix new file mode 100644 index 00000000..d6a95a1e --- /dev/null +++ b/config/users/kat/sway/wofi/default.nix @@ -0,0 +1,5 @@ +{ config, kw, ... }: + +{ + xdg.configFile."wofi/wofi.css" = { inherit (kw.sassTemplate { name = "wofi-style"; src = ./wofi.sass; }) source; }; +} diff --git a/overlays/wofi-style/wofi.sass b/config/users/kat/sway/wofi/wofi.sass similarity index 54% rename from overlays/wofi-style/wofi.sass rename to config/users/kat/sway/wofi/wofi.sass index 85486b73..82782374 100644 --- a/overlays/wofi-style/wofi.sass +++ b/config/users/kat/sway/wofi/wofi.sass @@ -1,23 +1,3 @@ -$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@ -$alpha: @alpha@ -$font: "Cozette" -$font_size: 12px - #scroll background: $base01 border: 1px solid $base03 diff --git a/overlays/default.nix b/overlays/default.nix index 77a473ce..c0308009 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -6,10 +6,6 @@ let (import ./nur { inherit sources; }) (import sources.emacs-overlay) (import ./rustfmt) - (import ./ff-tst-style) - (import ./ff-uc-style) - (import ./waybar-style) - (import ./wofi-style) /* # TODO: implement these (import ./vimrc) */ diff --git a/overlays/ff-tst-style/default.nix b/overlays/ff-tst-style/default.nix deleted file mode 100644 index a64ef842..00000000 --- a/overlays/ff-tst-style/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -final: prev: { - firefox-tst = final.callPackage ({ stdenv, sass }: { base16 }: - - stdenv.mkDerivation ({ - pname = "ff-tst-style"; - version = "0.0.1"; - - phases = [ "buildPhase" ]; - - src = ./tst.sass; - - nativeBuildInputs = [ - sass - ]; - - buildPhase = '' - substituteAll $src tst-sub.sass - sass tst-sub.sass $out --sourcemap=none --style expanded - ''; - } // base16)) {}; -} diff --git a/overlays/ff-uc-style/default.nix b/overlays/ff-uc-style/default.nix deleted file mode 100644 index 701bee54..00000000 --- a/overlays/ff-uc-style/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -final: prev: { - firefox-uc = final.callPackage ({ stdenv, sass }: { base16 }: - - stdenv.mkDerivation ({ - pname = "ff-uc-style"; - version = "0.0.1"; - - phases = [ "buildPhase" ]; - - src = ./userChrome.sass; - - nativeBuildInputs = [ - sass - ]; - - buildPhase = '' - substituteAll $src userChrome-sub.sass - sass userChrome-sub.sass $out --sourcemap=none --style expanded - ''; - } // base16)) {}; -} diff --git a/overlays/waybar-style/default.nix b/overlays/waybar-style/default.nix deleted file mode 100644 index ab6874a0..00000000 --- a/overlays/waybar-style/default.nix +++ /dev/null @@ -1,22 +0,0 @@ -final: prev: { - waybar-style = final.callPackage ({ stdenv, sass }: { base16 }: - stdenv.mkDerivation ({ - pname = "waybar-style"; - version = "0.0.1"; - - phases = [ "buildPhase" ]; - - src = ./waybar.sass; - - nativeBuildInputs = [ - sass - ]; - - buildPhase = '' - substituteAll $src waybar-sub.sass - sass waybar-sub.sass $out --sourcemap=none --style expanded - ''; - - alpha = "80"; - } // base16)) {}; -} diff --git a/overlays/wofi-style/default.nix b/overlays/wofi-style/default.nix deleted file mode 100644 index 1b9abe6e..00000000 --- a/overlays/wofi-style/default.nix +++ /dev/null @@ -1,22 +0,0 @@ -final: prev: { - wofi-style = final.callPackage ({ stdenv, sass }: { base16 }: - stdenv.mkDerivation ({ - pname = "wofi-style"; - version = "0.0.1"; - - phases = [ "buildPhase" ]; - - src = ./wofi.sass; - - nativeBuildInputs = [ - sass - ]; - - buildPhase = '' - substituteAll $src wofi-sub.sass - sass wofi-sub.sass $out --sourcemap=none --style expanded - ''; - - alpha = "80"; - } // base16)) {}; -}