mirror of
https://github.com/danbulant/dots-hyprland
synced 2026-05-24 12:22:09 +00:00
move common dirs to Directories <--renamed-- XdgDirectories
This commit is contained in:
parent
5ea497068c
commit
66c75342d4
17 changed files with 63 additions and 65 deletions
40
.config/quickshell/modules/common/Directories.qml
Normal file
40
.config/quickshell/modules/common/Directories.qml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
pragma Singleton
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import "root:/modules/common/functions/file_utils.js" as FileUtils
|
||||
import Qt.labs.platform
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
|
||||
Singleton {
|
||||
// XDG Dirs, with "file://"
|
||||
readonly property string config: StandardPaths.standardLocations(StandardPaths.ConfigLocation)[0]
|
||||
readonly property string state: StandardPaths.standardLocations(StandardPaths.StateLocation)[0]
|
||||
readonly property string cache: StandardPaths.standardLocations(StandardPaths.CacheLocation)[0]
|
||||
readonly property string pictures: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
|
||||
readonly property string downloads: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0]
|
||||
|
||||
// Other dirs used by the shell, without "file://"
|
||||
property string favicons: FileUtils.trimFileProtocol(`${Directories.cache}/media/favicons`)
|
||||
property string coverArt: FileUtils.trimFileProtocol(`${Directories.cache}/media/coverart`)
|
||||
property string booruPreviews: FileUtils.trimFileProtocol(`${Directories.cache}/media/boorus`)
|
||||
property string booruDownloads: FileUtils.trimFileProtocol(Directories.pictures + "/homework")
|
||||
property string booruDownloadsNsfw: FileUtils.trimFileProtocol(Directories.pictures + "/homework/🌶️")
|
||||
property string latexOutput: FileUtils.trimFileProtocol(`${Directories.cache}/latex`)
|
||||
property string shellConfig: FileUtils.trimFileProtocol(`${Directories.config}/illogical-impulse`)
|
||||
property string shellConfigName: "config.json"
|
||||
property string shellConfigPath: `${Directories.shellConfig}/${Directories.shellConfigName}`
|
||||
property string todoPath: FileUtils.trimFileProtocol(`${Directories.state}/user/todo.json`)
|
||||
property string notificationsPath: `${Directories.cache}/notifications/notifications.json`
|
||||
property string generatedMaterialThemePath: `${Directories.state}/user/generated/colors.json`
|
||||
// Cleanup on init
|
||||
Component.onCompleted: {
|
||||
Hyprland.dispatch(`exec mkdir -p ${Directories.shellConfig}`)
|
||||
Hyprland.dispatch(`exec mkdir -p ${favicons}`)
|
||||
Hyprland.dispatch(`exec rm -rf ${coverArt} && mkdir -p ${coverArt}`)
|
||||
Hyprland.dispatch(`exec rm -rf '${booruPreviews}' && mkdir -p '${booruPreviews}'`)
|
||||
Hyprland.dispatch(`exec mkdir -p '${booruDownloads}' && mkdir -p '${booruDownloadsNsfw}'`)
|
||||
Hyprland.dispatch(`exec rm -rf ${latexOutput} && mkdir -p ${latexOutput}`)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
import Qt.labs.platform
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
pragma Singleton
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
Singleton {
|
||||
readonly property string config: StandardPaths.standardLocations(StandardPaths.ConfigLocation)[0]
|
||||
readonly property string state: StandardPaths.standardLocations(StandardPaths.StateLocation)[0]
|
||||
readonly property string cache: StandardPaths.standardLocations(StandardPaths.CacheLocation)[0]
|
||||
readonly property string pictures: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
|
||||
readonly property string downloads: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0]
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ IconImage {
|
|||
|
||||
property real size: 32
|
||||
property string downloadUserAgent: ConfigOptions?.networking.userAgent ?? ""
|
||||
property string faviconDownloadPath: FileUtils.trimFileProtocol(`${XdgDirectories.cache}/media/favicons`)
|
||||
property string faviconDownloadPath: Directories.favicons
|
||||
property string domainName: url.includes("vertexaisearch") ? displayText : StringUtils.getDomain(url)
|
||||
property string faviconUrl: `https://www.google.com/s2/favicons?domain=${domainName}&sz=32`
|
||||
property string fileName: `${domainName}.ico`
|
||||
|
|
@ -31,21 +31,11 @@ IconImage {
|
|||
running: false
|
||||
command: ["bash", "-c", `[ -f ${faviconFilePath} ] || curl -s '${root.faviconUrl}' -o '${faviconFilePath}' -L -H 'User-Agent: ${downloadUserAgent}'`]
|
||||
onExited: (exitCode, exitStatus) => {
|
||||
console.log("Favicon download process exited with code:", exitCode, "and status:", exitStatus)
|
||||
console.log("Favicon file path:", faviconFilePath)
|
||||
root.urlToLoad = root.faviconFilePath
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("URL: ", root.url)
|
||||
console.log("DOMAIN: ", root.domainName)
|
||||
console.log("faviconDownloadPath: ", faviconDownloadPath)
|
||||
console.log("faviconFilePath: ", faviconFilePath)
|
||||
console.log("faviconUrl: ", root.faviconUrl)
|
||||
console.log("domainName: ", root.domainName)
|
||||
console.log("fileName: ", root.fileName)
|
||||
console.log("downloading to ", faviconFilePath, "from", root.faviconUrl)
|
||||
faviconDownloadProcess.running = true
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ Scope {
|
|||
property real contentPadding: 13
|
||||
property real popupRounding: Appearance.rounding.screenRounding - Appearance.sizes.elevationMargin + 1
|
||||
property real artRounding: Appearance.rounding.verysmall
|
||||
property string baseCoverArtDir: FileUtils.trimFileProtocol(`${XdgDirectories.cache}/media/coverart`)
|
||||
|
||||
property bool hasPlasmaIntegration: false
|
||||
function isRealPlayer(player) {
|
||||
|
|
@ -70,10 +69,6 @@ Scope {
|
|||
return filtered;
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Hyprland.dispatch(`exec rm -rf ${baseCoverArtDir} && mkdir -p ${baseCoverArtDir}`)
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: mediaControlsLoader
|
||||
active: false
|
||||
|
|
@ -116,7 +111,6 @@ Scope {
|
|||
}
|
||||
delegate: PlayerControl {
|
||||
required property MprisPlayer modelData
|
||||
artDownloadLocation: root.baseCoverArtDir
|
||||
player: modelData
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import "root:/modules/common/widgets"
|
|||
import "root:/services"
|
||||
import "root:/modules/common/functions/string_utils.js" as StringUtils
|
||||
import "root:/modules/common/functions/color_utils.js" as ColorUtils
|
||||
import "root:/modules/common/functions/file_utils.js" as FileUtils
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
|
|
@ -19,7 +20,7 @@ Item { // Player instance
|
|||
id: playerController
|
||||
required property MprisPlayer player
|
||||
property var artUrl: player?.trackArtUrl
|
||||
property string artDownloadLocation: FileUtils.trimFileProtocol(`${XdgDirectories.cache}/media/coverart`)
|
||||
property string artDownloadLocation: Directories.coverArt
|
||||
property string artFileName: Qt.md5(artUrl) + ".jpg"
|
||||
property string artFilePath: `${artDownloadLocation}/${artFileName}`
|
||||
property color artDominantColor: Appearance.m3colors.m3secondaryContainer
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import Quickshell.Hyprland
|
|||
|
||||
Item { // Wrapper
|
||||
id: root
|
||||
readonly property string xdgConfigHome: XdgDirectories.config
|
||||
readonly property string xdgConfigHome: Directories.config
|
||||
property string searchingText: ""
|
||||
property bool showResults: searchingText != ""
|
||||
property real searchBarHeight: searchBar.height + Appearance.sizes.elevationMargin * 2
|
||||
|
|
|
|||
|
|
@ -23,10 +23,6 @@ Item {
|
|||
property var suggestionQuery: ""
|
||||
property var suggestionList: []
|
||||
|
||||
Component.onCompleted: {
|
||||
Hyprland.dispatch(`exec mkdir -p ${faviconDownloadPath}`)
|
||||
}
|
||||
|
||||
onFocusChanged: (focus) => {
|
||||
if (focus) {
|
||||
root.inputField.forceActiveFocus()
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ Item {
|
|||
property var panelWindow
|
||||
property var inputField: tagInputField
|
||||
readonly property var responses: Booru.responses
|
||||
property string previewDownloadPath: FileUtils.trimFileProtocol(`${XdgDirectories.cache}/media/waifus`)
|
||||
property string downloadPath: FileUtils.trimFileProtocol(XdgDirectories.pictures + "/homework")
|
||||
property string nsfwPath: FileUtils.trimFileProtocol(XdgDirectories.pictures + "/homework/🌶️")
|
||||
property string previewDownloadPath: Directories.booruPreviews
|
||||
property string downloadPath: Directories.booruDownloads
|
||||
property string nsfwPath: Directories.booruDownloadsNsfw
|
||||
property string commandPrefix: "/"
|
||||
property real scrollOnNewResponse: 100
|
||||
property int tagSuggestionDelay: 210
|
||||
|
|
@ -37,11 +37,6 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Hyprland.dispatch(`exec rm -rf '${previewDownloadPath}' && mkdir -p '${previewDownloadPath}'`)
|
||||
Hyprland.dispatch(`exec mkdir -p '${downloadPath}' && mkdir -p '${downloadPath}'`)
|
||||
}
|
||||
|
||||
property var allCommands: [
|
||||
{
|
||||
name: "mode",
|
||||
|
|
|
|||
|
|
@ -95,8 +95,9 @@ ColumnLayout {
|
|||
buttonIcon: activated ? "check" : "save"
|
||||
|
||||
onClicked: {
|
||||
Hyprland.dispatch(`exec echo '${StringUtils.shellSingleQuoteEscape(segmentContent)}' > '${FileUtils.trimFileProtocol(XdgDirectories.downloads)}/code.${segmentLang || "txt"}'`)
|
||||
Hyprland.dispatch(`exec notify-send 'Code saved to file' '${FileUtils.trimFileProtocol(XdgDirectories.downloads)}/code.${segmentLang || "txt"}'`)
|
||||
const downloadPath = FileUtils.trimFileProtocol(Directories.downloads)
|
||||
Hyprland.dispatch(`exec echo '${StringUtils.shellSingleQuoteEscape(segmentContent)}' > '${downloadPath}/code.${segmentLang || "txt"}'`)
|
||||
Hyprland.dispatch(`exec notify-send 'Code saved to file' '${downloadPath}/code.${segmentLang || "txt"}'`)
|
||||
saveCodeButton.activated = true
|
||||
saveIconTimer.restart()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ Singleton {
|
|||
|
||||
Process {
|
||||
id: getOllamaModels
|
||||
command: ["bash", "-c", `${XdgDirectories.config}/quickshell/scripts/ai/show-installed-ollama-models.sh`.replace(/file:\/\//, "")]
|
||||
command: ["bash", "-c", `${Directories.config}/quickshell/scripts/ai/show-installed-ollama-models.sh`.replace(/file:\/\//, "")]
|
||||
stdout: SplitParser {
|
||||
onRead: data => {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -17,9 +17,7 @@ import Qt.labs.platform
|
|||
*/
|
||||
Singleton {
|
||||
id: root
|
||||
property string fileDir: `${XdgDirectories.config}/illogical-impulse`
|
||||
property string fileName: "config.json"
|
||||
property string filePath: FileUtils.trimFileProtocol(`${root.fileDir}/${root.fileName}`)
|
||||
property string filePath: Directories.shellConfigPath
|
||||
property bool firstLoad: true
|
||||
|
||||
function loadConfig() {
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ import Quickshell.Hyprland
|
|||
*/
|
||||
Singleton {
|
||||
id: root
|
||||
property string keybindParserPath: FileUtils.trimFileProtocol(`${XdgDirectories.config}/quickshell/scripts/hyprland/get_keybinds.py`)
|
||||
property string defaultKeybindConfigPath: FileUtils.trimFileProtocol(`${XdgDirectories.config}/hypr/hyprland/keybinds.conf`)
|
||||
property string userKeybindConfigPath: FileUtils.trimFileProtocol(`${XdgDirectories.config}/hypr/custom/keybinds.conf`)
|
||||
property string keybindParserPath: FileUtils.trimFileProtocol(`${Directories.config}/quickshell/scripts/hyprland/get_keybinds.py`)
|
||||
property string defaultKeybindConfigPath: FileUtils.trimFileProtocol(`${Directories.config}/hypr/hyprland/keybinds.conf`)
|
||||
property string userKeybindConfigPath: FileUtils.trimFileProtocol(`${Directories.config}/hypr/custom/keybinds.conf`)
|
||||
property var defaultKeybinds: {"children": []}
|
||||
property var userKeybinds: {"children": []}
|
||||
property var keybinds: ({
|
||||
|
|
|
|||
|
|
@ -26,14 +26,10 @@ Singleton {
|
|||
property var processedExpressions: ({})
|
||||
property var renderedImagePaths: ({})
|
||||
property string microtexBinaryPath: Qt.resolvedUrl("/opt/MicroTeX/LaTeX")
|
||||
property string latexOutputPath: FileUtils.trimFileProtocol(`${XdgDirectories.cache}/latex`)
|
||||
property string latexOutputPath: Directories.latexOutput
|
||||
|
||||
signal renderFinished(string hash, string imagePath)
|
||||
|
||||
Component.onCompleted: {
|
||||
Hyprland.dispatch(`exec rm -rf ${latexOutputPath} && mkdir -p ${latexOutputPath}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests rendering of a LaTeX expression.
|
||||
* Returns the [hash, isNew]
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import Quickshell.Io
|
|||
*/
|
||||
Singleton {
|
||||
id: root
|
||||
property string filePath: `${XdgDirectories.state}/user/generated/colors.json`
|
||||
property string filePath: Directories.generatedMaterialThemePath
|
||||
|
||||
function reapplyTheme() {
|
||||
themeFileView.reload()
|
||||
|
|
@ -44,7 +44,7 @@ Singleton {
|
|||
|
||||
FileView {
|
||||
id: themeFileView
|
||||
path: root.filePath
|
||||
path: Qt.resolvedUrl(root.filePath)
|
||||
watchChanges: true
|
||||
onFileChanged: {
|
||||
this.reload()
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ Singleton {
|
|||
destroy()
|
||||
}
|
||||
}
|
||||
property var filePath: `${XdgDirectories.cache}/notifications/notifications.json`
|
||||
property var filePath: Directories.notificationsPath
|
||||
property list<Notif> list: []
|
||||
property var popupList: list.filter((notif) => notif.popup);
|
||||
property bool popupInhibited: GlobalStates?.sidebarRightOpen ?? false
|
||||
|
|
@ -233,7 +233,7 @@ Singleton {
|
|||
|
||||
FileView {
|
||||
id: notifFileView
|
||||
path: filePath
|
||||
path: Qt.resolvedUrl(filePath)
|
||||
onLoaded: {
|
||||
const fileContents = notifFileView.text()
|
||||
root.list = JSON.parse(fileContents).map((notif) => {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import Qt.labs.platform
|
|||
*/
|
||||
Singleton {
|
||||
id: root
|
||||
property string fileDir: XdgDirectories.state
|
||||
property string fileDir: Directories.state
|
||||
property string fileName: "states.json"
|
||||
property string filePath: `${root.fileDir}/${root.fileName}`
|
||||
property bool allowWriteback: false
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import QtQuick;
|
|||
*/
|
||||
Singleton {
|
||||
id: root
|
||||
property var filePath: `${XdgDirectories.state}/user/todo.json`
|
||||
property var filePath: Directories.todoPath
|
||||
property var list: []
|
||||
|
||||
function addItem(item) {
|
||||
|
|
@ -68,7 +68,7 @@ Singleton {
|
|||
|
||||
FileView {
|
||||
id: todoFileView
|
||||
path: filePath
|
||||
path: Qt.resolvedUrl(root.filePath)
|
||||
onLoaded: {
|
||||
const fileContents = todoFileView.text()
|
||||
root.list = JSON.parse(fileContents)
|
||||
|
|
|
|||
Loading…
Reference in a new issue