11.stylix/modules/qt/nixos.nix
ArchercatNEO 8d5cd725ad
qt: fix kvantum breaking plasma6 (#1128)
Reviewed-by: Kilian Mio <86004375+Mikilio@users.noreply.github.com>
2025-04-17 10:21:11 -07:00

58 lines
1.5 KiB
Nix

{
lib,
pkgs,
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" pkgs.stdenv.hostPlatform.isLinux;
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) gnome plasma5 lxqt;
inherit (config.services.desktopManager) plasma6;
in
lib.mkIf (config.stylix.enable && config.stylix.targets.qt.enable) {
stylix.targets.qt.platform =
if gnome.enable && !(plasma5.enable || plasma6.enable || lxqt.enable) then
"gnome"
else if plasma5.enable && !(gnome.enable || plasma6.enable || lxqt.enable) then
"kde"
else if plasma6.enable && !(gnome.enable || plasma5.enable || lxqt.enable) then
"kde6"
else if lxqt.enable && !(gnome.enable || plasma5.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;
};
};
}