11.stylix/modules/qt/nixos.nix
awwpotato 0e7b897c73
flake: update all inputs (#1881)
Update all inputs, rename the KDE platform, and apply formatter changes
by running the following commands:

    biome check --unsafe --write
    pre-commit run --all-files

Rename the KDE platform, following local commit f47c0edcf7 ("treewide:
remove Plasma 5 support dropped upstream (#1860)") and upstream commits
[1] ("nixos/treewide: clean up some more references to deleted qt5
things") and [2] ("qt: deprecate kde6").

[1]: 31d5c4e753
[2]: 1e759786e5

Closes: https://github.com/nix-community/stylix/issues/1865
Link: https://github.com/nix-community/stylix/pull/1866
Link: https://github.com/nix-community/stylix/pull/1881

Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
Co-authored-by: Samuel Meenzen <samuel@meenzen.net>
Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
Reviewed-by: Daniel Thwaites <danth@danth.me>
2025-09-05 22:22:06 +02:00

48 lines
1.3 KiB
Nix

{ lib, config, ... }:
let
recommendedStyle = {
gnome = if config.stylix.polarity == "dark" then "adwaita-dark" else "adwaita";
kde = "breeze";
qtct = "kvantum";
};
in
{
options.stylix.targets.qt = {
enable = config.lib.stylix.mkEnableTarget "QT" true;
platform = lib.mkOption {
description = ''
Selects the platform theme to use for Qt applications.
Defaults to the standard platform used in the configured DE.
'';
type = lib.types.str;
default = "qtct";
};
};
config =
let
inherit (config.services.xserver.desktopManager) lxqt;
inherit (config.services.desktopManager) gnome plasma6;
in
lib.mkIf (config.stylix.enable && config.stylix.targets.qt.enable) {
stylix.targets.qt.platform =
if gnome.enable && !(plasma6.enable || lxqt.enable) then
"gnome"
else if plasma6.enable && !(gnome.enable || lxqt.enable) then
"kde"
else if lxqt.enable && !(gnome.enable || plasma6.enable) then
"lxqt"
else
"qtct";
qt = {
enable = true;
style = recommendedStyle."${config.qt.platformTheme}" or null;
platformTheme =
if config.stylix.targets.qt.platform == "qtct" then
"qt5ct"
else
config.stylix.targets.qt.platform;
};
};
}