style: setup qt and gtk styles, options and defaults

This commit is contained in:
Charlie Root 2024-08-16 13:32:47 +02:00
commit b7da4a442b
4 changed files with 97 additions and 43 deletions

View file

@ -0,0 +1,59 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
theme = {
package = pkgs.gruvbox-gtk-theme;
name = "Gruvbox-Dark-BL";
};
cfg = config.modules.theming.qt;
inherit (config.modules.other.system) username;
in {
options.modules.theming.qt = {
enable = mkEnableOption "qt theming";
name = mkOption {
description = "qt theme name";
type = types.str;
};
variant = mkOption {
description = "qt theme variant";
type = types.str;
};
accentColor = mkOption {
description = "accent colour for qt theme";
type = types.str;
};
package = mkOption {
description = "qt theme package";
type = types.package;
};
};
config = mkIf cfg.enable {
environment.sessionVariables = {QT_QPA_PLATFORMTHEME = "qt5ct";};
environment.variables = {
QT_STYLE_OVERRIDE = lib.mkForce "kvantum";
GTK_THEME = theme.name;
};
home-manager.users.${username} = {
qt = {
enable = true;
# style = {
# inherit (cfg) name package;
# };
};
home = {
packages = with pkgs; [
qt5.qttools
libsForQt5.qt5ct
libsForQt5.qtstyleplugin-kvantum
breeze-icons
];
};
};
};
}

View file

@ -20,4 +20,13 @@ in {
corefonts
]
++ optional (extraFonts != null) extraFonts;
# this fixes emoji stuff
fontconfig = {
defaultFonts = {
monospace = ["ComicShannsMono Nerd Font" "Noto Color Emoji"];
sansSerif = ["ComicShannsMono Nerd Font" "Noto Color Emoji"];
serif = ["ComicShannsMono Nerd Font" "Noto Color Emoji"];
emoji = ["Noto Color Emoji"];
};
};
}

View file

@ -9,50 +9,54 @@ with lib; let
package = pkgs.gruvbox-gtk-theme;
name = "Gruvbox-Dark-BL";
};
cfg = config.modules.theming.qt;
cfg = config.modules.style.qt;
inherit (config.modules.other.system) username;
in {
options.modules.theming.qt = {
enable = mkEnableOption "qt theming";
name = mkOption {
description = "qt theme name";
type = types.str;
};
variant = mkOption {
description = "qt theme variant";
type = types.str;
};
accentColour = mkOption {
description = "accent colour for qt theme";
type = types.str;
};
package = mkOption {
description = "qt theme package";
type = types.package;
};
};
config = mkIf cfg.enable {
environment.sessionVariables = {QT_QPA_PLATFORMTHEME = "qt5ct";};
environment.variables = {
QT_STYLE_OVERRIDE = lib.mkForce "kvantum";
GTK_THEME = theme.name;
};
home-manager.users.${username} = {
# This is taken from jacekpoz, thanks a lot!
qt = {
enable = true;
# style = {
# inherit (cfg) name package;
# };
style = {
inherit (cfg) name;
package = cfg.package.override {
flavour = [cfg.variant];
accents = [cfg.accentColor];
};
};
};
home = {
packages = with pkgs; [
qt5.qttools
libsForQt5.qt5ct
qt6Packages.qtstyleplugin-kvantum
libsForQt5.qtstyleplugin-kvantum
libsForQt5.qt5ct
breeze-icons
];
sessionVariables = {
# Scaling factor for QT applications
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
# Use wayland as the default backend, fall back to xcb if not available
QT_QPA_PLATFORM = "wayland;xcb";
# Disable window decorations for qt applications
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
# Remain compatible with QT5 whenever possible
DISABLE_QT_COMPAT = "0";
# Tell Calibre to use the dark theme, because the light one hurts my eyes.
CALIBRE_USE_DARK_PALETTE = "1";
};
};
};
};

View file

@ -48,25 +48,7 @@ in {
# package = pkgs.bibata-cursors;
# name = "Bibata-Modern-Classic";
};
fonts = {
sizes = {
inherit (fontsizes) terminal popups applications;
};
monospace = {
package =
pkgs.nerdfonts.override {fonts = ["JetBrainsMono" "ComicShannsMono"];};
# name = "JetBrainsMono";
name = "ComicShannsMono Nerd Font";
};
serif = config.stylix.fonts.monospace;
sansSerif = config.stylix.fonts.monospace;
emoji = {
package = pkgs.noto-fonts-color-emoji;
name = "Noto Color Emoji";
};
};
opacity = {
applications = 1.0;
popups = 1.0;