can't be working on this at work lmao
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtCore
|
||||
import QtQuick
|
||||
import Quickshell.Io
|
||||
import Quickshell
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
property alias gifFolder: adapter.gifFolder
|
||||
property alias scaling: adapter.scaling
|
||||
property alias maxWidth: adapter.maxWidth
|
||||
property alias maxHeight: adapter.maxHeight
|
||||
property string configDir: Quickshell.env("HOME") + "/.local/state/I-DeskPet"
|
||||
property string configPath: configDir + "/name.json"
|
||||
|
||||
signal folderChanged()
|
||||
|
||||
Process {
|
||||
id: dirCheck
|
||||
running: true
|
||||
command: ["test", "-d", root.configDir]
|
||||
|
||||
onExited: function( exitCode ) {
|
||||
if (exitCode !== 0) {
|
||||
dirCreate.running = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// name
|
||||
Component.onCompleted: {
|
||||
var s = gifItem.modelData.split("/")
|
||||
console.log(s[s.length - 1].split(".")[0].add(".json"))
|
||||
}
|
||||
|
||||
Process {
|
||||
id: dirCreate
|
||||
running: false
|
||||
command: ["mkdir", "-p", root.configDir]
|
||||
|
||||
onExited: function(): void {
|
||||
console.log("Created config directory:", root.configDir)
|
||||
}
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: watcher
|
||||
path: root.configPath
|
||||
|
||||
watchChanges: true
|
||||
|
||||
onFileChanged: reload()
|
||||
|
||||
JsonAdapter {
|
||||
id: adapter
|
||||
|
||||
property string gifFolder: Quickshell.shellDir + "/Gifs"
|
||||
property var scaling: 1
|
||||
property int maxWidth: 1000
|
||||
property int maxHeight: 1000
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,18 +26,14 @@ Repeater {
|
||||
|
||||
x: 0
|
||||
y: Screen.height - height
|
||||
width: Math.min( Math.floor( gif.sourceSize.width / ConfigLoader.scaling ), Math.floor( ConfigLoader.maxWidth / ConfigLoader.scaling ))
|
||||
height: Math.min( Math.floor( gif.sourceSize.height / ConfigLoader.scaling ), Math.floor( ConfigLoader.maxHeight / ConfigLoader.scaling ))
|
||||
width: ( Math.floor( gif.sourceSize.width / ConfigLoader.scaling ) ? gif.sourceSize.width )
|
||||
height: ( Math.floor( gif.sourceSize.height / ConfigLoader.scaling ) ? gif.sourceSize.height )
|
||||
|
||||
AnimatedImage {
|
||||
id: gif
|
||||
source: gifItem.modelData
|
||||
fillMode: Image.PreserveAspectFit
|
||||
anchors.fill: parent
|
||||
Component.onCompleted: {
|
||||
var s = gifItem.modelData.split("/")
|
||||
console.log(s[s.length - 1].split(".")[0])
|
||||
}
|
||||
}
|
||||
|
||||
Mouse {}
|
||||
|
||||
Reference in New Issue
Block a user