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
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
@@ -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