From db8d51b931c5685b89768546d2c5e15a940e9cd2 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 9 Jun 2025 12:25:41 +0200 Subject: [PATCH] overview: window previews!!! --- .../modules/common/widgets/StyledLabel.qml | 15 +++++++++++++++ .../modules/overview/OverviewWidget.qml | 18 +++++++++++++----- .../modules/overview/OverviewWindow.qml | 19 ++++++++++++++++++- 3 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 .config/quickshell/modules/common/widgets/StyledLabel.qml diff --git a/.config/quickshell/modules/common/widgets/StyledLabel.qml b/.config/quickshell/modules/common/widgets/StyledLabel.qml new file mode 100644 index 000000000..20a1cc9f0 --- /dev/null +++ b/.config/quickshell/modules/common/widgets/StyledLabel.qml @@ -0,0 +1,15 @@ +import "root:/modules/common" +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Label { + renderType: Text.NativeRendering + verticalAlignment: Text.AlignVCenter + font { + hintingPreference: Font.PreferFullHinting + family: Appearance?.font.family.main ?? "sans-serif" + pixelSize: Appearance?.font.pixelSize.small ?? 15 + } + color: Appearance?.m3colors.m3onBackground ?? "black" +} diff --git a/.config/quickshell/modules/overview/OverviewWidget.qml b/.config/quickshell/modules/overview/OverviewWidget.qml index a690536fe..f6f1f4840 100644 --- a/.config/quickshell/modules/overview/OverviewWidget.qml +++ b/.config/quickshell/modules/overview/OverviewWidget.qml @@ -145,14 +145,22 @@ Item { Repeater { // Window repeater model: ScriptModel { - values: windowAddresses.filter((address) => { - var win = windowByAddress[address] - return (root.workspaceGroup * root.workspacesShown < win?.workspace?.id && win?.workspace?.id <= (root.workspaceGroup + 1) * root.workspacesShown) - }) + values: { + // console.log(JSON.stringify(ToplevelManager.toplevels.values.map(t => t), null, 2)) + return ToplevelManager.toplevels.values.filter((toplevel) => { + const address = `0x${toplevel.HyprlandToplevel.address}` + // console.log(`Checking window with address: ${address}`) + var win = windowByAddress[address] + return (root.workspaceGroup * root.workspacesShown < win?.workspace?.id && win?.workspace?.id <= (root.workspaceGroup + 1) * root.workspacesShown) + }) + } } delegate: OverviewWindow { + required property var modelData + property var address: `0x${modelData.HyprlandToplevel.address}` id: window - windowData: windowByAddress[modelData] + windowData: windowByAddress[address] + toplevel: modelData monitorData: root.monitorData scale: root.scale availableWorkspaceWidth: root.workspaceImplicitWidth diff --git a/.config/quickshell/modules/overview/OverviewWindow.qml b/.config/quickshell/modules/overview/OverviewWindow.qml index d4617b542..15d919f80 100644 --- a/.config/quickshell/modules/overview/OverviewWindow.qml +++ b/.config/quickshell/modules/overview/OverviewWindow.qml @@ -1,17 +1,21 @@ +import "root:/" import "root:/services/" import "root:/modules/common" import "root:/modules/common/widgets" import "root:/modules/common/functions/color_utils.js" as ColorUtils import Qt5Compat.GraphicalEffects import QtQuick +import QtQuick.Controls import QtQuick.Layouts import Quickshell import Quickshell.Widgets import Quickshell.Io +import Quickshell.Wayland import Quickshell.Hyprland Rectangle { // Window id: root + property var toplevel property var windowData property var monitorData property var scale @@ -60,6 +64,12 @@ Rectangle { // Window animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this) } + ScreencopyView { + anchors.fill: parent + captureSource: GlobalStates.overviewOpen ? root.toplevel : null + live: false + } + ColumnLayout { anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left @@ -77,12 +87,19 @@ Rectangle { // Window } } - StyledText { + StyledLabel { Layout.leftMargin: 10 Layout.rightMargin: 10 visible: !compactMode Layout.fillWidth: true Layout.fillHeight: true + + background: Rectangle { + width: parent.width + color: Appearance.colors.colLayer2 + radius: Appearance.rounding.windowRounding * root.scale + } + horizontalAlignment: Text.AlignHCenter font.pixelSize: Appearance.font.pixelSize.smaller font.italic: indicateXWayland ? true : false