Finished.
This commit is contained in:
|
Before Width: | Height: | Size: 294 KiB After Width: | Height: | Size: 294 KiB |
@@ -16,8 +16,12 @@ Repeater {
|
|||||||
|
|
||||||
required property url fileUrl
|
required property url fileUrl
|
||||||
required property string fileBaseName
|
required property string fileBaseName
|
||||||
|
required property int index
|
||||||
property bool loaded: false
|
property bool loaded: false
|
||||||
|
property alias hovered: mouse.containsMouse
|
||||||
|
property alias zIndex: gifSaved.zIndex
|
||||||
|
|
||||||
|
z: gifSaved.zIndex
|
||||||
visible: gifItem.loaded
|
visible: gifItem.loaded
|
||||||
onXChanged: if ( gifItem.loaded ) gifSaved.positionX = gifItem.x
|
onXChanged: if ( gifItem.loaded ) gifSaved.positionX = gifItem.x
|
||||||
onYChanged: if ( gifItem.loaded ) gifSaved.positionY = gifItem.y
|
onYChanged: if ( gifItem.loaded ) gifSaved.positionY = gifItem.y
|
||||||
@@ -32,6 +36,7 @@ Repeater {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Mouse {
|
Mouse {
|
||||||
|
id: mouse
|
||||||
onWheel: (wheel)=> {
|
onWheel: (wheel)=> {
|
||||||
gifSaved.scaling = Math.max( 1, ( gifSaved.scaling + 0.1 * ( wheel.angleDelta.y / 120 ) ) )
|
gifSaved.scaling = Math.max( 1, ( gifSaved.scaling + 0.1 * ( wheel.angleDelta.y / 120 ) ) )
|
||||||
}
|
}
|
||||||
@@ -48,12 +53,14 @@ Repeater {
|
|||||||
property string configPath: configDir + name
|
property string configPath: configDir + name
|
||||||
|
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
|
if ( gifSaved.zIndex === -1 ) gifSaved.zIndex = gifItem.index
|
||||||
gifItem.x = gifSaved.positionX
|
gifItem.x = gifSaved.positionX
|
||||||
gifItem.y = gifSaved.positionY
|
gifItem.y = gifSaved.positionY
|
||||||
gifItem.loaded = true
|
gifItem.loaded = true
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoadFailed: {
|
onLoadFailed: {
|
||||||
|
gifSaved.zIndex = gifItem.index
|
||||||
writeAdapter()
|
writeAdapter()
|
||||||
gifItem.loaded = true
|
gifItem.loaded = true
|
||||||
}
|
}
|
||||||
@@ -70,6 +77,7 @@ Repeater {
|
|||||||
property real scaling: 1
|
property real scaling: 1
|
||||||
property int positionX: 0
|
property int positionX: 0
|
||||||
property int positionY: 0
|
property int positionY: 0
|
||||||
|
property int zIndex: -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import QtQuick
|
|||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
|
hoverEnabled: true
|
||||||
drag.target: parent
|
drag.target: parent
|
||||||
drag.axis: Drag.XAndYAxis
|
drag.axis: Drag.XAndYAxis
|
||||||
drag.minimumX: 0
|
drag.minimumX: 0
|
||||||
|
|||||||
@@ -1,20 +1,16 @@
|
|||||||
<div align="Center">
|
<div align="Center">
|
||||||
<h3> Pet March (Evernight) </h3>
|
<h3> Pet March (Evernight) </h3>
|
||||||
<p>My selfmade desktop pet using QT </p>
|
<p>My selfmade desktop pet using QT </p>
|
||||||
<img src=./Assets/evernight.gif style="margin: 0px 30px 0px 0px;" />
|
<img src=./Assets/Evernight.gif style="margin: 0px 30px 0px 0px;" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
## Feature list
|
## Feature list
|
||||||
|
|
||||||
- [x] Hyprland keybind support
|
- [x] Hyprland keybind support
|
||||||
- [x] Swap Overlay <> Bottom
|
- [x] Swap Overlay <> Bottom
|
||||||
- [x] Swap Mouse area targetted -/+
|
- [x] Swap Mouse area targetted -/+
|
||||||
- [x] Dynamic pets
|
- [x] Dynamic pets
|
||||||
- [x] Multiple pets
|
- [x] Multiple pets
|
||||||
- [x] Config location ~/.config/I-DeskPet/config.json
|
- [x] Config location ~/.config/I-DeskPet/config.json
|
||||||
{"gifFolder": "PATH"}
|
{"gifFolder": "PATH"}
|
||||||
- [x] Evernight base gif img
|
- [x] Evernight base gif img
|
||||||
|
|
||||||
## To-Do list
|
|
||||||
- [] Setting more json settings
|
|
||||||
- [] Clear up code
|
|
||||||
- [] Auto update gifs modeldata
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import qs.Modules
|
|||||||
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: mainWindow
|
id: mainWindow
|
||||||
WlrLayershell.namespace: "IDeskPet-Pet"
|
WlrLayershell.namespace: "I-DeskPet"
|
||||||
WlrLayershell.layer: WlrLayer.Overlay
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||||
surfaceFormat.opaque: false
|
surfaceFormat.opaque: false
|
||||||
@@ -110,17 +110,58 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalShortcut {
|
GlobalShortcut {
|
||||||
appid: "I-DeskPet"
|
appid: "I-DeskPet"
|
||||||
name: "toggle-Region"
|
name: "toggle-Region"
|
||||||
onPressed: {
|
onPressed: {
|
||||||
if ( !mainWindow.setMask ) {
|
if ( !mainWindow.setMask ) {
|
||||||
mainWindow.mask = mainWindow.petMove
|
mainWindow.mask = mainWindow.petMove
|
||||||
mainWindow.setMask = true
|
mainWindow.setMask = true
|
||||||
} else {
|
} else {
|
||||||
mainWindow.mask = mainWindow.noMove
|
mainWindow.mask = mainWindow.noMove
|
||||||
mainWindow.setMask = false
|
mainWindow.setMask = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
GlobalShortcut {
|
||||||
|
appid: "I-DeskPet"
|
||||||
|
name: "cycle-zIndex"
|
||||||
|
onPressed: {
|
||||||
|
let items = mainWindow.repeaterItems
|
||||||
|
if ( items.length < 2 ) return
|
||||||
|
|
||||||
|
// Find the hovered GIF
|
||||||
|
let hovered = null
|
||||||
|
for ( let i = 0; i < items.length; i++ ) {
|
||||||
|
if ( items[i].hovered ) {
|
||||||
|
hovered = items[i]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( !hovered ) return
|
||||||
|
|
||||||
|
let currentZ = hovered.zIndex
|
||||||
|
let maxZ = items.length - 1
|
||||||
|
|
||||||
|
if ( currentZ >= maxZ ) {
|
||||||
|
// Already on top, wrap to bottom: shift everyone else up by 1
|
||||||
|
for ( let i = 0; i < items.length; i++ ) {
|
||||||
|
if ( items[i] !== hovered ) {
|
||||||
|
items[i].zIndex += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hovered.zIndex = 0
|
||||||
|
} else {
|
||||||
|
// Swap with the item directly above
|
||||||
|
for ( let i = 0; i < items.length; i++ ) {
|
||||||
|
if ( items[i] !== hovered && items[i].zIndex === currentZ + 1 ) {
|
||||||
|
items[i].zIndex = currentZ
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hovered.zIndex = currentZ + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user