gtk: fix icons, and apply Tokyonight as default theme

This commit is contained in:
Colin 2023-07-02 11:33:01 +00:00
parent cce87eb6fb
commit 9aea0945a5
2 changed files with 115 additions and 6 deletions

View File

@ -1,7 +1,17 @@
{ config, lib, pkgs }:
# gtk apps search XDG_ICON_DIRS for icons (nixos specific)
# nixos ships the hi-color icon theme by default, which has *some* icons,
# but leaves a lot of standard ones unavailable.
#
# system-wide theme components live in:
# - /run/current-system/sw/share/color-schemes/${theme}
# - /run/current-system/sw/share/icons/${theme}
# - /run/current-system/sw/share/icons/${theme}/cursors (cursor-theme)
# - /run/current-system/sw/share/themes/${theme}/gtk-4.0
{ config, lib, pkgs, ... }:
let
cfg = config.sane.gui.gtk;
themes = {
unsortedThemes = {
# crude assortment of themes in nixpkgs; some might not be gtk themes, some gtk themes might not be in this list
inherit (pkgs)
# themes are in <repo:nixos/nixpkgs:pkgs/data/themes>
adapta-gtk-theme
@ -105,6 +115,74 @@ let
yaru-theme
zuki-themes
;
inherit (pkgs.gnome)
adwaita-icon-theme
gnome-themes-extra
;
};
themes = with pkgs; {
color-scheme = {
default = emptyDirectory;
Dracula = dracula-theme;
DraculaPurple = dracula-theme;
Dracula-cursors = dracula-theme;
};
cursor-theme = {
Adwaita = gnome.adwaita-icon-theme;
};
gtk-theme = {
Adwaita = gnome.gnome-themes-extra; # gtk-3.0
Adwaita-dark = gnome.gnome-themes-extra; # gtk-3.0
Arc = arc-theme; # gtk-4.0
Arc-Dark = arc-theme; # gtk-4.0
Arc-Darker = arc-theme; # gtk-4.0
Arc-Lighter = arc-theme; # gtk-4.0
Dracula = dracula-theme; # gtk-4.0
E17gtk = e17gtk; # gtk-3.0
Fluent = fluent-gtk-theme; # gtk-4.0
Fluent-compact = fluent-gtk-theme; # gtk-4.0
Fluent-Dark = fluent-gtk-theme; # gtk-4.0
Fluent-Dark-compact = fluent-gtk-theme; # gtk-4.0
Fluent-Light = fluent-gtk-theme; # gtk-4.0
Fluent-Light-compact = fluent-gtk-theme; # gtk-4.0, NICE!
HighContrast = gnome.gnome-themes-extra; # gtk-3.0
Matcha-light-azul = matcha-gtk-theme; # gtk-4.0, NICE!
Matcha-light-sea = matcha-gtk-theme; # gtk-4.0, NICE!
# additional Matcha-* omitted
Nordic = nordic; # gtk-4.0
Nordic-bluish-accent = nordic; # gtk-4.0
Nordic-darker = nordic; # gtk-4.0
Nordic-Polar = nordic; # gtk-4.0, NICE
Numix = numix-gtk-theme; # gtk-3.20, meh
NumixSolarizedDarkBlue = numix-solarized-gtk-theme; # gtk-3.20
NumixSolarizedDarkCyan = numix-solarized-gtk-theme; # gtk-3.20
NumixSolarizedDarkGreen = numix-solarized-gtk-theme; # gtk-3.20
NumixSolarizedDarkMagenta = numix-solarized-gtk-theme; # gtk-3.20
NumixSolarizedDarkOrange = numix-solarized-gtk-theme; # gtk-3.20
NumixSolarizedDarkRed = numix-solarized-gtk-theme; # gtk-3.20
NumixSolarizedDarkViolet = numix-solarized-gtk-theme; # gtk-3.20
NumixSolarizedDarkYellow = numix-solarized-gtk-theme; # gtk-3.20
NumixSolarizedLightBlue = numix-solarized-gtk-theme; # gtk-3.20
NumixSolarizedLightBlueDarkTop = numix-solarized-gtk-theme; # gtk-3.20
NumixSolarizedLightCyan = numix-solarized-gtk-theme; # gtk-3.20
NumixSolarizedLightGreen = numix-solarized-gtk-theme; # gtk-3.20
NumixSolarizedLightMagenta = numix-solarized-gtk-theme; # gtk-3.20
NumixSolarizedLightOrange = numix-solarized-gtk-theme; # gtk-3.20
NumixSolarizedLightRed = numix-solarized-gtk-theme; # gtk-3.20
NumixSolarizedLightViolet = numix-solarized-gtk-theme; # gtk-3.20
NumixSolarizedLightYellow = numix-solarized-gtk-theme; # gtk-3.20
NumixStandard = numix-solarized-gtk-theme; # gtk-3.20
Paper = paper-gtk-theme; # gtk-4.0
Pop = pop-gtk-theme; # gtk-4.0
Pop-dark = pop-gtk-theme; # gtk-4.0
Tokyonight-Light-B = tokyo-night-gtk; # gtk-4.0, NICE
# other Tokyonight-* omitted
};
icon-theme = {
Adwaita = gnome.adwaita-icon-theme;
HighContrast = gnome.gnome-themes-extra; # gtk-3.0
};
};
in
{
@ -114,20 +192,49 @@ in
type = types.bool;
description = "apply theme to gtk4 apps";
};
sane.gui.gtk.all = mkOption {
default = false;
type = types.bool;
description = "install all known gtk themes (for testing)";
};
sane.gui.gtk.color-scheme = mkOption {
default = "default";
type = types.str;
};
sane.gui.gtk.cursor-theme = mkOption {
default = "Adwaita";
type = types.str;
};
sane.gui.gtk.gtk-theme = mkOption {
default = "Adwaita";
type = types.str;
};
sane.gui.gtk.icon-theme = mkOption {
default = "Adwaita";
type = types.str;
};
};
config = lib.mkIf cfg.enable {
programs.dconf.packages = [
(pkgs.writeTextFile {
name = "dconf-sway-settings";
destination = "/etc/dconf/db/site.d/10_sway_settings";
destination = "/etc/dconf/db/site.d/10_gtk_settings";
text = ''
[org/gnome/desktop/interface]
gtk-theme="Dracula"
icon-theme="Dracula"
color-scheme="${cfg.color-scheme}"
cursor-theme="${cfg.cursor-theme}"
gtk-theme="${cfg.gtk-theme}"
icon-theme="${cfg.icon-theme}"
'';
})
];
environment.systemPackages = lib.attrValues themes;
# environment.systemPackages = lib.attrValues themes;
environment.systemPackages = [
themes.color-scheme."${cfg.color-scheme}"
themes.cursor-theme."${cfg.cursor-theme}"
themes.gtk-theme."${cfg.gtk-theme}"
themes.icon-theme."${cfg.icon-theme}"
] ++ lib.optionals cfg.all (lib.attrValues unsortedThemes);
};
}

View File

@ -95,6 +95,8 @@ in
(mkIf cfg.enable {
sane.programs.swayApps.enableFor.user.colin = true;
sane.gui.gtk.enable = lib.mkDefault true;
# sane.gui.gtk.gtk-theme = lib.mkDefault "Fluent-Light-compact";
sane.gui.gtk.gtk-theme = lib.mkDefault "Tokyonight-Light-B";
# swap in these lines to use SDDM instead of `services.greetd`.
# services.xserver.displayManager.sddm.enable = true;