{ config, inputs, lib, pkgs, ... }: let cfg = config.nixfiles.modules.kde; in { options.nixfiles.modules.kde.enable = lib.mkEnableOption "KDE Plasma"; config = lib.mkIf cfg.enable { nixfiles.modules = { common.xdg.defaultApplications."org.kde.dolphin" = [ "inode/directory" ]; gnupg.pinentry = pkgs.pinentry-qt; sound.enable = true; }; stylix.targets.qt.enable = false; hm = { imports = [ inputs.plasma-manager.homeManagerModules.plasma-manager ]; stylix.targets.qt.enable = false; home.sessionVariables.GTK_THEME = config.hm.gtk.theme.name; gtk.theme = lib.mkForce { package = pkgs.kdePackages.breeze-gtk; name = "Breeze"; }; programs = { plasma = { enable = true; immutableByDefault = false; fonts = { windowTitle = with config.stylix.fonts; { family = sansSerif.name; pointSize = sizes.desktop; }; }; desktop = { icons = { alignment = "left"; arrangement = "topToBottom"; sorting = { mode = "name"; descending = true; foldersFirst = true; }; }; }; session = { general.askForConfirmationOnLogout = true; sessionRestore = { excludeApplications = [ ]; restoreOpenApplicationsOnLogin = "whenSessionWasManuallySaved"; }; }; spectacle = { shortcuts = { launch = "Meta+S"; launchWithoutCapturing = "Meta+Alt+S"; captureActiveWindow = "Meta+Print"; captureCurrentMonitor = "Print"; captureEntireDesktop = "Shift+Print"; captureRectangularRegion = "Meta+Shift+S"; captureWindowUnderCursor = "Meta+Ctrl+Print"; recordRegion = "Meta+Shift+R"; recordScreen = "Meta+Alt+R"; recordWindow = "Meta+Ctrl+R"; }; }; input.keyboard = with config.services.xserver; { repeatDelay = autoRepeatDelay; repeatRate = autoRepeatInterval; numlockOnStartup = "off"; }; configFile = { baloofilerc."Basic Settings"."Indexing-Enabled" = false; kwalletrc."Wallet"."Enabled" = false; kwinrc."Xwayland"."XwaylandEavesdrop" = "None"; spectaclerc = { "ImageSave"."imageSaveLocation" = "file://${config.userDirs.pictures}"; "VideoSave"."videoSaveLocation" = "file://${config.userDirs.videos}"; }; }; }; firefox.profiles.default.settings = { "widget.use-xdg-desktop-portal.file-picker" = 1; "widget.use-xdg-desktop-portal.mime-handler" = 1; }; }; xdg.configFile = { "fontconfig/conf.d/10-hm-fonts.conf".force = lib.mkForce true; "mimeapps.list".force = lib.mkForce true; }; }; services = { desktopManager.plasma6.enable = true; displayManager.sddm = { enable = true; wayland = { enable = true; compositor = "kwin"; }; }; }; environment = { plasma6.excludePackages = with pkgs.kdePackages; [ elisa gwenview kate khelpcenter print-manager ]; systemPackages = with pkgs.kdePackages; [ krdc plasma-disks ]; }; }; }