Plasma-Manager

From NixOS Wiki
Jump to: navigation, search

Plasma-Manager lets your write down your KDE settings. It mimics the style and syntax of configuration.nix. If you have more than a handful of computers it can help you set them up consistently. It's also useful if you reinstall your OS or change PC's.

Plasma-Manager is an add-in for Home Manager. Home Manager is like Chezmoi or GNU Stow. It lets you write down and version control your dotfiles in a unified location. Home Manager also lets you install packages for yourself rather than system-wide. You do not need to be proficient with Home Manager to use Plasma-Manager. Also, you do not need to replace Chzemoi/Stow if you use it. (The author personally uses Chezmoi for dotfiles and Plasma-Manager for KDE.)

Caveats

Some users include their Plasma-Manager configuration in their OS' configuration.nix. This requires rebuilding the entire system (nixos-rebuild switch) to apply KDE Plasma changes, which may suit business or education environments needing uniform settings across multiple machines. For personal use, a standalone approach (home-manager switch) is often better.

Note that Plasma-Manager resets existing panel or window rule settings when you start managing them, requiring you to redefine all settings in Plasma-Manager. For example, the author defined a Dolphin window rule for testing, applied it, logged out, and logged back in, only to find Konsole and web browser rules removed because they weren’t specified. This is typical in tech: some tools manage individual settings, while others require full resource control.

As of September 2025, Plasma-Manager cannot manage Autostart entries or KCalc settings, though launch scripts can serve as an alternative for Autostart.

How to setup Standalone Plasma-Manager

In this context the term Standalone means you are installing it in your home directory. You do not need to change your configuration.nix. Also, you do not need to be a member of the wheel group nor do you need sudo.

1) Add Channels as Your User

Set the release URL to match your currently installed NixOS. It doesn't matter if you use Channels or Flakes to manage the OS.

nix-channel --add https://github.com/nix-community/home-manager/archive/release-25.05.tar.gz home-manager
nix-channel --add https://github.com/nix-community/plasma-manager/archive/trunk.tar.gz plasma-manager
nix-channel --update

NixOS Unstable: `nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager`

2) Install Standalone Plasma-Manager

This will install Home Manager, Plasma-Manager, and create a default configuration file at ~/.config/home-manager/home.nix.

nix-shell '<home-manager>' -A install

3) Add the following to your ~/.profile file and run it as shown on the command line to set some needed variables.

If you do not use bash, please extrapolate for your login shell.

. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"

4) Edit Home Manager home.nix file to suit your needs

An example Plasma-Manager configuration is below.

5) Apply the Changes

home-manager switch

6) Verify and Customize

Review the output for any errors. If none, logout of KDE and log back in to affect the changes. You should always logout of KDE to apply Plasma-Manager changes.

Example Plasma-Manager Configuration

#
# ~/.config/home-manager/home.nix
#
{...}: {
  # Import plasma-manager
  imports = [<plasma-manager/modules>];

  # Enable and configure Plasma settings
  programs.plasma = {
    enable = true;

    #
    # System Settings (Mimic System Settings GUI order)
    #
    # System Settings > Keyboard > Keyboard
    input.keyboard = {
      numlockOnStartup = "on";
      # options = ["ctrl:nocaps"];
    };

    shortcuts = {
      # System Settings > Keyboard > Shortcuts > KWin
      kwin = {
        "ExposeClassCurrentDesktop" = "Meta+Ctrl+Down";
        "Overview" = "Meta+Ctrl+Up";
      };
    };

    # System Settings > Keyboard > Shortcuts > Plasma Manager
    hotkeys.commands = {
      launch-brave = {
        name = "Launch Brave";
        key = "Meta+Shift+B";
        command = "brave";
      };
    };

    # System Settings > Colors & Themes > Window Decorations
    kwin.titlebarButtons.left = [
      "close"
      "minimize"
      "maximize"
    ];

    # System Settings > Text & Fonts > Fonts
    fonts = {
      fixedWidth = {
        family = "JetBrains Mono";
        pointSize = 10;
      };
      general = {
        family = "Roboto";
        pointSize = 10;
      };
      menu = {
        family = "Roboto";
        pointSize = 10;
      };
      small = {
        family = "Roboto";
        pointSize = 8;
      };
      toolbar = {
        family = "Roboto";
        pointSize = 10;
      };
      windowTitle = {
        family = "Roboto";
        pointSize = 10;
      };
    };

    kwin = {
      # System Settings > Window Management > Desktop Effects > ...
      effects = {
        blur = {
          enable = true;
          noiseStrength = 0;
          strength = 6;
        };

        slideBack.enable = true;

        translucency.enable = true;

        wobblyWindows.enable = true;
      };

      # System Settings > Window Management > Virtual Desktops
      virtualDesktops = {
        number = 2;
        rows = 1;
      };
    };

    # System Settings > Screen Locking > Configure Appearance
    kscreenlocker = {
      appearance = {
        showMediaControls = false;
        wallpaperPictureOfTheDay.provider = "bing";
      };
      # appearance.wallpaper = "${config.wallpaper}";
      # autoLock = false;
      # timeout = 0;
    };

    # System Settings > Session > Desktop Session
    session = {
      general.askForConfirmationOnLogout = false;
      sessionRestore.restoreOpenApplicationsOnLogin = "startWithEmptySession";
    };

    #
    # KRunner
    #
    krunner = {
      position = "center";
    };

    #
    # Spectacle
    #
    spectacle = {
      # Spectacle > Configure Spectacle > Shortcuts
      shortcuts = {
        captureActiveWindow = "Meta+@";
        captureCurrentMonitor = "Meta+#";
        # captureEntireDesktop = "";
        captureRectangularRegion = "Meta+$";
        # captureWindowUnderCursor = "";
        launchWithoutCapturing = "Meta+%";
      };
    };

    #
    # Configuration Files (Order alphabetically)
    #
    configFile = {
      # System Settings > Search > File Search
      baloofilerc."Basic Settings"."Indexing-Enabled" = false;

      # GUI setting unknown
      # Use detailed view for file picker
      kdeglobals."KFileDialog Settings"."View Style" = "Detail";

      # System Settings > Colors & Themes > Splash Screen
      ksplashrc.KSplash = {
        Engine = "none";
        Theme = "None";
      };

      kwinrc = {
        # System Settings > Window Management > Desktop Effects > Geometry Change
        # Add Geometry Change: System Settings > Window Management > Desktop Effects >
        #   Get New...
        Effect-kwin4_effect_geometry_change."Duration" = 500;
      };

      # Spectacle > Configure Spectacle
      "spectaclerc"."General"."launchAction" = "DoNotTakeScreenshot";
    };
  };

  # Install Brave browser for the user
  # Uncomment if Brave browser is not in your configuration.nix
  # home.packages = [ pkgs.brave ];

  # Set Home Manager state version to match NixOS system.stateVersion
  home.stateVersion = "25.05";

  # Home Manager needs a bit of information about you and the paths it should
  # manage.
  home.username = "your_username";
  home.homeDirectory = "/home/your_username";

  # Optional: Allow Home Manager to manage itself
  programs.home-manager.enable = true;
}

Import Existing Settings

The utility rc2nix will export many of your existing KDE settings. They are formatted for Plasma-Manager's configFile option.

You may reduce complexity and save yourself time by narrowing your focus to settings that you made. Disregard the many and various default settings.

Ideally you should transcribe configFile settings to native Plasma-Manager options. The Plasma-Manager authors expended a lot of time and care to ensure their options are successful. Reserve configFile options as a fallback for when there is no native Plasma-Manager option.

1) Run rc2nix

nix run github:nix-community/plasma-manager/trunk#rc2nix > plasma.nix

2) Manually merge the output into your home.nix

Troubleshoot

In general you can troubleshoot Plasma-Manager by following this pattern:

  1. Review the output of `home-manager switch`
  2. Check logs: `journalctl --user -u home-manager.service`

Uninstall Standalone Plasma-Manager

Down the road you can uninstall by doing the following:

1) Delete the channels you added earlier

nix-channel --remove home-manager
nix-channel --remove plasma-manager
nix-channel --update

2) Remove the Home Manager config directory

rm -rf ~/.config/home-manager

3) Remove the following from your ~/.profile file

If you do not use bash, please extrapolate for your login shell.

. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"

4) Clean up unused Nix store paths to free space

Important: Run as shown. DO NOT USE SUDO.

nix-collect-garbage -d

References

Plasma-Manager Configuration Examples

Plasma-Manager Options