From 06566fbd0470ec2d1cc51fea3852bf96a67800c8 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Sun, 9 Nov 2025 19:27:23 +0100 Subject: [PATCH] TemplateRegistry: make the user-templates.toml generation more robust --- Services/Theming/TemplateRegistry.qml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Services/Theming/TemplateRegistry.qml b/Services/Theming/TemplateRegistry.qml index 40d0542c..07e90078 100644 --- a/Services/Theming/TemplateRegistry.qml +++ b/Services/Theming/TemplateRegistry.qml @@ -206,12 +206,16 @@ Singleton { function doWriteUserTemplatesToml() { var userConfigPath = Settings.configDir + "user-templates.toml" var configContent = buildUserTemplatesToml() + var userConfigPathEsc = userConfigPath.replace(/'/g, "'\\''") // Ensure directory exists (should already exist but just in case) Quickshell.execDetached(["mkdir", "-p", Settings.configDir]) - // Write the config file - Quickshell.execDetached(["sh", "-c", `echo '${configContent.replace(/'/g, "'\\''")}' > '${userConfigPath}'`]) + // Write the config file using heredoc to avoid escaping issues + var script = `cat > '${userConfigPathEsc}' << 'EOF'\n` + script += configContent + script += "EOF\n" + Quickshell.execDetached(["sh", "-c", script]) Logger.d("TemplateRegistry", "User templates config written to:", userConfigPath) }