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