niksos/modules/gui/qt.nix

96 lines
3.2 KiB
Nix
Raw Normal View History

2023-09-08 16:10:15 +02:00
{
2023-10-13 21:04:24 +02:00
config,
lib,
2023-09-08 16:10:15 +02:00
pkgs,
...
2024-05-05 12:38:40 +02:00
}: let
2024-07-15 23:18:25 +02:00
cfg = config.poz.themes.qt;
inherit (config.poz.other.system) username;
2024-05-05 12:38:40 +02:00
inherit (lib.attrsets) attrValues;
2024-07-25 11:45:44 +02:00
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption mkOption;
2024-05-05 12:38:40 +02:00
inherit (lib.types) package str;
2023-10-13 21:04:24 +02:00
in {
2024-07-15 23:18:25 +02:00
options.poz.themes.qt = {
2024-04-05 22:59:32 +02:00
enable = mkEnableOption "qt theming";
2023-10-13 21:04:24 +02:00
name = mkOption {
description = "qt theme name";
2024-05-05 12:38:40 +02:00
type = str;
2023-10-13 21:04:24 +02:00
};
variant = mkOption {
description = "qt theme variant";
2024-05-05 12:38:40 +02:00
type = str;
2023-10-13 21:04:24 +02:00
};
accentColour = mkOption {
description = "accent colour for qt theme";
2024-05-05 12:38:40 +02:00
type = str;
2023-10-13 21:04:24 +02:00
};
package = mkOption {
description = "qt theme package";
2024-05-05 12:38:40 +02:00
type = package;
2023-09-08 16:10:15 +02:00
};
};
2023-10-13 21:04:24 +02:00
config = mkIf cfg.enable {
environment.sessionVariables = {
QT_QPA_PLATFORMTHEME = "qt5ct";
};
home-manager.users.${username} = {
2023-10-13 21:04:24 +02:00
# thanks raf :3 https://github.com/NotAShelf/nyx/blob/main/homes/notashelf/themes/qt.nix
qt = {
enable = true;
2024-05-14 12:31:47 +02:00
platformTheme.name = "qtct";
2023-10-13 21:04:24 +02:00
style = {
inherit (cfg) name;
package = cfg.package.override {
2023-11-25 17:12:09 +01:00
flavour = [ cfg.variant ];
2023-10-13 21:04:24 +02:00
accents = [ cfg.accentColour ];
};
};
};
2023-09-08 16:10:15 +02:00
2023-10-13 21:04:24 +02:00
home = {
packages = attrValues {
inherit (pkgs.qt5) qttools;
inherit (pkgs.libsForQt5)
qtstyleplugin-kvantum
qt5ct
;
inherit (pkgs) breeze-icons;
} ++ [
pkgs.qt6Packages.qtstyleplugin-kvantum
2023-10-13 21:04:24 +02:00
];
2023-09-08 16:10:15 +02:00
2023-10-13 21:04:24 +02:00
sessionVariables = {
2023-11-25 17:12:09 +01:00
#QT_STYLE_OVERRIDE = "kvantum";
2023-10-13 21:04:24 +02:00
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
QT_QPA_PLATFORM = "wayland;xcb";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
DISABLE_QT_COMPAT = "0";
};
};
2023-09-08 16:10:15 +02:00
2023-10-13 21:04:24 +02:00
# TODO somehow make this configurable IDK
xdg.configFile = {
2024-03-06 19:04:41 +01:00
"Kvantum/catppuccin/catppuccin.kvconfig".source = pkgs.fetchurl {
2024-08-27 09:55:17 +02:00
url = "https://raw.githubusercontent.com/catppuccin/Kvantum/main/themes/catppuccin-mocha-green/catppuccin-mocha-green.kvconfig";
hash = "sha256-IxHmEWYA4Gihxo0ZeKFwbbrdDhKkH412BDFRuj+gwQ0=";
2023-10-13 21:04:24 +02:00
};
2024-03-06 19:04:41 +01:00
"Kvantum/catppuccin/catppuccin.svg".source = pkgs.fetchurl {
2024-08-27 09:55:17 +02:00
url = "https://raw.githubusercontent.com/catppuccin/Kvantum/main/themes/catppuccin-mocha-green/catppuccin-mocha-green.svg";
hash = "sha256-wU3lvBu2GKh/dM0Pgx+PddkU17fH+HO1zGQ8hYswULY=";
2023-10-13 21:04:24 +02:00
};
"Kvantum/kvantum.kvconfig".text = ''
[General]
theme=catppuccin
[Applications]
catppuccin=qt5ct, org.qbittorrent.qBittorrent, hyprland-share-picker
'';
};
};
2023-09-08 16:10:15 +02:00
};
}