add global shortcut to trigger wallswitcher

This commit is contained in:
lucy 2026-01-21 22:25:30 +01:00
parent c3141abbb4
commit e294001554
2 changed files with 28 additions and 12 deletions

View File

@ -6,13 +6,29 @@ import Quickshell.Widgets
import qs.reusables import qs.reusables
import Qt.labs.folderlistmodel 2.10 import Qt.labs.folderlistmodel 2.10
import Quickshell.Io import Quickshell.Io
import qs
import Quickshell.Hyprland
FloatingWindow { FloatingWindow {
id: wallswitcherWindow id: root
implicitHeight: 1200 visible: Settings.config.wallSwitcherShown
implicitWidth: 1800
Process {
id: wallustRunner
property string cmd: "matugen image " + Settings.config.currentWall + " -t scheme-fidelity"
command: ["sh", "-c", cmd]
}
GlobalShortcut {
name: "showWallSwitcher"
onPressed: {
Settings.config.wallSwitcherShown = true;
}
}
implicitHeight: 600
implicitWidth: 900
title: "qs-wallswitcher" title: "qs-wallswitcher"
color: "green" color: Colors.background
WrapperItem { WrapperItem {
id: innerWindowWrapper id: innerWindowWrapper
anchors.centerIn: parent anchors.centerIn: parent
@ -31,7 +47,7 @@ FloatingWindow {
topMargin: innerWindowText.implicitHeight + innerWindowText.topPadding topMargin: innerWindowText.implicitHeight + innerWindowText.topPadding
anchors.fill: parent anchors.fill: parent
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
leftMargin: 20 leftMargin: 40
rightMargin: 20 rightMargin: 20
FolderListModel { FolderListModel {
@ -43,17 +59,16 @@ FloatingWindow {
Component { Component {
id: fileDelegate id: fileDelegate
Image { Image {
asynchronous: true
cache: true
required property string filePath required property string filePath
source: filePath source: filePath
width: 120 width: 120
height: 80 height: 80
sourceSize.width: 120
sourceSize.height: 80
MouseArea { MouseArea {
id: wallpaperSetter id: wallpaperSetter
Process {
id: wallustRunner
property string cmd: "matugen image " + Settings.config.currentWall + " -t scheme-fidelity"
command: ["sh", "-c", cmd]
}
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
@ -72,11 +87,11 @@ FloatingWindow {
} }
radius: 24 radius: 24
color: "black" color: Colors.background
CustomText { CustomText {
id: innerWindowText id: innerWindowText
topPadding: 10 topPadding: 10
text: "Hello, world!" text: "Wallpapers in " + Settings.config.wallDir
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
} }

View File

@ -33,6 +33,7 @@ Singleton {
property int paddingTop: 10 property int paddingTop: 10
property int paddingSides: 10 property int paddingSides: 10
property var generateScheme: true property var generateScheme: true
property bool wallSwitcherShown: false
} }
} }
} }