overview: window previews!!!

This commit is contained in:
end-4
2025-06-09 12:25:41 +02:00
parent fa2723a54d
commit db8d51b931
3 changed files with 46 additions and 6 deletions
@@ -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"
}
@@ -145,14 +145,22 @@ Item {
Repeater { // Window repeater Repeater { // Window repeater
model: ScriptModel { model: ScriptModel {
values: windowAddresses.filter((address) => { values: {
var win = windowByAddress[address] // console.log(JSON.stringify(ToplevelManager.toplevels.values.map(t => t), null, 2))
return (root.workspaceGroup * root.workspacesShown < win?.workspace?.id && win?.workspace?.id <= (root.workspaceGroup + 1) * root.workspacesShown) 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 { delegate: OverviewWindow {
required property var modelData
property var address: `0x${modelData.HyprlandToplevel.address}`
id: window id: window
windowData: windowByAddress[modelData] windowData: windowByAddress[address]
toplevel: modelData
monitorData: root.monitorData monitorData: root.monitorData
scale: root.scale scale: root.scale
availableWorkspaceWidth: root.workspaceImplicitWidth availableWorkspaceWidth: root.workspaceImplicitWidth
@@ -1,17 +1,21 @@
import "root:/"
import "root:/services/" import "root:/services/"
import "root:/modules/common" import "root:/modules/common"
import "root:/modules/common/widgets" import "root:/modules/common/widgets"
import "root:/modules/common/functions/color_utils.js" as ColorUtils import "root:/modules/common/functions/color_utils.js" as ColorUtils
import Qt5Compat.GraphicalEffects import Qt5Compat.GraphicalEffects
import QtQuick import QtQuick
import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Widgets import Quickshell.Widgets
import Quickshell.Io import Quickshell.Io
import Quickshell.Wayland
import Quickshell.Hyprland import Quickshell.Hyprland
Rectangle { // Window Rectangle { // Window
id: root id: root
property var toplevel
property var windowData property var windowData
property var monitorData property var monitorData
property var scale property var scale
@@ -60,6 +64,12 @@ Rectangle { // Window
animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this) animation: Appearance.animation.elementMoveEnter.numberAnimation.createObject(this)
} }
ScreencopyView {
anchors.fill: parent
captureSource: GlobalStates.overviewOpen ? root.toplevel : null
live: false
}
ColumnLayout { ColumnLayout {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
@@ -77,12 +87,19 @@ Rectangle { // Window
} }
} }
StyledText { StyledLabel {
Layout.leftMargin: 10 Layout.leftMargin: 10
Layout.rightMargin: 10 Layout.rightMargin: 10
visible: !compactMode visible: !compactMode
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
background: Rectangle {
width: parent.width
color: Appearance.colors.colLayer2
radius: Appearance.rounding.windowRounding * root.scale
}
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
font.pixelSize: Appearance.font.pixelSize.smaller font.pixelSize: Appearance.font.pixelSize.smaller
font.italic: indicateXWayland ? true : false font.italic: indicateXWayland ? true : false