forked from Shinonome/alt-illogical-impulse
ac6d3adeb9
BREAKING CHANGE: Remove external dots-hyprland dependency - Imported all essential configs from dots-hyprland/installer-replication - Added complete configs/ directory with: - hypr/ - Hyprland configuration - quickshell/ - Quickshell widgets and config - applications/ - Application configurations - scripts/ - Utility scripts - matugen/ - Material You theming - Updated flake.nix to use local ./configs instead of external repo - Simplified update-flake script (removed external repo management) - Updated README to reflect self-contained architecture - All builds pass with local configurations Benefits: - No external repository dependencies - Faster builds (no network dependencies) - Version controlled configs in single repo - Easier maintenance and development - Complete installer replication in one place
42 lines
1.0 KiB
QML
42 lines
1.0 KiB
QML
pragma Singleton
|
|
import Quickshell
|
|
|
|
Singleton {
|
|
id: root
|
|
|
|
/**
|
|
* Trims the File protocol off the input string
|
|
* @param {string} str
|
|
* @returns {string}
|
|
*/
|
|
function trimFileProtocol(str) {
|
|
return str.startsWith("file://") ? str.slice(7) : str;
|
|
}
|
|
|
|
/**
|
|
* Extracts the file name from a file path
|
|
* @param {string} str
|
|
* @returns {string}
|
|
*/
|
|
function fileNameForPath(str) {
|
|
if (typeof str !== "string") return "";
|
|
const trimmed = trimFileProtocol(str);
|
|
return trimmed.split(/[\\/]/).pop();
|
|
}
|
|
|
|
/**
|
|
* Removes the file extension from a file path or name
|
|
* @param {string} str
|
|
* @returns {string}
|
|
*/
|
|
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;
|
|
}
|
|
}
|