{ config, pkgs, lib, flakeSelf, ... }: let # Set up the default kde options balooExcludedDirs = lib.strings.intersperse "," [ "$HOME/.cache/" "$HOME/.config/" "$HOME/.local/" ]; baloofilerc = lib.generators.toINI {} { General = { # The [$e] part allows you to use environment variables "exclude folders[$e]" = lib.strings.concatStrings balooExcludedDirs; }; }; # Make custom packages breezeTint = pkgs.stdenv.mkDerivation { name = "breeze-tint"; src = "${pkgs.breeze-qt5}"; patches = [./patches/BreezeTint.patch]; installPhase = '' runHook preInstall mkdir -p $out/share/color-schemes/ cp -r share/color-schemes/* $out/share/color-schemes/ runHook postInstall ''; }; # /etc/xdg is not read by plasma, so to change the default settings you need to put them in a package plasmaDefaults = pkgs.stdenv.mkDerivation { name = "toast-plasma-defaults"; dontUnpack = true; installPhase = '' runHook preInstall set -x mkdir -p $out/etc/xdg echo '${baloofilerc}' > $out/etc/xdg/baloofilerc runHook postInstall ''; }; in { services.xserver = { # Enable the Plasma 5 Desktop Environment desktopManager.plasma5.enable = true; displayManager.defaultSession = "plasmawayland"; }; qt.enable = true; # GTK apps need dconf to grab the correct theme on Wayland programs.dconf.enable = true; # Install the patched Breeze color schemes as well as the plasma default configs environment.systemPackages = [breezeTint plasmaDefaults]; # Plasma configs should be on all users home-manager.sharedModules = [ ( {config, ...}: let gtk2rc = "${config.xdg.configHome}/gtk-2.0/gtkrc"; in { gtk.gtk2.configLocation = gtk2rc; # Kde has an annoying habit of overwriting the gtk2 config file home.file."${gtk2rc}".force = true; } ) { imports = [flakeSelf.inputs.plasma-manager.homeManagerModules.plasma-manager]; gtk = { enable = true; # Most apps are dark, so a white cursor is easier to spot cursorTheme = { package = pkgs.breeze-qt5; name = "Breeze_Snow"; }; iconTheme = { package = pkgs.breeze-icons; name = "breeze-dark"; }; theme = { package = pkgs.breeze-gtk; name = "Breeze"; }; # Gtk2 doesn't have a dark mode, so I just tell gtk 3 and 4 to use the dark variant gtk3.extraConfig.gtk-application-prefer-dark-theme = true; gtk4.extraConfig.gtk-application-prefer-dark-theme = true; }; home.packages = [ ( pkgs.catppuccin-kde.override { flavour = ["mocha"]; accents = ["mauve"]; winDecStyles = ["classic"]; } ) ]; programs.plasma = { enable = true; overrideConfig = true; # Delete config files that I fully configure here overrideConfigFiles = [ "plasmashellrc" "plasma-org.kde.plasma.desktop-appletsrc" ]; workspace = { clickItemTo = "select"; cursorTheme = "Breeze_Snow"; iconTheme = "breeze-dark"; lookAndFeel = "Catppuccin-Mocha-Mauve"; theme = "default"; colorScheme = "CatppuccinMochaMauve"; }; kwin = { titlebarButtons = { left = ["on-all-desktops" "keep-above-windows"]; right = ["minimize" "maximize" "close"]; }; }; panels = [ { location = "bottom"; height = 44; widgets = [ { name = "org.kde.plasma.kickoff"; config.General.icon = "nix-snowflake-white"; } "org.kde.plasma.pager" "org.kde.plasma.icontasks" "org.kde.plasma.marginsseparator" "org.kde.plasma.systemtray" { name = "org.kde.plasma.digitalclock"; config.Appearance.showSeconds = "true"; } "org.kde.plasma.showdesktop" ]; } ]; shortcuts = { "kwin" = { "Switch One Desktop to the Left" = ["Meta+Ctrl+Left"]; "Switch One Desktop to the Right" = ["Meta+Ctrl+Right"]; }; }; configFile = { "kwinrc" = { "org.kde.kdecoration2"."BorderSize".value = "None"; "Desktops" = { "Number".value = 2; "Rows".value = 1; }; "TabBox"."LayoutName".value = "thumbnail_grid"; }; "kdeglobals"."General"."AccentColor".value = null; "auroraerc"."CatppuccinMocha-Classic"."ButtonSize".value = 0; "plasmanotifyrc"."Notifications"."NormalAlwaysOnTop".value = true; }; }; } ]; }