From 6a9de8b4236bc6f4e3e22ac9fd1102f5bf2ea2c7 Mon Sep 17 00:00:00 2001 From: Walid Salah Date: Mon, 20 Apr 2026 15:15:29 +0200 Subject: [PATCH] Fix: Expand tilde from config paths (#2242) * Expand tilde to the home directory for paths from config * Remove extra line --- quickshell/Common/Paths.qml | 4 +++- quickshell/Common/Theme.qml | 3 ++- quickshell/Services/MuxService.qml | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/quickshell/Common/Paths.qml b/quickshell/Common/Paths.qml index 19a4b161..7dc756b2 100644 --- a/quickshell/Common/Paths.qml +++ b/quickshell/Common/Paths.qml @@ -24,7 +24,9 @@ Singleton { } function expandTilde(path: string): string { - return strip(path.replace("~", stringify(root.home))); + if (!path.startsWith("~")) + return path; + return strip(root.home) + path.substring(1); } function shortenHome(path: string): string { diff --git a/quickshell/Common/Theme.qml b/quickshell/Common/Theme.qml index fc0b663e..48d9889b 100644 --- a/quickshell/Common/Theme.qml +++ b/quickshell/Common/Theme.qml @@ -1321,7 +1321,7 @@ Singleton { } function loadCustomThemeFromFile(filePath) { - customThemeFileView.path = filePath; + customThemeFileView.path = Paths.expandTilde(filePath); } function reloadCustomThemeVariant() { @@ -1967,6 +1967,7 @@ Singleton { FileView { id: customThemeFileView + blockLoading: false watchChanges: currentTheme === "custom" function parseAndLoadTheme() { diff --git a/quickshell/Services/MuxService.qml b/quickshell/Services/MuxService.qml index c2f941cc..09132b93 100644 --- a/quickshell/Services/MuxService.qml +++ b/quickshell/Services/MuxService.qml @@ -192,7 +192,7 @@ Singleton { function attachToSession(name) { if (SettingsData.muxUseCustomCommand && SettingsData.muxCustomCommand) { - Quickshell.execDetached([SettingsData.muxCustomCommand, name]) + Quickshell.execDetached([Paths.expandTilde(SettingsData.muxCustomCommand), name]) } else if (root.muxType === "zellij") { Quickshell.execDetached(_terminalPrefix().concat(["zellij", "attach", name])) } else { @@ -202,7 +202,7 @@ Singleton { function createSession(name) { if (SettingsData.muxUseCustomCommand && SettingsData.muxCustomCommand) { - Quickshell.execDetached([SettingsData.muxCustomCommand, name]) + Quickshell.execDetached([Paths.expandTilde(SettingsData.muxCustomCommand), name]) } else if (root.muxType === "zellij") { Quickshell.execDetached(_terminalPrefix().concat(["zellij", "-s", name])) } else {