niksos/modules/gui/qt.nix

91 lines
3 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
2023-10-13 21:04:24 +02:00
cfg = config.myOptions.themes.qt;
2024-04-14 18:49:29 +02:00
inherit (config.myOptions.other.system) username;
2024-05-05 12:38:40 +02:00
inherit (lib) mkEnableOption mkIf mkOption;
inherit (lib.types) package str;
2023-10-13 21:04:24 +02:00
in {
options.myOptions.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 = with pkgs; [
qt5.qttools
qt6Packages.qtstyleplugin-kvantum
libsForQt5.qtstyleplugin-kvantum
libsForQt5.qt5ct
breeze-icons
];
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 {
2023-10-13 21:04:24 +02:00
url = "https://raw.githubusercontent.com/catppuccin/Kvantum/main/src/Catppuccin-Mocha-Green/Catppuccin-Mocha-Green.kvconfig";
sha256 = "16ry4k09nf5w1gyawwz2ny14zn6infqk40l35lqlg30lhgbdmr5f";
};
2024-03-06 19:04:41 +01:00
"Kvantum/catppuccin/catppuccin.svg".source = pkgs.fetchurl {
2023-10-13 21:04:24 +02:00
url = "https://raw.githubusercontent.com/catppuccin/Kvantum/main/src/Catppuccin-Mocha-Green/Catppuccin-Mocha-Green.svg";
sha256 = "1djh625qag34rjsp7y67nzbi9nbmiwgq63ydfizsh65n3fyfakf1";
};
"Kvantum/kvantum.kvconfig".text = ''
[General]
theme=catppuccin
[Applications]
catppuccin=qt5ct, org.qbittorrent.qBittorrent, hyprland-share-picker
'';
};
};
2023-09-08 16:10:15 +02:00
};
}