From d86e4c5be15dbbfa9f95337cb17f78279b121634 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Fri, 25 Oct 2024 15:05:48 -0400 Subject: [PATCH] desktop: add kde modules (#143) * theme: don't set kde qt theme if kde is enabled * home: add kde option * nixos: add kde module * hyprland: set kde theme variables * desktop: set libadwaita headerbar buttons for kde * greetd: tuigreet -> regreet --- homeManagerModules/desktop/default.nix | 2 +- .../desktop/hyprland/settings.nix | 5 +++ homeManagerModules/options.nix | 6 +++ homeManagerModules/theme.nix | 2 +- nixosModules/desktop/default.nix | 2 + nixosModules/desktop/greetd/default.nix | 37 ++++++++++--------- nixosModules/desktop/kde/default.nix | 9 +++++ nixosModules/options.nix | 1 + 8 files changed, 45 insertions(+), 19 deletions(-) create mode 100644 nixosModules/desktop/kde/default.nix diff --git a/homeManagerModules/desktop/default.nix b/homeManagerModules/desktop/default.nix index af03c67a..491f739b 100644 --- a/homeManagerModules/desktop/default.nix +++ b/homeManagerModules/desktop/default.nix @@ -21,7 +21,7 @@ enable = true; settings = { "org/gnome/desktop/wm/preferences".button-layout = - if config.ar.home.desktop.gnome.enable + if (config.ar.home.desktop.gnome.enable || config.ar.home.desktop.kde.enable) then "appmenu:minimize,maximize,close" else ""; diff --git a/homeManagerModules/desktop/hyprland/settings.nix b/homeManagerModules/desktop/hyprland/settings.nix index 32d0f020..aedc75e8 100644 --- a/homeManagerModules/desktop/hyprland/settings.nix +++ b/homeManagerModules/desktop/hyprland/settings.nix @@ -129,6 +129,11 @@ in { dwindle.preserve_split = true; + env = [ + "QT_QPA_PLATFORMTHEME,kde" + "QT_STYLE_OVERRIDE,Breeze" + ]; + exec-once = [ "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" ]; diff --git a/homeManagerModules/options.nix b/homeManagerModules/options.nix index ed28406a..3dc8544e 100644 --- a/homeManagerModules/options.nix +++ b/homeManagerModules/options.nix @@ -136,6 +136,12 @@ in { }; }; + kde.enable = lib.mkOption { + description = "KDE Plasma with sane defaults."; + default = osConfig.ar.desktop.kde.enable; + type = lib.types.bool; + }; + sway = { enable = lib.mkOption { description = "Sway with full desktop session components."; diff --git a/homeManagerModules/theme.nix b/homeManagerModules/theme.nix index a3464a5d..863b3af1 100644 --- a/homeManagerModules/theme.nix +++ b/homeManagerModules/theme.nix @@ -21,7 +21,7 @@ in { package = pkgs.papirus-icon-theme.override {color = "adwaita";}; }; - qt = { + qt = lib.mkIf (!config.ar.home.desktop.kde.enable) { enable = true; platformTheme.name = "kde"; style.name = "Breeze"; diff --git a/nixosModules/desktop/default.nix b/nixosModules/desktop/default.nix index 464eca44..1332c5b2 100644 --- a/nixosModules/desktop/default.nix +++ b/nixosModules/desktop/default.nix @@ -8,6 +8,7 @@ ./greetd ./gnome ./hyprland + ./kde ./sway ./waylandComp.nix ]; @@ -16,6 +17,7 @@ lib.mkIf ( config.ar.desktop.gnome.enable || config.ar.desktop.hyprland.enable + || config.ar.desktop.kde.enable || config.ar.desktop.steam.enable || config.ar.desktop.sway.enable ) { diff --git a/nixosModules/desktop/greetd/default.nix b/nixosModules/desktop/greetd/default.nix index 4d0a456c..5433e3f5 100644 --- a/nixosModules/desktop/greetd/default.nix +++ b/nixosModules/desktop/greetd/default.nix @@ -1,7 +1,6 @@ { config, lib, - pkgs, ... }: { config = lib.mkIf config.ar.desktop.greetd.enable { @@ -11,25 +10,29 @@ kwallet.enable = true; }; + programs.regreet = { + enable = true; + + settings = { + background.fit = + if config.stylix.imageScalingMode == "fill" + then "Fill" + else "ScaleDown"; + + GTK.application_prefer_dark_theme = + if config.stylix.polarity == "dark" + then true + else false; + }; + }; + services.greetd = { enable = true; - settings = - if config.ar.desktop.greetd.autologin != null - then { - default_session = { - command = lib.mkDefault "${lib.getExe pkgs.greetd.tuigreet} --asterisks --user-menu -g 'Welcome to NixOS ${config.system.nixos.release}' --time --remember --cmd ${config.ar.desktop.greetd.session}"; - }; - initial_session = { - command = config.ar.desktop.greetd.session; - user = config.ar.desktop.greetd.autologin; - }; - } - else { - default_session = { - command = lib.mkDefault "${lib.getExe pkgs.greetd.tuigreet} --asterisks --user-menu -g 'Welcome to NixOS ${config.system.nixos.release}' --time --remember --cmd ${config.ar.desktop.greetd.session}"; - }; - }; + settings.initial_session = lib.mkIf (config.ar.desktop.greetd.autologin != null) { + command = config.ar.desktop.greetd.session; + user = config.ar.desktop.greetd.autologin; + }; }; }; } diff --git a/nixosModules/desktop/kde/default.nix b/nixosModules/desktop/kde/default.nix new file mode 100644 index 00000000..36afa5e4 --- /dev/null +++ b/nixosModules/desktop/kde/default.nix @@ -0,0 +1,9 @@ +{ + config, + lib, + ... +}: { + config = lib.mkIf config.ar.desktop.kde.enable { + services.desktopManager.plasma6.enable = true; + }; +} diff --git a/nixosModules/options.nix b/nixosModules/options.nix index 0959db3d..f91bb107 100644 --- a/nixosModules/options.nix +++ b/nixosModules/options.nix @@ -31,6 +31,7 @@ gnome.enable = lib.mkEnableOption "GNOME desktop session."; hyprland.enable = lib.mkEnableOption "Hyprland wayland session."; + kde.enable = lib.mkEnableOption "KDE desktop session."; steam.enable = lib.mkEnableOption "Steam + Gamescope session."; sway.enable = lib.mkEnableOption "Sway wayland session."; };