niksos/modules/gui/qt.nix

95 lines
3.2 KiB
Nix

{
config,
lib,
pkgs,
...
}: let
cfg = config.poz.themes.qt;
inherit (config.poz.other.system) username;
inherit (lib.attrsets) attrValues;
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) package str;
in {
options.poz.themes.qt = {
enable = mkEnableOption "qt theming";
name = mkOption {
description = "qt theme name";
type = str;
};
variant = mkOption {
description = "qt theme variant";
type = str;
};
accentColour = mkOption {
description = "accent colour for qt theme";
type = str;
};
package = mkOption {
description = "qt theme package";
type = package;
};
};
config = mkIf cfg.enable {
environment.sessionVariables = {
QT_QPA_PLATFORMTHEME = "qt5ct";
};
home-manager.users.${username} = {
# thanks raf :3 https://github.com/NotAShelf/nyx/blob/main/homes/notashelf/themes/qt.nix
qt = {
enable = true;
platformTheme.name = "qtct";
style = {
inherit (cfg) name;
package = cfg.package.override {
flavour = [ cfg.variant ];
accents = [ cfg.accentColour ];
};
};
};
home = {
packages = attrValues {
inherit (pkgs.qt5) qttools;
inherit (pkgs.libsForQt5)
qtstyleplugin-kvantum
qt5ct
;
inherit (pkgs) breeze-icons;
} ++ [
pkgs.qt6Packages.qtstyleplugin-kvantum
];
sessionVariables = {
#QT_STYLE_OVERRIDE = "kvantum";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
QT_QPA_PLATFORM = "wayland;xcb";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
DISABLE_QT_COMPAT = "0";
};
};
# TODO somehow make this configurable IDK
xdg.configFile = {
"Kvantum/catppuccin/catppuccin.kvconfig".source = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/catppuccin/Kvantum/main/themes/catppuccin-mocha-green/catppuccin-mocha-green.kvconfig";
hash = "sha256-IxHmEWYA4Gihxo0ZeKFwbbrdDhKkH412BDFRuj+gwQ0=";
};
"Kvantum/catppuccin/catppuccin.svg".source = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/catppuccin/Kvantum/main/themes/catppuccin-mocha-green/catppuccin-mocha-green.svg";
hash = "sha256-wU3lvBu2GKh/dM0Pgx+PddkU17fH+HO1zGQ8hYswULY=";
};
"Kvantum/kvantum.kvconfig".text = ''
[General]
theme=catppuccin
[Applications]
catppuccin=qt5ct, org.qbittorrent.qBittorrent, hyprland-share-picker
'';
};
};
};
}