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

@ -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";
};
};
};
};