This commit is contained in:
2026-02-12 19:27:51 +01:00
parent e31ff0aa27
commit d446be5fbd
3 changed files with 54 additions and 93 deletions
-66
View File
@@ -1,66 +0,0 @@
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
}
}
}
+54 -12
View File
@@ -1,6 +1,7 @@
pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import Quickshell.Io
import qs.Modules
@@ -15,19 +16,17 @@ Repeater {
required property int index
required property string modelData
function xPos(): int {
let xPos = 0;
const item = gifRepeater.itemAt(index - 1);
if ( item ) xPos += item.x + item.width;
return xPos;
}
// function xPos(): int {
// let xPos = 0;
// const item = gifRepeater.itemAt(index - 1);
// if ( item ) xPos += item.x + item.width;
// return xPos;
// }
Component.onCompleted: x = xPos()
// Component.onCompleted: x = xPos()
x: 0
y: Screen.height - height
width: ( Math.floor( gif.sourceSize.width / ConfigLoader.scaling ) ? gif.sourceSize.width )
height: ( Math.floor( gif.sourceSize.height / ConfigLoader.scaling ) ? gif.sourceSize.height )
width: Math.floor( gif.sourceSize.width / gifSaved.scaling )
height: Math.floor( gif.sourceSize.height / gifSaved.scaling )
AnimatedImage {
id: gif
@@ -36,6 +35,49 @@ Repeater {
anchors.fill: parent
}
Mouse {}
Mouse {
onWheel: (wheel)=> {
gifSaved.scaling = Math.max( 1, ( gifSaved.scaling + 0.1 * ( wheel.angleDelta.y / 120 ) ) )
}
onClicked: gifSaved.scaling = 1
onReleased: {
console.log(gifItem.x)
gifSaved.positionX = gifItem.x
gifSaved.positionY = gifItem.y
}
}
FileView {
id: watcher
path: configPath
property list<string> gifNames: gifItem.modelData.split("/")
property string name: gifNames[gifNames.length - 1].split(".")[0] + ".json"
property string configDir: Quickshell.env("HOME") + "/.config/I-DeskPet/"
property string configPath: configDir + name
property alias positionX: gifSaved.positionX
property alias positionY: gifSaved.positionY
onLoaded: {
gifItem.x = gifSaved.positionX
gifItem.y = gifSaved.positionY
}
watchChanges: true
onFileChanged: reload()
onAdapterUpdated: writeAdapter()
JsonAdapter {
id: gifSaved
property var scaling: 1
property var positionX: 0
property var positionY: ( Screen.height - gifItem.height )
}
}
}
}
-15
View File
@@ -1,15 +0,0 @@
thingy macbobber: wayland quickshell sessionlock
Timer {
property bool hasReloaded
interval: 5000
repeat: true
onTriggered: {
if ( screenUnlocked && !hasReloaded ) {
hasReloaded = true;
petslocation = null;
petslocation = wherever;
}
return;
}
}