add files beacuse i forgor

This commit is contained in:
lucy 2025-12-23 14:10:41 +01:00
parent f15f6e3c82
commit c5198abcf9
4 changed files with 137 additions and 2 deletions

View File

@ -14,8 +14,8 @@ Item {
Repeater { Repeater {
id: workspaceRepeater id: workspaceRepeater
Rectangle { Rectangle {
width: 18 width: 14
height: 18 height: 14
radius: 10 radius: 10
//color: modelData.active ? myPallete.accent : myPallete.window //color: modelData.active ? myPallete.accent : myPallete.window
color: modelData.active ? Colors.foreground : "transparent" color: modelData.active ? Colors.foreground : "transparent"

View File

@ -0,0 +1,101 @@
import QtQuick
import Qt.labs.folderlistmodel 2.15 // <--- The magic file scanner!
import Quickshell
import Quickshell.Hyprland
import Quickshell.Io
import "."
import qs.modules.bar
FloatingWindow {
id: root
title: "quickshell-WallSwitcher"
visible: false
implicitWidth: 840
implicitHeight: 640
GlobalShortcut {
// This is the "Secret Password" Hyprland will use
name: "toggle-walls"
onPressed: {
// Toggle visibility!
root.visible = !root.visible;
console.log("Shortcut pressed! Switcher is now: " + (root.visible ? "Visible" : "Hidden"));
}
}
// Make it float above everything else
Text {
id: titleText
text: "Wallpapers in " + WallpaperStore.wallDir
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
font.pixelSize: 20
topPadding: 20
bottomPadding: 10
font.family: Appearance.font
color: Colors.foreground
}
color: Colors.background // Dark background
// 1. The File Scanner
FolderListModel {
id: folderModel
folder: "file:///home/lucy/.walls/" // <--- Your stash!
nameFilters: ["*.png", "*.jpg", "*.jpeg"]
showDirs: false
}
// 2. The Grid Display
GridView {
anchors.top: titleText.bottom // Sit below the title!
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 20
cellWidth: 200
cellHeight: 100
clip: true
model: folderModel
delegate: Item {
width: 200
height: 100
Image {
width: 180
height: 90
anchors.centerIn: parent
// "fileUrl" is provided by FolderListModel
source: fileUrl
// IMPORTANT: Downscale the image for the thumbnail!
// If you don't do this, loading 50 4K images will eat your RAM
// faster than Chrome eats memory! 🙀
sourceSize.width: 140
sourceSize.height: 90
fillMode: Image.PreserveAspectCrop
}
MouseArea {
Process {
id: generateScheme
property string cleanPath: fileUrl.toString().replace("file://", "")
command: ["wallust", "run", cleanPath]
}
anchors.fill: parent
onClicked: {
let cleanPath = fileUrl.toString().replace("file://", "");
// Update the Singleton!
WallpaperStore.currentWall = fileUrl.toString();
generateScheme.startDetached();
console.log(generateScheme.stdout);
}
}
}
}
}

View File

@ -0,0 +1,31 @@
pragma Singleton
import QtQuick
import Quickshell.Io // <--- Import for FileView and JsonAdapter
QtObject {
id: store
// 1. The File Manager
property string wallDir: "~/.walls/"
property var settings: FileView {
path: "/home/lucy/.cache/quickshell_settings.json"
// Auto-save when properties change
onAdapterUpdated: writeAdapter()
// Auto-load when the file changes on disk
watchChanges: true
onFileChanged: reload()
// 2. The Magic Adapter
JsonAdapter {
id: adapter
// This property corresponds to a key in your JSON file!
property string lastWallpaper: "/home/lucy/.walls/frieren_river.jpg"
}
}
// 3. Create a helper property for the rest of your app to use
// This keeps the "WallpaperStore.currentWall" name working!
property alias currentWall: adapter.lastWallpaper
}

3
modules/wallpaper/qmldir Normal file
View File

@ -0,0 +1,3 @@
singleton WallpaperStore 1.0 WallpaperStore.qml
Wallpaper 1.0 Wallpaper.qml
WallSwitcher 1.0 WallSwitcher.qml