From cc00e11a8dea96acd23e99be665cb09a2ce55b4a Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Thu, 30 Nov 2023 23:46:05 -0600 Subject: [PATCH] feat(nvim-hm): set gtk theme via nix home manager --- config/default.nix | 74 ++++++++++++++++++++++++++++--- dots/.config/gtk-3.0/settings.ini | 16 ------- dots/.config/gtk-4.0/settings.ini | 16 ------- flake.nix | 1 + pkgs/kanagawa-gtk/default.nix | 29 ++++++++++++ 5 files changed, 98 insertions(+), 38 deletions(-) delete mode 100644 dots/.config/gtk-3.0/settings.ini delete mode 100644 dots/.config/gtk-4.0/settings.ini create mode 100644 pkgs/kanagawa-gtk/default.nix diff --git a/config/default.nix b/config/default.nix index 87c48cad..a6591cf7 100644 --- a/config/default.nix +++ b/config/default.nix @@ -12,10 +12,10 @@ let }) # HACK: We don't use the absolute path in readDir to respect pure evaluation in nix flakes. (builtins.attrNames (builtins.readDir ../dots/${dir})))); + gtkStyle = "gtk2"; in { programs.home-manager.enable = true; - home = { packages = with pkgs; [ gcc @@ -56,7 +56,16 @@ in ripgrep fd nixfmt + qt6Packages.qt6gtk2 + qt6Packages.qt6ct + libsForQt5.qtstyleplugins + libsForQt5.qt5ct + lxappearance + webcord + blueman + gtk-engine-murrine ]; + file = { ".local/" = { @@ -77,12 +86,65 @@ in force = true; }; } // softLinkDots ".config"; + + sessionVariables = { + GTK_THEME = "Kanagawa-Borderless"; + QT_QPA_PLATFORMTHEME = "${gtkStyle}"; + }; }; - programs.neovim = { - enable = true; - extraPackages = with pkgs; [ sqlite gh ]; - # Magick is required for image.nvim - extraLuaPackages = lp: [ lp.magick ]; + programs = { + zsh = { + enable = true; + initExtra = '' + . "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" + ''; + profileExtra = '' + export GTK_PATH="$HOME/.nix-profile/lib/gtk-2.0" + ''; + }; + neovim = { + enable = true; + extraPackages = with pkgs; [ sqlite gh ]; + # Magick is required for image.nvim + extraLuaPackages = lp: [ lp.magick ]; + }; }; + + gtk = + let + extraGtkConfig = { + gtk-application-prefer-dark-theme = true; + gtk-cursor-theme-size = 0; + gtk-enable-event-sounds = 1; + gtk-enable-input-feedback-sounds = 1; + gtk-xft-antialias = 1; + gtk-xft-hinting = 1; + gtk-xft-hintstyle = "hintfull"; + }; + in + { + enable = true; + theme = { + name = "Kanagawa-Borderless"; + package = pkgs.kanagawa-gtk-theme; + }; + iconTheme = { + name = "Kanagawa"; + package = pkgs.kanagawa-gtk-theme; + }; + font = { + name = "Open Sans"; + size = 11; + package = pkgs.open-sans; + }; + gtk3.extraConfig = extraGtkConfig; + gtk4.extraConfig = extraGtkConfig; + }; + + qt = { + enable = true; + platformTheme = "gtk"; + }; + } diff --git a/dots/.config/gtk-3.0/settings.ini b/dots/.config/gtk-3.0/settings.ini deleted file mode 100644 index 96de525c..00000000 --- a/dots/.config/gtk-3.0/settings.ini +++ /dev/null @@ -1,16 +0,0 @@ -[Settings] -gtk-icon-theme-name=Kanagawa -gtk-theme-name=Kanagawa-Borderless -gtk-font-name=Open Sans 11 -gtk-application-prefer-dark-theme=0 -gtk-cursor-theme-name=Adwaita -gtk-cursor-theme-size=0 -gtk-toolbar-style=GTK_TOOLBAR_BOTH -gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR -gtk-button-images=1 -gtk-menu-images=1 -gtk-enable-event-sounds=1 -gtk-enable-input-feedback-sounds=1 -gtk-xft-antialias=1 -gtk-xft-hinting=1 -gtk-xft-hintstyle=hintfull diff --git a/dots/.config/gtk-4.0/settings.ini b/dots/.config/gtk-4.0/settings.ini deleted file mode 100644 index 96de525c..00000000 --- a/dots/.config/gtk-4.0/settings.ini +++ /dev/null @@ -1,16 +0,0 @@ -[Settings] -gtk-icon-theme-name=Kanagawa -gtk-theme-name=Kanagawa-Borderless -gtk-font-name=Open Sans 11 -gtk-application-prefer-dark-theme=0 -gtk-cursor-theme-name=Adwaita -gtk-cursor-theme-size=0 -gtk-toolbar-style=GTK_TOOLBAR_BOTH -gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR -gtk-button-images=1 -gtk-menu-images=1 -gtk-enable-event-sounds=1 -gtk-enable-input-feedback-sounds=1 -gtk-xft-antialias=1 -gtk-xft-hinting=1 -gtk-xft-hintstyle=hintfull diff --git a/flake.nix b/flake.nix index 18b7bacb..e5f3be01 100644 --- a/flake.nix +++ b/flake.nix @@ -24,6 +24,7 @@ ({ nixpkgs.overlays = [ inputs.neovim-nightly-overlay.overlay + (self: super: { kanagawa-gtk-theme = super.callPackage ./pkgs/kanagawa-gtk { }; }) ]; home = { username = "${username}"; diff --git a/pkgs/kanagawa-gtk/default.nix b/pkgs/kanagawa-gtk/default.nix new file mode 100644 index 00000000..80772f40 --- /dev/null +++ b/pkgs/kanagawa-gtk/default.nix @@ -0,0 +1,29 @@ +{ lib, stdenvNoCC, fetchFromGitHub, gnome-themes-extra, gtk-engine-murrine }: + +stdenvNoCC.mkDerivation { + pname = "kanagawa-gtk-theme"; + version = "unstable-2023-11-30"; + + src = fetchFromGitHub { + owner = "Fausto-Korpsvart"; + repo = "Kanagawa-GKT-Theme"; + rev = "35936a1e3bbd329339991b29725fc1f67f192c1e"; + hash = "sha256-BZRmjVas8q6zsYbXFk4bCk5Ec/3liy9PQ8fqFGHAXe0="; + }; + + propagatedUserEnvPkgs = [ gtk-engine-murrine ]; + + buildInputs = [ gnome-themes-extra ]; + + dontBuild = true; + + installPhase = '' + runHook preInstall + mkdir -p $out/share/themes/{Kanagawa-Border,Kanagawa-Borderless} + mkdir -p $out/share/icons + cp -r icons/Kanagawa $out/share/icons + cp -r themes/Kanagawa-B/* $out/share/themes/Kanagawa-Border + cp -r themes/Kanagawa-BL/* $out/share/themes/Kanagawa-Borderless + runHook postInstall + ''; +}