mirror of
https://github.com/belsabbagh/dotfiles.git
synced 2026-04-11 09:36:46 +00:00
quickshell and hyprland additions
This commit is contained in:
37
.config/quickshell/caelestia/utils/Paths.qml
Normal file
37
.config/quickshell/caelestia/utils/Paths.qml
Normal file
@@ -0,0 +1,37 @@
|
||||
pragma Singleton
|
||||
|
||||
import qs.config
|
||||
import Caelestia
|
||||
import Quickshell
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
readonly property string home: Quickshell.env("HOME")
|
||||
readonly property string pictures: Quickshell.env("XDG_PICTURES_DIR") || `${home}/Pictures`
|
||||
readonly property string videos: Quickshell.env("XDG_VIDEOS_DIR") || `${home}/Videos`
|
||||
|
||||
readonly property string data: `${Quickshell.env("XDG_DATA_HOME") || `${home}/.local/share`}/caelestia`
|
||||
readonly property string state: `${Quickshell.env("XDG_STATE_HOME") || `${home}/.local/state`}/caelestia`
|
||||
readonly property string cache: `${Quickshell.env("XDG_CACHE_HOME") || `${home}/.cache`}/caelestia`
|
||||
readonly property string config: `${Quickshell.env("XDG_CONFIG_HOME") || `${home}/.config`}/caelestia`
|
||||
|
||||
readonly property string imagecache: `${cache}/imagecache`
|
||||
readonly property string notifimagecache: `${imagecache}/notifs`
|
||||
readonly property string wallsdir: Quickshell.env("CAELESTIA_WALLPAPERS_DIR") || absolutePath(Config.paths.wallpaperDir)
|
||||
readonly property string recsdir: Quickshell.env("CAELESTIA_RECORDINGS_DIR") || `${videos}/Recordings`
|
||||
readonly property string libdir: Quickshell.env("CAELESTIA_LIB_DIR") || "/usr/lib/caelestia"
|
||||
|
||||
function toLocalFile(path: url): string {
|
||||
path = Qt.resolvedUrl(path);
|
||||
return path.toString() ? CUtils.toLocalFile(path) : "";
|
||||
}
|
||||
|
||||
function absolutePath(path: string): string {
|
||||
return toLocalFile(path.replace(/~|(\$({?)HOME(}?))+/, home));
|
||||
}
|
||||
|
||||
function shortenHome(path: string): string {
|
||||
return path.replace(home, "~");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user