2024-05-22 14:29:45 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
2025-03-26 19:16:28 +01:00
|
|
|
pkgs,
|
2024-05-22 14:29:45 +02:00
|
|
|
...
|
2025-07-20 01:23:48 +02:00
|
|
|
}:
|
|
|
|
let
|
2025-04-09 15:31:18 +02:00
|
|
|
inherit (builtins) toString isBool;
|
|
|
|
inherit (lib.generators) toINI;
|
2025-04-09 15:31:18 +02:00
|
|
|
inherit (lib.modules) mkIf;
|
2025-03-26 19:16:28 +01:00
|
|
|
inherit (lib.options) mkOption mkEnableOption;
|
2025-04-09 15:31:18 +02:00
|
|
|
inherit (lib.strings) escape;
|
|
|
|
inherit (lib.trivial) boolToString;
|
2025-04-09 15:31:18 +02:00
|
|
|
inherit (lib.types) str package;
|
2025-04-09 15:31:18 +02:00
|
|
|
|
2025-04-06 14:03:41 +02:00
|
|
|
cfg = config.modules.theming.gtk;
|
2025-04-09 15:31:18 +02:00
|
|
|
|
|
|
|
toGtk3Ini = toINI {
|
2025-07-20 01:23:48 +02:00
|
|
|
mkKeyValue =
|
|
|
|
key: value:
|
|
|
|
let
|
|
|
|
value' = if isBool value then boolToString value else toString value;
|
|
|
|
in
|
|
|
|
"${escape [ "=" ] key}=${value'}";
|
2025-04-09 15:31:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
gtkIni = {
|
|
|
|
gtk-application-prefer-dark-theme = 1;
|
|
|
|
gtk-font-name = "Lexend 11";
|
|
|
|
gtk-icon-theme-name = "Papirus";
|
|
|
|
gtk-xft-antialias = 1;
|
|
|
|
gtk-xft-hinting = 1;
|
|
|
|
gtk-xft-hintstyle = "hintslight";
|
|
|
|
gtk-xft-rgba = "rgb";
|
|
|
|
gtk-cursor-theme-name = "BreezeX-RosePine-Linux";
|
|
|
|
gtk-theme-name = "Gruvbox-Dark";
|
|
|
|
};
|
2025-07-20 01:23:48 +02:00
|
|
|
in
|
|
|
|
{
|
2025-04-06 14:03:41 +02:00
|
|
|
options.modules.theming.gtk = {
|
2025-03-26 19:16:28 +01:00
|
|
|
enable = mkEnableOption "Wether to enable GTK theming";
|
|
|
|
theme = {
|
|
|
|
name = mkOption {
|
|
|
|
description = "The GTK theme name";
|
2025-04-09 15:31:18 +02:00
|
|
|
default = "Gruvbox-Dark";
|
2025-03-26 19:16:28 +01:00
|
|
|
type = str;
|
|
|
|
};
|
|
|
|
package = mkOption {
|
|
|
|
description = "The GTK theme package";
|
|
|
|
default = pkgs.gruvbox-gtk-theme;
|
|
|
|
type = package;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
iconTheme = {
|
|
|
|
description = "The GTK icon theme";
|
|
|
|
name = mkOption {
|
|
|
|
description = "The GTK icon theme name";
|
2025-04-09 15:31:18 +02:00
|
|
|
default = "Papirus";
|
2025-03-26 19:16:28 +01:00
|
|
|
type = str;
|
|
|
|
};
|
|
|
|
package = mkOption {
|
|
|
|
description = "The GTK icon theme package";
|
2025-04-06 14:03:41 +02:00
|
|
|
default = pkgs.papirus-icon-theme;
|
2025-03-26 19:16:28 +01:00
|
|
|
type = package;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2025-07-20 01:23:48 +02:00
|
|
|
config =
|
|
|
|
let
|
|
|
|
cursorSize = 32;
|
|
|
|
in
|
2025-04-09 15:31:18 +02:00
|
|
|
mkIf cfg.enable {
|
|
|
|
programs.dconf.enable = true;
|
|
|
|
environment = {
|
|
|
|
systemPackages = builtins.attrValues {
|
2025-07-20 01:23:48 +02:00
|
|
|
inherit (pkgs)
|
2025-04-09 15:31:18 +02:00
|
|
|
rose-pine-cursor
|
|
|
|
gruvbox-gtk-theme
|
|
|
|
papirus-icon-theme
|
2025-04-09 15:31:18 +02:00
|
|
|
colloid-icon-theme
|
2025-04-09 15:31:18 +02:00
|
|
|
;
|
|
|
|
};
|
|
|
|
variables = {
|
|
|
|
GTK_THEME = cfg.theme.name;
|
|
|
|
XCURSOR_THEME = "BreezeX-RosePine-Linux";
|
2025-04-09 15:31:18 +02:00
|
|
|
XCURSOR_SIZE = cursorSize;
|
2025-04-09 15:31:18 +02:00
|
|
|
};
|
2025-07-20 01:23:48 +02:00
|
|
|
etc =
|
|
|
|
let
|
|
|
|
css = import ./gtk-colors.nix { inherit (config.modules.style.colorScheme) colors; };
|
|
|
|
in
|
|
|
|
{
|
|
|
|
"xdg/gtk-4.0/settings.ini".text = toGtk3Ini {
|
|
|
|
Settings = gtkIni;
|
|
|
|
};
|
|
|
|
"xdg/gtk-3.0/settings.ini".text = toGtk3Ini {
|
|
|
|
Settings = gtkIni;
|
|
|
|
};
|
|
|
|
"xdg/gtk-4.0/gtk.css".text = css;
|
|
|
|
"xdg/gtk-3.0/gtk.css".text = css;
|
2025-04-09 15:31:18 +02:00
|
|
|
|
2025-07-20 01:23:48 +02:00
|
|
|
"xdg/gtk-2.0/gtkrc".text = ''
|
|
|
|
gtk-cursor-theme-name = BreezeX-RosePine-Linux
|
|
|
|
gtk-cursor-theme-size = ${toString cursorSize}
|
|
|
|
gtk-theme-name = ${cfg.theme.name}
|
|
|
|
gtk-icon-theme-name = ${cfg.iconTheme.name}
|
|
|
|
gtk-font-name = Lexend 11
|
|
|
|
'';
|
2025-04-06 14:03:41 +02:00
|
|
|
|
2025-07-20 01:23:48 +02:00
|
|
|
"xdg/Xresources".text = ''
|
|
|
|
Xcursor.size: ${toString cursorSize}
|
|
|
|
Xcursor.theme: BreezeX-RosePine-Linux
|
|
|
|
'';
|
|
|
|
};
|
2025-04-06 14:03:41 +02:00
|
|
|
};
|
|
|
|
};
|
2024-04-10 17:39:26 +02:00
|
|
|
}
|