diff --git a/.config/quickshell/modules/common/functions/file_utils.js b/.config/quickshell/modules/common/functions/file_utils.js new file mode 100644 index 000000000..281921da1 --- /dev/null +++ b/.config/quickshell/modules/common/functions/file_utils.js @@ -0,0 +1,4 @@ +function trimFileProtocol(str) { + return str.startsWith("file://") ? str.slice(7) : str; +} + diff --git a/.config/quickshell/modules/common/functions/string_utils.js b/.config/quickshell/modules/common/functions/string_utils.js index e52f167dc..3251b4574 100644 --- a/.config/quickshell/modules/common/functions/string_utils.js +++ b/.config/quickshell/modules/common/functions/string_utils.js @@ -89,10 +89,6 @@ function splitMarkdownBlocks(markdown) { return result; } -function trimFileProtocol(str) { - return str.startsWith("file://") ? str.slice(7) : str; -} - function escapeBackslashes(str) { return str.replace(/\\/g, '\\\\'); } \ No newline at end of file diff --git a/.config/quickshell/modules/sidebarLeft/AiChat.qml b/.config/quickshell/modules/sidebarLeft/AiChat.qml index 167cc7322..0c32d8cde 100644 --- a/.config/quickshell/modules/sidebarLeft/AiChat.qml +++ b/.config/quickshell/modules/sidebarLeft/AiChat.qml @@ -5,6 +5,7 @@ import "root:/modules/common/widgets" import "./aiChat/" import "root:/modules/common/functions/fuzzysort.js" as Fuzzy import "root:/modules/common/functions/string_utils.js" as StringUtils +import "root:/modules/common/functions/file_utils.js" as FileUtils import Qt.labs.platform import QtQuick import QtQuick.Controls @@ -20,7 +21,7 @@ Item { property var inputField: messageInputField readonly property var messages: Ai.messages property string commandPrefix: "/" - property string faviconDownloadPath: StringUtils.trimFileProtocol(`${StandardPaths.standardLocations(StandardPaths.CacheLocation)[0]}/media/favicons`) + property string faviconDownloadPath: FileUtils.trimFileProtocol(`${StandardPaths.standardLocations(StandardPaths.CacheLocation)[0]}/media/favicons`) property var suggestionQuery: "" property var suggestionList: [] diff --git a/.config/quickshell/services/LatexRenderer.qml b/.config/quickshell/services/LatexRenderer.qml index 2c0b7f3d3..edeaccb00 100644 --- a/.config/quickshell/services/LatexRenderer.qml +++ b/.config/quickshell/services/LatexRenderer.qml @@ -2,6 +2,7 @@ pragma Singleton pragma ComponentBehavior: Bound import "root:/modules/common/functions/string_utils.js" as StringUtils +import "root:/modules/common/functions/file_utils.js" as FileUtils import "root:/modules/common" import QtQuick import Quickshell @@ -25,7 +26,7 @@ Singleton { property var processedExpressions: ({}) property var renderedImagePaths: ({}) property string microtexBinaryPath: Qt.resolvedUrl("/opt/MicroTeX/LaTeX") - property string latexOutputPath: StringUtils.trimFileProtocol(`${StandardPaths.standardLocations(StandardPaths.CacheLocation)[0]}/latex`) + property string latexOutputPath: FileUtils.trimFileProtocol(`${StandardPaths.standardLocations(StandardPaths.CacheLocation)[0]}/latex`) signal renderFinished(string hash, string imagePath)