test popouts #61

Merged
zach merged 7 commits from test-popouts into main 2026-04-18 00:17:36 +02:00
2 changed files with 33 additions and 29 deletions
Showing only changes of commit a7457c57c0 - Show all commits
+6 -2
View File
@@ -54,7 +54,7 @@ CustomMouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: (pressed && dragStart.y < bar.implicitHeight) ? Qt.ClosedHandCursor : undefined cursorShape: (pressed && dragStart.y < bar.implicitHeight) ? Qt.ClosedHandCursor : undefined
hoverEnabled: true hoverEnabled: true
propagateComposedEvents: true propagateComposedEvents: false
onContainsMouseChanged: { onContainsMouseChanged: {
if (!containsMouse) { if (!containsMouse) {
@@ -92,6 +92,10 @@ CustomMouseArea {
visibilities.settings = false; visibilities.settings = false;
} }
if (Config.dock.hoverToReveal && pressed && dragStart.y > root.screen.height - root.bar.implicitHeight)
if (dragY < -10)
visibilities.dock = true;
if (panels.sidebar.width === 0) { if (panels.sidebar.width === 0) {
const showOsd = inRightPanel(panels.osd, x, y); const showOsd = inRightPanel(panels.osd, x, y);
@@ -112,7 +116,7 @@ CustomMouseArea {
} }
} }
if (!visibilities.dock && !visibilities.launcher && inBottomPanel(panels.dock, x, y)) if (Config.dock.enable && !Config.dock.hoverToReveal && !visibilities.dock && !visibilities.launcher && inBottomPanel(panels.dock, x, y))
visibilities.dock = true; visibilities.dock = true;
if (y < root.bar.implicitHeight) { if (y < root.bar.implicitHeight) {
+18 -18
View File
@@ -9,15 +9,16 @@ import qs.Helpers
ColumnLayout { ColumnLayout {
id: root id: root
width: Math.min(parent ? parent.width : 600, 600)
spacing: 15 spacing: 15
width: Math.min(parent ? parent.width : 600, 600)
Rectangle { Rectangle {
id: previewContainer id: previewContainer
Layout.fillWidth: true
Layout.preferredHeight: width * (Quickshell.screens.length > 0 ? (Quickshell.screens[0].height / Math.max(1, Quickshell.screens[0].width)) : 9/16) Layout.fillHeight: true
Layout.preferredWidth: height * (Quickshell.screens.length > 0 ? (Quickshell.screens[0].height / Math.max(1, Quickshell.screens[0].width)) : 16 / 9)
clip: true clip: true
color: DynamicColors.surfaceContainer color: DynamicColors.palette.m3surfaceContainer
radius: Config.appearance.rounding.scale * 10 radius: Config.appearance.rounding.scale * 10
Image { Image {
@@ -31,29 +32,26 @@ ColumnLayout {
Rectangle { Rectangle {
id: cropRect id: cropRect
property real paintedWidth: img.paintedWidth > 0 ? img.paintedWidth : img.width property real cropHeight: (imageAspect > screenAspect ? paintedHeight : paintedWidth / screenAspect) / Config.background.zoom
property real cropWidth: (imageAspect > screenAspect ? paintedHeight * screenAspect : paintedWidth) / Config.background.zoom
property real imageAspect: Math.max(1, paintedWidth) / Math.max(1, paintedHeight)
property real paintedHeight: img.paintedHeight > 0 ? img.paintedHeight : img.height property real paintedHeight: img.paintedHeight > 0 ? img.paintedHeight : img.height
property real paintedWidth: img.paintedWidth > 0 ? img.paintedWidth : img.width
property real paintedX: (img.width - paintedWidth) / 2 property real paintedX: (img.width - paintedWidth) / 2
property real paintedY: (img.height - paintedHeight) / 2 property real paintedY: (img.height - paintedHeight) / 2
property real screenAspect: Quickshell.screens.length > 0 ? (Quickshell.screens[0].width / Math.max(1, Quickshell.screens[0].height)) : 16 / 9
property real screenAspect: Quickshell.screens.length > 0 ? (Quickshell.screens[0].width / Math.max(1, Quickshell.screens[0].height)) : 16/9 border.color: DynamicColors.palette.m3primary
property real imageAspect: Math.max(1, paintedWidth) / Math.max(1, paintedHeight)
property real cropWidth: (imageAspect > screenAspect ? paintedHeight * screenAspect : paintedWidth) / Config.background.zoom
property real cropHeight: (imageAspect > screenAspect ? paintedHeight : paintedWidth / screenAspect) / Config.background.zoom
border.color: DynamicColors.primary
border.width: 2 border.width: 2
color: DynamicColors.primaryContainer.withAlpha(0.3) color: Qt.alpha(DynamicColors.palette.m3primaryContainer, 0.3)
width: cropWidth
height: cropHeight height: cropHeight
width: cropWidth
x: paintedX + (paintedWidth - width) * Config.background.alignX x: paintedX + (paintedWidth - width) * Config.background.alignX
y: paintedY + (paintedHeight - height) * Config.background.alignY y: paintedY + (paintedHeight - height) * Config.background.alignY
DragHandler { DragHandler {
target: null target: null
onActiveTranslationChanged: { onActiveTranslationChanged: {
if (active) { if (active) {
let newX = cropRect.x - cropRect.paintedX + translation.x; let newX = cropRect.x - cropRect.paintedX + translation.x;
@@ -65,11 +63,13 @@ ColumnLayout {
if (rangeX > 0) { if (rangeX > 0) {
let valX = newX / rangeX; let valX = newX / rangeX;
Config.background.alignX = Math.max(0.0, Math.min(1.0, valX)); Config.background.alignX = Math.max(0.0, Math.min(1.0, valX));
Config.save();
} }
if (rangeY > 0) { if (rangeY > 0) {
let valY = newY / rangeY; let valY = newY / rangeY;
Config.background.alignY = Math.max(0.0, Math.min(1.0, valY)); Config.background.alignY = Math.max(0.0, Math.min(1.0, valY));
Config.save();
} }
} }
} }
@@ -92,11 +92,11 @@ ColumnLayout {
} }
SettingSpinBox { SettingSpinBox {
max: 5.0
min: 1.0
name: "Zoom" name: "Zoom"
object: Config.background object: Config.background
setting: "zoom" setting: "zoom"
min: 1.0
max: 5.0
step: 0.1 step: 0.1
} }
} }