This commit is contained in:
Zacharias-Brohn
2026-03-12 10:04:27 +01:00
parent 401ccef90c
commit 851b78f0ff
17 changed files with 1347 additions and 64 deletions
+28
View File
@@ -0,0 +1,28 @@
pragma Singleton
import Quickshell
Singleton {
id: root
function fileNameForPath(str) {
if (typeof str !== "string")
return "";
const trimmed = trimFileProtocol(str);
return trimmed.split(/[\\/]/).pop();
}
function trimFileExt(str) {
if (typeof str !== "string")
return "";
const trimmed = trimFileProtocol(str);
const lastDot = trimmed.lastIndexOf(".");
if (lastDot > -1 && lastDot > trimmed.lastIndexOf("/")) {
return trimmed.slice(0, lastDot);
}
return trimmed;
}
function trimFileProtocol(str) {
return str.startsWith("file://") ? str.slice(7) : str;
}
}