niksos/modules/gui/qt.nix

88 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,
...
2023-10-13 21:04:24 +02:00
}: with lib; let
cfg = config.myOptions.themes.qt;
username = config.myOptions.other.system.username;
2023-10-13 21:04:24 +02:00
in {
options.myOptions.themes.qt = {
enable = mkEnableOption "enable 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;
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;
2023-11-25 17:12:09 +01:00
platformTheme = "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
};
}