as the title states I want to install a custom gtk theme from github (GitHub - B00merang-Project/Windows-7: Linux theme based on the apperance of Windows 7) into home-manager. I cloned the repo and used an overlay but the issue was that the theme.name config would always default to the light theme instead of the custom one regardless of whether I put in the correct name. Is there a better way to install thhis theme for gtk?
What desktop are you using? I only ask because for instance xfce gtk will follow my xfce theme.
Here’s config I’m using to set gtk
’s theme (theme, icons, cursor):
{ config, lib, pkgs, ... }:
let
USERNAME = "...";
GTK_THEME_NAME = "GtkThemeCustom";
GTK_CURSOR_NAME = "Cursors-Win10OS";
GTK_CURSOR_SIZE = 24;
GTK_ICONS_NAME = "Archdroid-Grey";
GTK_FONT = "Liberation Mono 9";
GTK_DARK = true;
GTK_THEME_PACKAGE = import ../packages/gtk-theme/package.nix;
GTK_CURSOR_PACKAGE = import ../packages/gtk-cursor-theme.nix;
GTK_ICONS_PACKAGE = import ../packages/gtk-icons-theme.nix;
in
{
home-manager = {
users.${USERNAME} = {
home = {
pointerCursor = {
name = GTK_CURSOR_NAME;
gtk.enable = true;
package = GTK_CURSOR_PACKAGE;
};
sessionVariables = {
GTK_THEME = GTK_THEME_NAME;
};
};
gtk = {
enable = true;
theme = {
name = GTK_THEME_NAME;
package = GTK_THEME_PACKAGE;
};
iconTheme = {
name = GTK_ICONS_NAME;
package = GTK_ICONS_PACKAGE;
};
cursorTheme = {
name = GTK_CURSOR_NAME;
package = GTK_CURSOR_PACKAGE;
};
gtk3 = {
extraConfig = {
gtk-application-prefer-dark-theme = GTK_DARK;
gtk-font-name = GTK_FONT;
gtk-cursor-theme-size = GTK_CURSOR_SIZE;
# gtk-application-prefer-dark-theme = "";
# gtk-font-name = "";
# gtk-cursor-theme-size = 24;
# gtk-toolbar-style = 3;
# gtk-toolbar-icon-size = "GTK_ICON_SIZE_SMALL_TOOLBAR";
# gtk-button-images = 0;
# gtk-menu-images = 0;
# gtk-enable-event-sounds = 1;
# gtk-enable-input-feedback-sounds = 0;
# gtk-xft-antialias = 1;
# gtk-xft-hinting = 1;
# gtk-xft-hintstyle = "hintslight";
# gtk-xft-rgba = "rgb";
# gtk-decoration-layout = "icon:minimize,maximize,close";
# gtk-enable-animations = true;
# gtk-modules = "colorreload-gtk-module";
# gtk-primary-button-warps-slider = true;
# gtk-sound-theme-name = "ocean";
# gtk-xft-dpi = 98304;
};
};
};
# gtk 4
dconf.settings = {
"org/gnome/desktop/interface" = {
gtk-theme = GTK_THEME_NAME;
color-scheme = lib.mkIf GTK_DARK "prefer-dark";
};
};
};
};
}
Packaging themes (output must be cp
to $out/share/themes
for themes, to $out/share/icons
for cursor and icons themes)
# from local files
let
pkgs = import <nixpkgs> {};
themeName = "GtkThemeCustom";
themeSource = /path/to/theme;
in
pkgs.stdenv.mkDerivation {
name = "gtk-theme";
src = themeSource;
dontBuild = true;
installPhase = ''
mkdir -p $out/share/themes/
cp -r . $out/share/themes/${themeName}
'';
}
# from git repo
let
pkgs = import <nixpkgs> {};
themeName = "Cursors-Win10OS";
in
pkgs.stdenv.mkDerivation {
name = "gtk-cursor-theme";
# https://github.com/yeyushengfan258/Win10OS-cursors
src = builtins.fetchGit {
url = "https://github.com/yeyushengfan258/Win10OS-cursors.git";
};
buildPhase = ''
sh ./build.sh
'';
installPhase = ''
mkdir -p $out/share/icons/
cp -r ./dist/. $out/share/icons/${themeName}
'';
}