name: kde-extract description: Extract KDE settings and convert to plasma-manager Nix configuration compatibility: Requires KDE/Plasma desktop environment metadata: author: ruinous.ai version: "1.1" parameters: config_file: type: select description: KDE config file to extract settings from required: true options: - label: "kwinrc (Recommended)" description: "Window manager - tiling, effects, desktops" - label: "kdeglobals" description: "Global KDE settings - theme, fonts, colors" - label: "kglobalshortcutsrc" description: "Keyboard shortcuts" - label: "plasmarc" description: "Plasma shell settings" - label: "kscreenlockerrc" description: "Lock screen settings" - label: "kcminputrc" description: "Input device settings" - label: "all" description: "List all available config files" - label: "Enter other..." description: "Specify a custom config file" section_filter: type: string description: Optional section to filter (e.g., "TabBox", "Desktops") required: false placeholder: "TabBox"
KDE Extract
Extract current KDE/Plasma settings from config files and convert them to declarative plasma-manager Nix configuration.
Parameter Handling
If parameters are missing from $ARGUMENTS, use mcp_question to gather them:
mcp_question({
questions: [
{
question: "Which KDE config file do you want to extract?",
header: "Config File",
options: [
{ label: "kwinrc (Recommended)", description: "Window manager settings" },
{ label: "kdeglobals", description: "Global theme, fonts, colors" },
{ label: "kglobalshortcutsrc", description: "Keyboard shortcuts" },
{ label: "plasmarc", description: "Plasma shell settings" },
{ label: "all", description: "List all available config files" },
{ label: "Enter other...", description: "Specify custom config file" }
]
}
]
})
Expected $ARGUMENTS format: <config_file> [section_filter]
- Example:
kwinrc(all sections) - Example:
kwinrc TabBox(only TabBox section) - Example:
all(list all config files)
Steps
Parse arguments from
$ARGUMENTSIf "all" or empty, list available KDE config files:
ls -1 ~/.config/k* ~/.config/plasma* 2>/dev/null | grep -v '.lock' | head -30Then ask user which file(s) to extract.
Read the specified config file(s):
cat ~/.config/<filename>Parse the INI format and convert to plasma-manager
configFileformat:KDE INI format:
[Section] Key=Value [Section][Subsection] Key=ValueConverts to Nix:
configFile = { "<filename>"."Section"."Key" = <value>; "<filename>"."Section][Subsection"."Key" = <value>; };Handle value types:
true/false-> Nix booleans- Numbers -> Nix integers/floats
- Everything else -> Nix strings
Output the Nix configuration in a format ready to paste into
programs.plasma.configFile:# Add to programs.plasma in your home-configuration.nix configFile = { # <filename> settings "<filename>"."Section"."Key" = value; };If a specific section was requested, filter output to only that section.
Common Config Files
| File | Contains |
|---|---|
kwinrc |
Window manager (tiling, TabBox, effects, desktops) |
kdeglobals |
Global KDE settings (theme, fonts, colors) |
kglobalshortcutsrc |
Keyboard shortcuts |
plasmarc |
Plasma shell settings |
plasma-org.kde.plasma.desktop-appletsrc |
Panel and widget config |
kscreenlockerrc |
Lock screen settings |
kcminputrc |
Input device settings |
ksmserverrc |
Session manager settings |
Example Usage
/kde-extract kwinrc
Extracts all kwinrc settings as Nix config.
/kde-extract kwinrc TabBox
Extracts only the TabBox section from kwinrc.
/kde-extract all
Lists all KDE config files and prompts for selection.
Example Output
Input (~/.config/kwinrc):
[TabBox]
ApplicationsMode=1
HighlightWindows=false
[Windows]
FocusPolicy=FocusFollowsMouse
Output:
# Add to programs.plasma in your home-configuration.nix
configFile = {
# kwinrc - Window Manager settings
"kwinrc"."TabBox"."ApplicationsMode" = 1;
"kwinrc"."TabBox"."HighlightWindows" = false;
"kwinrc"."Windows"."FocusPolicy" = "FocusFollowsMouse";
};
Notes
- Settings managed by plasma-manager's native options (like
kwin.virtualDesktops) may conflict withconfigFileentries - Some settings require logout/login or
kwin_wayland --replaceto take effect - Use
qdbusto query current runtime values if config file doesn't reflect actual state