Compare commits
43 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d8037a82c | |||
| cf55c79855 | |||
| e9fab71e9d | |||
| 5318d3897b | |||
| 8967e3a1f5 | |||
| 089a5f7a49 | |||
| 4acc1556b2 | |||
| 9dd1a5430d | |||
| dbcde131aa | |||
| 2f8a3e98a5 | |||
| 03adbbd38f | |||
| bdccb9e0aa | |||
| 010643ee23 | |||
| 7fa9f85856 | |||
| 1a39b63b20 | |||
| da07682764 | |||
| b20768f64c | |||
| 2663d706b8 | |||
| c57e90d65e | |||
| cbd67c3c34 | |||
| 09d5484f52 | |||
| fc737d6edc | |||
| 7c67b41a7b | |||
| 2b16c6a612 | |||
| c6277a4a2a | |||
| ab2b3ce0a8 | |||
| 1d70410331 | |||
| 49c49e2e90 | |||
| 5dad7c0769 | |||
| 319a8ce00f | |||
| 74692b2b97 | |||
| 35522f5c3c | |||
| 5d0272b9bd | |||
| f2ac47cd88 | |||
| e7f2e43e52 | |||
| 0718d25887 | |||
| 52bc58da18 | |||
| 6911476077 | |||
| 270a7c0e4e | |||
| ae32389764 | |||
| 89962477c0 | |||
| ca365460af | |||
| e7cebf3092 |
Binary file not shown.
|
After Width: | Height: | Size: 1.0 MiB |
Executable → Regular
|
Before Width: | Height: | Size: 298 KiB After Width: | Height: | Size: 298 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 647 KiB |
@@ -0,0 +1,53 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtCore
|
||||
import QtQuick
|
||||
import Quickshell.Io
|
||||
import Quickshell
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
property alias gifFolder: adapter.gifFolder
|
||||
property string configDir: Quickshell.env("HOME") + "/.config/I-DeskPet"
|
||||
property string configPath: configDir + "/config.json"
|
||||
|
||||
signal folderChanged()
|
||||
|
||||
Process {
|
||||
id: dirCheck
|
||||
running: true
|
||||
command: ["test", "-d", root.configDir]
|
||||
|
||||
onExited: function( exitCode ) {
|
||||
if (exitCode !== 0) {
|
||||
dirCreate.running = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import Quickshell.Io
|
||||
|
||||
Process {
|
||||
id: getGifsProcess
|
||||
required property string gifFolder
|
||||
property list<string> gifsList: []
|
||||
|
||||
command: ["find", gifFolder, "-type", "f", "-name", "*.gif"]
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
var gifs = this.text.trim().split("\n")
|
||||
if (gifs.length > 0 && gifs[0] !== "") {
|
||||
getGifsProcess.gifsList = gifs
|
||||
} else {
|
||||
getGifsProcess.gifsList = []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function reload() {
|
||||
gifsList = []
|
||||
running = false
|
||||
running = true
|
||||
}
|
||||
|
||||
onGifFolderChanged: {
|
||||
if (running) {
|
||||
reload()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import qs.Modules
|
||||
|
||||
Repeater {
|
||||
id: gifRepeater
|
||||
required property list<string> gifsList
|
||||
property int firstWidth
|
||||
property int lastWidth
|
||||
model: gifsList
|
||||
Item {
|
||||
id: gifItem
|
||||
|
||||
required property int index
|
||||
required property string modelData
|
||||
|
||||
function xPos(): void {
|
||||
let xPos = 0;
|
||||
const item = gifRepeater.itemAt(index - 1);
|
||||
if ( item ) xPos += item.x + item.width;
|
||||
return xPos;
|
||||
}
|
||||
|
||||
Component.onCompleted: x = xPos()
|
||||
|
||||
x: 0
|
||||
y: Screen.height - ( height + 10 )
|
||||
width: Math.floor( gif.sourceSize.width / 1.25 )
|
||||
height: Math.floor( gif.sourceSize.height / 1.25 )
|
||||
|
||||
AnimatedImage {
|
||||
id: gif
|
||||
source: gifItem.modelData
|
||||
// fillMode: Image.PreserveAspectFit
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Mouse {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import QtQuick
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton
|
||||
drag.target: parent
|
||||
drag.axis: Drag.XAndYAxis
|
||||
drag.minimumX: 0
|
||||
drag.maximumX: Screen.width - parent.width
|
||||
drag.minimumY: 0
|
||||
drag.maximumY: Screen.height - parent.height
|
||||
}
|
||||
@@ -1 +1,11 @@
|
||||
### Pet March (Evernight)
|
||||
<div align="Center">
|
||||
<h3> Pet March (Evernight) </h3>
|
||||
<p>My selfmade desktop pet using QT </p>
|
||||
<img src=./Assets/evernight.gif style="margin: 0px 30px 0px 0px;" />
|
||||
</div>
|
||||
|
||||
## Feature to-do list
|
||||
- [x] Hyprland keybind support (Swap between top/bottom/overlay)
|
||||
- [x] Be able to click through your pet
|
||||
- [] Dynamic pets
|
||||
- [] Multiple pets
|
||||
|
||||
@@ -1,55 +1,122 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Wayland
|
||||
//import qs.Gifs
|
||||
import Quickshell.Hyprland
|
||||
import qs.Modules
|
||||
|
||||
PanelWindow {
|
||||
id: mainWindow
|
||||
WlrLayershell.layer: WlrLayer.Top
|
||||
color: "transparent"
|
||||
anchors {
|
||||
bottom: true
|
||||
left: true
|
||||
}
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||
surfaceFormat.opaque: false
|
||||
implicitWidth: 320
|
||||
implicitHeight: 293
|
||||
margins {
|
||||
left: 0
|
||||
bottom: 5
|
||||
}
|
||||
|
||||
property bool onTop: true
|
||||
property list<Item> repeaterItems: []
|
||||
|
||||
function toggleLayer() {
|
||||
if (onTop) {
|
||||
WlrLayershell.layer = WlrLayer.Bottom
|
||||
onTop = false
|
||||
anchors {
|
||||
left: true
|
||||
bottom: true
|
||||
right: true
|
||||
top: true
|
||||
}
|
||||
|
||||
margins {
|
||||
left: 0
|
||||
bottom: 9
|
||||
right: 0
|
||||
top: 0
|
||||
}
|
||||
|
||||
GetGifs {
|
||||
id: getGifs
|
||||
gifFolder: ConfigLoader.gifFolder
|
||||
running: true
|
||||
}
|
||||
|
||||
GifsLoader {
|
||||
id: gifLoader
|
||||
gifsList: getGifs.gifsList
|
||||
onItemAdded: function( index, item ) {
|
||||
mainWindow.repeaterItems.push( item )
|
||||
}
|
||||
}
|
||||
|
||||
Variants {
|
||||
id: maskVariants
|
||||
|
||||
model: [ ...mainWindow.repeaterItems ]
|
||||
|
||||
Region {
|
||||
required property Item modelData
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log(modelData)
|
||||
}
|
||||
|
||||
x: modelData.x
|
||||
y: modelData.y
|
||||
width: modelData.width
|
||||
height: modelData.height
|
||||
intersection: Intersection.Subtract
|
||||
}
|
||||
}
|
||||
|
||||
function petRegion( itemObject ) {
|
||||
let newregion = regionComponent.createObject( pets, { "item": itemObject })
|
||||
pets.regions.push( newregion )
|
||||
}
|
||||
|
||||
Component {
|
||||
id: regionComponent
|
||||
Region { }
|
||||
}
|
||||
|
||||
mask: Region {
|
||||
width: Screen.width
|
||||
height: Screen.height
|
||||
intersection: Intersection.Xor
|
||||
regions: maskVariants.instances
|
||||
}
|
||||
|
||||
property var petMove: Region { id: pets
|
||||
width: Screen.width
|
||||
height: Screen.height
|
||||
intersection: Intersection.Xor
|
||||
regions: maskVariants.instances
|
||||
}
|
||||
|
||||
property var noMove: Region {}
|
||||
|
||||
property bool setMask: true
|
||||
|
||||
GlobalShortcut {
|
||||
appid: "I-DeskPet"
|
||||
name: "toggle-Layer"
|
||||
onPressed: {
|
||||
if (!mainWindow.onTop) {
|
||||
mainWindow.WlrLayershell.layer = WlrLayer.Overlay
|
||||
mainWindow.onTop = true
|
||||
} else {
|
||||
WlrLayershell.layer = WlrLayer.Top
|
||||
onTop = true
|
||||
mainWindow.WlrLayershell.layer = WlrLayer.Bottom
|
||||
mainWindow.onTop = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "transparent"
|
||||
|
||||
id: petContainer
|
||||
AnimatedImage {
|
||||
anchors.fill: parent
|
||||
source: "Gifs/evernight.gif"
|
||||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.MiddleButton
|
||||
onClicked: (mouse) => {
|
||||
if (mouse.button === Qt.MiddleButton) {
|
||||
mainWindow.toggleLayer()
|
||||
}
|
||||
GlobalShortcut {
|
||||
appid: "I-DeskPet"
|
||||
name: "toggle-Region"
|
||||
onPressed: {
|
||||
if ( !mainWindow.setMask ) {
|
||||
mainWindow.mask = mainWindow.petMove
|
||||
mainWindow.setMask = true
|
||||
} else {
|
||||
mainWindow.mask = mainWindow.noMove
|
||||
mainWindow.setMask = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user