Initial commit

This commit is contained in:
Teo
2025-11-26 16:16:42 +01:00
commit 7a9756e0e1
9 changed files with 396 additions and 0 deletions
+145
View File
@@ -0,0 +1,145 @@
import QtQuick
import Quickshell
import QtQuick.Controls
import Quickshell.Hyprland
import Quickshell.Io
import Qt.labs.folderlistmodel
PanelWindow {
id: picker
implicitWidth: screen.width * 0.75
implicitHeight: screen.height * 0.5
color: "transparent"
visible: true
Rectangle {
anchors.fill: parent
radius: 10
color: "black"
border.width: 2
border.color: "white"
//Wallpaper space
Rectangle {
id: wallpaperContainer
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 20
width: parent.width - 35
height: parent.height - 100
color: "black"
radius: 10
clip: true
// get folder url
FolderListModel {
id: imagesModel
folder: "file://" + Quickshell.workingDirectory + "/Pictures/Wallpapers"
nameFilters: ["*.png", "*.jpg", "*.jpeg"]
showDirs: false
}
// grid
Item {
anchors.fill: parent
anchors.margins: 15
GridView {
id: grid
anchors.fill: parent
cellWidth: parent.width/6
cellHeight: parent.height/2 + 15
model: imagesModel
boundsBehavior: Flickable.StopAtBounds
// pictures + text
delegate: Item {
width: grid.cellWidth
height: grid.cellHeight
Column {
spacing: 20
Image { // Image
source: filePath
fillMode: Image.PreserveAspectCrop
width: grid.cellWidth -10
height: grid.cellHeight * 0.7
asynchronous: true
cache: true
}
Rectangle { // highlight of text
id: textHighlight
width: parent.width - 10
height: 24
color: mouseArea.containsMouse ? "#4a90e2" : "transparent"
anchors.horizontalCenter: parent.horizontalCenter
Text {
text: fileName
elide: Text.ElideRight
width: parent.width
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 15
font.family: "Fira Sans"
color: "white"
}
}
}
Item {
anchors.fill: parent
Process {
id: wallpaperProcess
command: ["sh", "-c", Quickshell.workingDirectory + "/.config/quickshell/modules/wp/set-wallpaper.sh" + " " + model.filePath + " &"]
stdout: StdioCollector {
onStreamFinished: console.log(`line read: ${this.text}`)
}
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
console.log("Setting wallpaper to:", model.fileName)
wallpaperProcess.startDetached()
wLoader.closeWallpaperPicker()
}
}
}
}
ScrollBar.vertical: ScrollBar {
policy: ScrollBar.AlwaysOn
}
}
}
Rectangle { // border of wallpaper container
id: borderOverlay
anchors.fill: parent
radius: 10
color: "transparent"
border.color: "white"
border.width: 1
z: 999
}
}
}
}
+26
View File
@@ -0,0 +1,26 @@
import QtQuick
import Quickshell
import Quickshell.Hyprland
Item { // container, invisible
id: wLoader
Loader {
id: wallpaperLoader
active: false
sourceComponent: WallpaperPicker { id: wPicker }
}
GlobalShortcut {
name: "Wallpaper"
description: "Open wallpaper picker"
onPressed: {
wallpaperLoader.active = !wallpaperLoader.active
console.log("Pressed Meta+Shift+W (Hyprland global shortcut)")
}
}
function closeWallpaperPicker() {
wallpaperLoader.active = false
}
}
+27
View File
@@ -0,0 +1,27 @@
#!/bin/bash
# Path to the image is the first argument
IMAGE="$1"
echo "start"
# Check if an image was provided
if [[ -z "$IMAGE" ]]; then
echo "Usage: $0 /path/to/image"
exit 1
fi
# Check if swww daemon is running
if ! pgrep -x "swww-daemon" > /dev/null; then
echo "Starting swww daemon..."
swww-daemon &
# Give the daemon a moment to start
sleep 0.2
echo "daemon started"
fi
# Set the wallpaper
echo "running"
swww img "$IMAGE" -t grow --transition-duration 1