Monthly Archives: September 2025

Managing KDE Dotfiles with Chezmoi and Chezmoi Modify Manager

If you’re a KDE user who wants to keep your desktop configuration under version control, you’ve probably discovered that KDE’s configuration files can be quite challenging to manage with traditional dotfile tools. KDE stores settings in complex INI files that frequently change, contain system-specific data, and include sections you may not want to track. This is where Chezmoi Modify Manager becomes useful when using the Chezmoi dotfile manager.

The Problem with KDE Configuration Files

KDE applications like Kate, Dolphin, and KWin store their settings in INI-style configuration files. These files often contain:

  • Volatile sections that change frequently (like window positions, recent files)
  • System-specific data (like file dialog sizes, screen configurations)
  • Mixed content where you only want to track specific settings

Things have improved recently in that respect; however, some KDE INI files still mix those configurations.

Managing these files directly with Chezmoi would result in noisy diffs and configurations that don’t work well across different machines.

Enter Chezmoi Modify Manager

Chezmoi Modify Manager acts as a configurable filter between your actual config files and your Chezmoi repository. It allows you to:

  • Ignore entire sections or specific keys
  • Set specific values while ignoring everything else
  • Use regex patterns for flexible matching
  • Transform values during processing

The tool works by creating “modify scripts” that tell Chezmoi how to process each configuration file.

Quoting from the official documentation:

For each settings file you want to manage with chezmoi_modify_manager there will be two files in your chezmoi source directory:

  • modify_<config file> or modify_<config file>.tmpl, e.g. modify_private_kdeglobals.tmpl
    This is the modify script/configuration file that calls chezmoi_modify_manager. It contains the directives describing what to ignore.
  • <config file>.src.ini, e.g. private_kdeglobals.src.ini
    This is the source state of the INI file.

The modify_ script is responsible for generating the new state of the file given the current state in your home directory. The modify_ script is set up to use chezmoi_modify_manager as an interpreter to do so. chezmoi_modify_manager will read the modify script to read configuration and the .src.ini file and by default will apply that file exactly (ignoring blank lines and comments).

Note that this is based on the Chezmoi mechanism of “modifying scripts”, allowing you to manage only some parts of files.

Thus, the integration with Chezmoi is based on these mechanisms:

  1. Source files (.src.ini) contain your desired configuration
  2. Modify scripts (starting with modify_) define filtering rules
  3. Chezmoi applies the modifications when deploying configs
  4. The .chezmoiignore file ensures source files aren’t directly copied

The file name after “modify_” and the file name of the “.src.ini” must follow the naming conventions of Chezmoi.

Your .chezmoiignore must include:

This prevents the source files from being deployed directly, letting Chezmoi Modify Manager handle the processing.

So, let’s see how to use that.

Real-World Examples

You can use the “chezmoi_modify_manager” command line to create the proper files.

Let’s look at how this works in practice with actual KDE configurations, based on my dotfiles (so I have already created these files):

KWin Configuration (kwinrc)

The file “modify_private_kwinrc”:

This script ensures only the relevant window manager settings are tracked (the file “private_kwinrc.src.ini”):

Global Shortcuts (kglobalshortcutsrc)

The names of the files are using the same convention already shown before.

For keyboard shortcuts, you might want to ignore certain dynamic sections:

This keeps your custom shortcuts while filtering out activity-specific bindings that may not be relevant across systems. The file “private_kglobalshortcutsrc.src.ini” is not shown because it’s quite huge.

Font Configuration (kdeglobals)

Sometimes you only want to track a single setting:

This results in a clean config that only tracks the terminal font:

Kate Editor Configuration

For Kate, you might want to ignore volatile sections while keeping your editor preferences:

Again, the “.src.ini” file is not shown.

Benefits

  • Clean diffs: Only track settings you care about
  • Portable configs: No system-specific clutter
  • Selective tracking: Include only relevant sections

Drawbacks

In general, setting the files initially takes much more time: you need to understand what to include/exclude in the “modify_” scripts and properly craft the “.src.ini” files accordingly. Moreover, some Chezmoi mechanisms, such as “merge,” will not function. Therefore, updating the files requires employing alternative techniques, as outlined in the next blog post. Finally, besides “chezmoi”, you need to install an additional program “chezmoi_modify_manager”.