feat(theme): use adwaita with gradience for gtk theme
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-03-11 12:23:15 -04:00
parent cd4f7d8f94
commit b05abe05ff
6 changed files with 154 additions and 37 deletions

26
home/theme/default.nix Normal file
View file

@ -0,0 +1,26 @@
{
pkgs,
...
}: {
imports = [
./gtk.nix
./qt.nix
];
home.pointerCursor = {
name = "Dracula-cursors";
package = pkgs.dracula-theme;
size = 24;
gtk.enable = true;
x11 = {
enable = true;
defaultCursor = "Dracula-cursors";
};
};
xresources.extraConfig =
builtins.readFile
"${pkgs.dracula-theme}/xres";
}

62
home/theme/gradience.nix Normal file
View file

@ -0,0 +1,62 @@
{
pkgs,
lib,
...
}: {
gradience = rec {
# https://github.com/V-Mann-Nick/nix-home-manager/blob/main/gnome/theme.nix
package = pkgs.gradience.overrideAttrs (old: {
version = "0.8.0-beta1";
propagatedBuildInputs = old.propagatedBuildInputs ++ [pkgs.python3Packages.libsass];
src = pkgs.fetchgit {
url = "https://github.com/GradienceTeam/Gradience.git";
rev = "06b83cee3b84916ab9812a47a84a28ca43c8e53f";
sha256 = "sha256-gdY5QG0STLHY9bw5vI49rY6oNT8Gg8oxqHeEbqM4XfM=";
fetchSubmodules = true;
};
patches =
(old.patches or [])
++ [
(pkgs.fetchpatch {
url = "https://github.com/V-Mann-Nick/nix-home-manager/raw/e68c661f21bf17323f8f0657f3af06c7f837cc07/gnome/gradience.patch";
hash = "sha256-CcOd5KXjSSwYan8MwIJ4SBmmMXriBlOLYk5XFADLf6c=";
})
];
});
# Stub the gnome-shell binary to satisfy the check without downloading Gnome
gnomeShellStub = pkgs.writeShellScriptBin "gnome-shell" ''
echo "GNOME Shell 45.2"
'';
presets = pkgs.fetchFromGitHub {
owner = "GradienceTeam";
repo = "Community";
rev = "b3628d28164d91b3be1cc4736cd77a19c5da4d74";
hash = "sha256-tpS6LpPKedPBvI51bD/g299nYM7gY8C1+AmGza1FJ4w=";
};
build = pkgs.stdenv.mkDerivation {
name = "gradience-build";
preset = lib.fileContents "${presets}/curated/dracula-dark.json";
passAsFile = ["preset"];
phases = ["buildPhase" "installPhase"];
nativeBuildInputs = [gnomeShellStub];
buildPhase = ''
export HOME=$TMPDIR
export XDG_CURRENT_DESKTOP=GNOME
mkdir -p $HOME/.config/presets
${package}/bin/gradience-cli apply -p $presetPath --gtk both
${package}/bin/gradience-cli gnome-shell -p $presetPath -v dark
'';
installPhase = ''
mkdir -p $out
cp -r .config/gtk-4.0 $out/
cp -r .config/gtk-3.0 $out/
cp -r .local/share/themes/gradience-shell $out/
'';
};
shellTheme = "gradience-shell";
};
}

63
home/theme/gtk.nix Normal file
View file

@ -0,0 +1,63 @@
{
pkgs,
lib,
config,
...
}: let
inherit (config.vars) fontSize;
inherit (import ./gradience.nix {inherit pkgs lib;}) gradience;
in {
home.packages = with pkgs; [
gnomeExtensions.user-themes
];
# Gtk settings
gtk = {
enable = true;
theme = {
name = "adw-gtk3";
package = pkgs.adw-gtk3;
};
iconTheme = {
name = "Flat-Remix-Violet-Dark";
package = pkgs.flat-remix-icon-theme;
};
font = {
name = "Sans Serif";
size = fontSize;
};
gtk3 = {
extraConfig = {
"gtk-application-prefer-dark-theme" = 1;
};
extraCss = builtins.readFile "${gradience.build}/gtk-3.0/gtk.css";
};
gtk4 = {
extraConfig = {
"gtk-application-prefer-dark-theme" = 1;
};
extraCss = builtins.readFile "${gradience.build}/gtk-4.0/gtk.css";
};
};
dconf.settings = {
"org/gnome/shell/extensions/user-theme" = {
name = gradience.shellTheme;
};
"org/gnome/shell" = {
enabled-extensions = [pkgs.gnomeExtensions.user-themes.extensionUuid];
};
};
xdg.dataFile.shellTheme = {
enable = true;
recursive = true;
source = "${gradience.build}/gradience-shell";
target = "themes/${gradience.shellTheme}";
};
}

View file

@ -6,50 +6,16 @@
}: let }: let
inherit (config.vars) fontSize; inherit (config.vars) fontSize;
in { in {
home.pointerCursor = {
name = "Dracula-cursors";
package = pkgs.dracula-theme;
size = 24;
gtk.enable = true;
x11 = {
enable = true;
defaultCursor = "Dracula-cursors";
};
};
gtk = {
enable = true;
theme = {
name = "Dracula";
package = pkgs.dracula-theme;
};
iconTheme = {
name = "Flat-Remix-Violet-Dark";
package = pkgs.flat-remix-icon-theme;
};
font = {
name = "Sans Serif";
size = fontSize;
};
};
home.packages = with pkgs; [ home.packages = with pkgs; [
libsForQt5.qtstyleplugin-kvantum libsForQt5.qtstyleplugin-kvantum
qt6Packages.qtstyleplugin-kvantum qt6Packages.qtstyleplugin-kvantum
]; ];
qt = { qt = {
enable = true; enable = true;
platformTheme = "qtct"; platformTheme = "qtct";
}; };
xresources.extraConfig =
builtins.readFile
"${pkgs.dracula-theme}/xres";
xdg.configFile = let xdg.configFile = let
floatFont = lib.strings.floatToString fontSize; floatFont = lib.strings.floatToString fontSize;
qtconf = qtconf =

View file

@ -17,7 +17,7 @@ in {
imports = [ imports = [
ags.homeManagerModules.default ags.homeManagerModules.default
../../common/vars ../../common/vars
../../home/theme.nix ../../home/theme
]; ];
programs.ags.enable = true; programs.ags.enable = true;

View file

@ -5,7 +5,7 @@
}: let }: let
inherit (config.vars) configDir; inherit (config.vars) configDir;
in { in {
imports = [../../home/theme.nix]; imports = [../../home/theme];
home.packages = with pkgs; [swww]; home.packages = with pkgs; [swww];