style: cleanup gtk theming
This commit is contained in:
parent
b998471e57
commit
03374732ad
2 changed files with 72 additions and 78 deletions
|
@ -4,18 +4,43 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (builtins) toString isBool;
|
||||||
|
inherit (lib.generators) toINI;
|
||||||
|
inherit (lib.modules) mkMerge mkIf;
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) str package;
|
inherit (lib.types) str package;
|
||||||
|
inherit (lib.strings) escape;
|
||||||
|
inherit (lib.trivial) boolToString;
|
||||||
|
|
||||||
cfg = config.modules.theming.gtk;
|
cfg = config.modules.theming.gtk;
|
||||||
|
|
||||||
|
toGtk3Ini = toINI {
|
||||||
|
mkKeyValue = key: value: let
|
||||||
|
value' =
|
||||||
|
if isBool value
|
||||||
|
then boolToString value
|
||||||
|
else toString value;
|
||||||
|
in "${escape ["="] key}=${value'}";
|
||||||
|
};
|
||||||
|
|
||||||
|
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";
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
options.modules.theming.gtk = {
|
options.modules.theming.gtk = {
|
||||||
enable = mkEnableOption "Wether to enable GTK theming";
|
enable = mkEnableOption "Wether to enable GTK theming";
|
||||||
theme = {
|
theme = {
|
||||||
name = mkOption {
|
name = mkOption {
|
||||||
description = "The GTK theme name";
|
description = "The GTK theme name";
|
||||||
default = "Gruvbox-Dark-BL";
|
default = "Gruvbox-Dark";
|
||||||
type = str;
|
type = str;
|
||||||
};
|
};
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
|
@ -28,7 +53,7 @@ in {
|
||||||
description = "The GTK icon theme";
|
description = "The GTK icon theme";
|
||||||
name = mkOption {
|
name = mkOption {
|
||||||
description = "The GTK icon theme name";
|
description = "The GTK icon theme name";
|
||||||
default = "Papirus-Dark";
|
default = "Papirus";
|
||||||
type = str;
|
type = str;
|
||||||
};
|
};
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
|
@ -38,27 +63,48 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = mkIf cfg.enable {
|
config = let
|
||||||
# NOTE: we need this or gtk breaks
|
cursorSize = 32;
|
||||||
|
in
|
||||||
|
mkIf cfg.enable {
|
||||||
programs.dconf.enable = true;
|
programs.dconf.enable = true;
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
systemPackages = builtins.attrValues {
|
systemPackages = builtins.attrValues {
|
||||||
inherit
|
inherit
|
||||||
(pkgs)
|
(pkgs)
|
||||||
|
rose-pine-cursor
|
||||||
gruvbox-gtk-theme
|
gruvbox-gtk-theme
|
||||||
papirus-icon-theme
|
papirus-icon-theme
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
variables = let
|
variables = {
|
||||||
cursorSize = 32;
|
GTK_THEME = cfg.theme.name;
|
||||||
in {
|
|
||||||
GTK_THEME = "Gruvbox-Dark";
|
|
||||||
XCURSOR_THEME = "BreezeX-RosePine-Linux";
|
XCURSOR_THEME = "BreezeX-RosePine-Linux";
|
||||||
XCURSOR_SIZE = cursorSize;
|
XCURSOR_SIZE = toString cursorSize;
|
||||||
|
|
||||||
HYPRCURSOR_THEME = "BreezeX-RosePine-Linux";
|
HYPRCURSOR_THEME = "BreezeX-RosePine-Linux";
|
||||||
HYPRCURSOR_SIZE = cursorSize;
|
HYPRCURSOR_SIZE = toString cursorSize;
|
||||||
|
};
|
||||||
|
etc = {
|
||||||
|
"xdg/gtk-4.0/settings.ini".text = toGtk3Ini {
|
||||||
|
Settings = gtkIni;
|
||||||
|
};
|
||||||
|
"xdg/gtk-3.0/settings.ini".text = toGtk3Ini {
|
||||||
|
Settings = gtkIni;
|
||||||
|
};
|
||||||
|
|
||||||
|
"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
|
||||||
|
'';
|
||||||
|
|
||||||
|
"xdg/Xresources".text = ''
|
||||||
|
Xcursor.size: ${toString cursorSize}
|
||||||
|
Xcursor.theme: BreezeX-RosePine-Linux
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,67 +4,15 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) toString isBool;
|
|
||||||
inherit (lib.generators) toINI;
|
|
||||||
inherit (lib.modules) mkMerge mkIf;
|
inherit (lib.modules) mkMerge mkIf;
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkEnableOption;
|
||||||
inherit (lib.strings) escape;
|
|
||||||
inherit (lib.trivial) boolToString;
|
|
||||||
|
|
||||||
cfg = config.modules.theming;
|
cfg = config.modules.theming;
|
||||||
|
|
||||||
toGtk3Ini = toINI {
|
|
||||||
mkKeyValue = key: value: let
|
|
||||||
value' =
|
|
||||||
if isBool value
|
|
||||||
then boolToString value
|
|
||||||
else toString value;
|
|
||||||
in "${escape ["="] key}=${value'}";
|
|
||||||
};
|
|
||||||
|
|
||||||
gtkIni = {
|
|
||||||
gtk-application-prefer-dark-theme = 1;
|
|
||||||
gtk-font-name = "Lexend 11";
|
|
||||||
gtk-icon-theme-name = "Papirus-Dark";
|
|
||||||
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";
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
options.modules.theming = {
|
options.modules.theming = {
|
||||||
qt.enable = mkEnableOption "qt theming";
|
qt.enable = mkEnableOption "qt theming";
|
||||||
};
|
};
|
||||||
config = mkMerge [
|
config =
|
||||||
(mkIf cfg.gtk.enable {
|
mkMerge [
|
||||||
environment = {
|
|
||||||
systemPackages = builtins.attrValues {
|
|
||||||
inherit (pkgs) rose-pine-cursor;
|
|
||||||
};
|
|
||||||
etc = {
|
|
||||||
"xdg/gtk-4.0/settings.ini".text = toGtk3Ini {
|
|
||||||
Settings = gtkIni;
|
|
||||||
};
|
|
||||||
"xdg/gtk-3.0/settings.ini".text = toGtk3Ini {
|
|
||||||
Settings = gtkIni;
|
|
||||||
};
|
|
||||||
|
|
||||||
"xdg/gtk-2.0/gtkrc".text = ''
|
|
||||||
gtk-cursor-theme-name = BreezeX-RosePine-Linux
|
|
||||||
gtk-cursor-theme-size = 32
|
|
||||||
gtk-theme-name = Gruvbox-Dark
|
|
||||||
gtk-icon-theme-name = Papirus-Dark
|
|
||||||
gtk-font-name = Lexend 11
|
|
||||||
'';
|
|
||||||
|
|
||||||
"xdg/Xresources".text = ''
|
|
||||||
Xcursor.size: 32
|
|
||||||
Xcursor.theme: BreezeX-RosePine-Linux
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue