From c1198d679190769ece47b92b3db97d1cb0f53bf1 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Tue, 17 Sep 2024 20:36:14 -0400 Subject: [PATCH] theme: better gtk css --- homeManagerModules/theme.nix | 100 +++++++++++++++++------------------ homes/aly/common.nix | 5 +- 2 files changed, 49 insertions(+), 56 deletions(-) diff --git a/homeManagerModules/theme.nix b/homeManagerModules/theme.nix index a98ed1f9..dcc25943 100644 --- a/homeManagerModules/theme.nix +++ b/homeManagerModules/theme.nix @@ -4,9 +4,9 @@ config, ... }: let - cfg = config.ar.home.theme; + cfg = config.ar.home; in { - config = lib.mkIf cfg.enable { + config = lib.mkIf cfg.theme.enable { home.packages = [ pkgs.gnome.adwaita-icon-theme pkgs.liberation_ttf @@ -35,60 +35,56 @@ in { }; }; - stylix.targets.gtk.extraCss = '' - window.background { border-radius: ${toString cfg.borders.radius}; } + stylix.targets.gtk.extraCss = builtins.concatStringsSep "\n" [ + (lib.optionalString (cfg.desktop.hyprland.enable || cfg.desktop.sway.enable) '' + window.background { border-radius: ${toString cfg.theme.borders.radius}; } - tooltip { - background-color: alpha(${config.lib.stylix.colors.withHashtag.base00}, ${builtins.toString config.stylix.opacity.popups}); - border-radius: ${toString cfg.borders.radius}; - border: 1px solid ${config.lib.stylix.colors.withHashtag.base0D}; - color: white; - } - - tooltip.background { - background-color: alpha(${config.lib.stylix.colors.withHashtag.base00}, ${builtins.toString config.stylix.opacity.popups}); - border: 1px solid ${config.lib.stylix.colors.withHashtag.base0D}; - } - - ${ - lib.optionalString (config.stylix.polarity == "light") " tooltip { - &.background { background-color: alpha(${config.lib.stylix.colors.withHashtag.base05}, ${builtins.toString config.stylix.opacity.popups}); } - background-color: alpha(${config.lib.stylix.colors.withHashtag.base05}, ${builtins.toString config.stylix.opacity.popups}); - }" - } + background-color: alpha(${config.lib.stylix.colors.withHashtag.base00}, ${builtins.toString config.stylix.opacity.popups}); + border-radius: ${toString cfg.theme.borders.radius}; + border: 1px solid ${config.lib.stylix.colors.withHashtag.base0D}; + color: white; + } - ${ - 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 */ - border-radius: 0; - border: 0; - box-shadow: none; - font-size: 0; - margin-bottom: 50px; - margin-top: -100px; - min-height: 0; - padding: 0; - } + tooltip.background { + background-color: alpha(${config.lib.stylix.colors.withHashtag.base00}, ${builtins.toString config.stylix.opacity.popups}); + border: 1px solid ${config.lib.stylix.colors.withHashtag.base0D}; + }'') - .titlebar, - .titlebar .background - { - border-radius: 0; - } + (lib.optionalString ( + (cfg.desktop.hyprland.enable || cfg.desktop.sway.enable) && (config.stylix.polarity == "light") + ) '' + tooltip { + &.background { background-color: alpha(${config.lib.stylix.colors.withHashtag.base05}, ${builtins.toString config.stylix.opacity.popups}); } + background-color: alpha(${config.lib.stylix.colors.withHashtag.base05}, ${builtins.toString config.stylix.opacity.popups}); + }'') - /* rm -rf window shadows */ - window.csd, /* gtk4? */ - window.csd decoration { /* gtk3 */ - border-radius: 0; - box-shadow: none; - } - '' - } - ''; + (lib.optionalString cfg.theme.gtk.hideTitleBar '' + /* No (default) title bar on wayland */ + headerbar.default-decoration { + /* You may need to tweak these values depending on your GTK theme */ + border-radius: 0; + border: 0; + box-shadow: none; + font-size: 0; + margin-bottom: 50px; + margin-top: -100px; + min-height: 0; + padding: 0; + } + + .titlebar, + .titlebar .background + { + border-radius: 0; + } + + /* rm -rf window shadows */ + window.csd, /* gtk4? */ + window.csd decoration { /* gtk3 */ + border-radius: 0; + box-shadow: none; + }'') + ]; }; } diff --git a/homes/aly/common.nix b/homes/aly/common.nix index d57c42f4..953dcad8 100644 --- a/homes/aly/common.nix +++ b/homes/aly/common.nix @@ -1,7 +1,4 @@ -{ - pkgs, - ... -}: { +{pkgs, ...}: { home = { homeDirectory = "/home/aly";