dotfiles
My PC Dotfiles & Websitegit clone https://github.com/maydayv7/dotfiles
modules/gui/qt.nix (3263B)
1## QT Configuration ##
2_: {
3 flake.modules = {
4 nixos.qt = {
5 config,
6 lib,
7 pkgs,
8 ...
9 }: let
10 inherit (lib) mkOption types;
11 cfg = config.gui.qt;
12 in {
13 options.gui.qt = {
14 theme = mkOption {
15 description = "QT Application Theme";
16 type = types.str;
17 default = "";
18 };
19
20 package = mkOption {
21 description = "QT Theme Package";
22 type = types.package;
23 default = pkgs.adwaita-qt;
24 };
25 };
26
27 # Kvantum Style
28 config = {
29 stylix.targets.qt.enable = false;
30 qt = {
31 enable = true;
32 platformTheme = "qt5ct";
33 style = "kvantum";
34 };
35
36 environment = {
37 systemPackages = [
38 cfg.package
39 pkgs.libsForQt5.qt5ct
40 pkgs.kdePackages.qt6ct
41 ];
42
43 etc."xdg/Kvantum/kvantum.kvconfig".text = ''
44 [General]
45 theme=${cfg.theme}
46 '';
47 };
48 };
49 };
50
51 homeManager.qt = {
52 config,
53 lib,
54 osConfig ? {},
55 ...
56 }: let
57 inherit (builtins) concatStringsSep map;
58 cfg = osConfig.gui.qt or {};
59 in {
60 gui._unmanaged = ["qt"];
61 xdg.configFile."Kvantum" = lib.mkIf (cfg ? package) {
62 source = "${cfg.package}/share/Kvantum";
63 recursive = true;
64 };
65
66 # KDE Apps
67 home.file.".config/kdeglobals".text = with config.lib.stylix.colors;
68 ''
69 [Colors:Selection]
70 BackgroundNormal=${base0D-rgb-r},${base0D-rgb-g},${base0D-rgb-b}
71 BackgroundAlternate=${base0D-rgb-r},${base0D-rgb-g},${base0D-rgb-b}
72 ForegroundNormal=${base00-rgb-r},${base00-rgb-g},${base00-rgb-b}
73 ForegroundActive=${base00-rgb-r},${base00-rgb-g},${base00-rgb-b}
74 ForegroundInactive=${base00-rgb-r},${base00-rgb-g},${base00-rgb-b}
75 ForegroundLink=${base00-rgb-r},${base00-rgb-g},${base00-rgb-b}
76 ForegroundVisited=${base00-rgb-r},${base00-rgb-g},${base00-rgb-b}
77 ''
78 + (concatStringsSep "\n" (
79 map
80 (name: ''
81 [Colors:${name}]
82 BackgroundNormal=${base00-rgb-r},${base00-rgb-g},${base00-rgb-b}
83 BackgroundAlternate=${base01-rgb-r},${base01-rgb-g},${base01-rgb-b}
84 DecorationFocus=${base0D-rgb-r},${base0D-rgb-g},${base0D-rgb-b}
85 DecorationHover=${base0D-rgb-r},${base0D-rgb-g},${base0D-rgb-b}
86 ForegroundNormal=${base05-rgb-r},${base05-rgb-g},${base05-rgb-b}
87 ForegroundActive=${base05-rgb-r},${base05-rgb-g},${base05-rgb-b}
88 ForegroundInactive =${base05-rgb-r},${base05-rgb-g},${base05-rgb-b}
89 ForegroundLink=${base05-rgb-r},${base05-rgb-g},${base05-rgb-b}
90 ForegroundVisited=${base05-rgb-r},${base05-rgb-g},${base05-rgb-b}
91 ForegroundNegative=${base08-rgb-r},${base08-rgb-g},${base08-rgb-b}
92 ForegroundNeutral=${base0D-rgb-r},${base0D-rgb-g},${base0D-rgb-b}
93 ForegroundPositive=${base0B-rgb-r},${base0B-rgb-g},${base0B-rgb-b}
94 '')
95 [
96 "View"
97 "Window"
98 "Button"
99 "Tooltip"
100 "Complementary"
101 ]
102 ));
103 };
104 };
105}