From 659d26148ab776bbf8e62819b3bda3d1f716adab Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Thu, 15 Aug 2024 18:06:42 -0400 Subject: [PATCH] theme: simplify css with stylix --- homeManagerModules/theme.nix | 86 +++++++++++++++++------------------- 1 file changed, 41 insertions(+), 45 deletions(-) diff --git a/homeManagerModules/theme.nix b/homeManagerModules/theme.nix index 20cf5159..df60cdb1 100644 --- a/homeManagerModules/theme.nix +++ b/homeManagerModules/theme.nix @@ -5,55 +5,20 @@ ... }: let cfg = config.ar.home.theme; - - gtk = { - extraCss = - lib.strings.optionalString - cfg.gtk.hideTitleBar - '' - /* No (default) title bar on wayland */ - headerbar.default-decoration { - /* You may need to tweak these values depending on your GTK theme */ - margin-bottom: 50px; - margin-top: -100px; - - background: transparent; - padding: 0; - border: 0; - min-height: 0; - font-size: 0; - box-shadow: none; - } - - /* rm -rf window shadows */ - window.csd, /* gtk4? */ - window.csd decoration { /* gtk3 */ - box-shadow: none; - } - ''; - }; in { config = lib.mkIf cfg.enable { - home = { - packages = [ - pkgs.adwaita-qt - pkgs.gnome.adwaita-icon-theme - pkgs.liberation_ttf - ]; - }; + home.packages = [ + pkgs.gnome.adwaita-icon-theme + pkgs.liberation_ttf + ]; - gtk = { - iconTheme = { - name = - if config.stylix.polarity == "dark" - then "Papirus-Dark" - else "Papirus"; + gtk.iconTheme = { + name = + if config.stylix.polarity == "dark" + then "Papirus-Dark" + else "Papirus"; - package = pkgs.papirus-icon-theme.override {color = "adwaita";}; - }; - - gtk3 = {inherit (gtk) extraCss;}; - gtk4 = {inherit (gtk) extraCss;}; + package = pkgs.papirus-icon-theme.override {color = "adwaita";}; }; qt = { @@ -69,5 +34,36 @@ in { package = pkgs.adwaita-qt6; }; }; + + stylix.targets.gtk.extraCss = '' + // Control rounded corners + window.background { border-radius: ${toString cfg.borderRadius}; } + + ${ + lib.strings.optionalString + cfg.gtk.hideTitleBar + '' + /* No (default) title bar on wayland */ + headerbar.default-decoration { + /* You may need to tweak these values depending on your GTK theme */ + margin-bottom: 50px; + margin-top: -100px; + + background: transparent; + padding: 0; + border: 0; + min-height: 0; + font-size: 0; + box-shadow: none; + } + + /* rm -rf window shadows */ + window.csd, /* gtk4? */ + window.csd decoration { /* gtk3 */ + box-shadow: none; + } + '' + } + ''; }; }