simplify things by moving popups into a new layer

This commit is contained in:
lucy 2026-08-28 17:45:45 +02:00
commit 4410d41fb3
10 changed files with 223 additions and 199 deletions

View file

@ -1,107 +1,65 @@
pragma ComponentBehavior: Bound
import Quickshell
import Quickshell.Wayland
import Quickshell.Widgets
import QtQuick
import Qt.labs.folderlistmodel 2.11
import qs
import qs.settings
import qs.widgets
BarComponent {
id: main
implicitWidth: implicitHeight
required property int screenHeight
StyledIcon {
iconName: "preferences-desktop-wallpaper-symbolic"
anchors.centerIn: parent
}
MouseArea {
id: clickHandler
anchors.fill: main
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
onClicked: {
wallPicker.visible = !wallPicker.visible;
}
}
WlrLayershell {
id: wallPicker
visible: false
exclusionMode: ExclusionMode.Ignore
keyboardFocus: visible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
implicitHeight: main.screenHeight / 8
color: 'transparent'
anchors {
bottom: true
left: true
right: true
}
margins {
bottom: 20
left: 20
right: 20
}
onVisibleChanged: {
if (wallPicker.visible)
container.forceActiveFocus();
}
Rectangle {
id: container
focus: true
Keys.onEscapePressed: {
wallPicker.visible = false;
}
Rectangle {
id: wallPicker
color: "transparent"
Rectangle {
id: container
focus: true
anchors.fill: parent
color: Colors.base02
radius: Config.cfg.appearance.rounding
GridView {
id: wallpaperLayout
clip: true
snapMode: GridView.SnapOneRow
flow: GridView.FlowTopToBottom
cellHeight: container.height
cellWidth: container.width / 8
anchors.fill: parent
color: Colors.base02
radius: Config.cfg.appearance.rounding
GridView {
id: wallpaperLayout
anchors.centerIn: parent
anchors.margins: 10
model: wallpaperList
delegate: ClippingRectangle {
id: wallTile
clip: true
snapMode: GridView.SnapOneRow
flow: GridView.FlowTopToBottom
cellHeight: container.height
cellWidth: container.width / 8
anchors.fill: parent
anchors.centerIn: parent
anchors.margins: 10
model: wallpaperList
delegate: ClippingRectangle {
id: wallTile
clip: true
required property var modelData
radius: Config.cfg.appearance.rounding / 1.5
color: 'transparent'
implicitWidth: wallpaperLayout.cellWidth - 20
implicitHeight: wallpaperLayout.cellHeight - 20
Image {
id: wallpaper
anchors.fill: parent
source: wallTile.modelData.filePath
sourceSize.width: 16 * 30
sourceSize.height: 9 * 30
asynchronous: true
cache: true
}
MouseArea {
id: wpClickHandler
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton
hoverEnabled: true
onClicked: {
Config.cfg.wallpaper.wallpaper = wallTile.modelData.filePath;
Config.save();
}
required property var modelData
radius: Config.cfg.appearance.rounding / 1.5
color: 'transparent'
implicitWidth: wallpaperLayout.cellWidth - 20
implicitHeight: wallpaperLayout.cellHeight - 20
Image {
id: wallpaper
anchors.fill: parent
source: wallTile.modelData.filePath
sourceSize.width: 16 * 30
sourceSize.height: 9 * 30
asynchronous: true
cache: true
}
MouseArea {
id: wpClickHandler
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton
hoverEnabled: true
onClicked: {
Config.cfg.wallpaper.wallpaper = wallTile.modelData.filePath;
Config.save();
}
}
}
FolderListModel {
id: wallpaperList
folder: Qt.resolvedUrl(Config.cfg.wallpaper.wallDir)
nameFilters: ["*.png"]
}
}
FolderListModel {
id: wallpaperList
folder: Qt.resolvedUrl(Config.cfg.wallpaper.wallDir)
nameFilters: ["*.png"]
}
}
}