Close windows from the workspace hover preview
Hovering a window tile shows a close button; middle-click closes it too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d37f9b7121
commit
f96d16df87
1 file changed
+52
-3
@@ -98,6 +98,12 @@ Column {
|
|||||||
font.pixelSize: root.frameHeight * 0.38
|
font.pixelSize: root.frameHeight * 0.38
|
||||||
font.weight: Font.DemiBold
|
font.weight: Font.DemiBold
|
||||||
}
|
}
|
||||||
|
// Below the tiles, so their close buttons take clicks first.
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: root.chosen()
|
||||||
|
}
|
||||||
// Keyed by address so title changes keep each live capture.
|
// Keyed by address so title changes keep each live capture.
|
||||||
Repeater {
|
Repeater {
|
||||||
model: ScriptModel {
|
model: ScriptModel {
|
||||||
@@ -155,12 +161,55 @@ Column {
|
|||||||
HoverHandler {
|
HoverHandler {
|
||||||
id: tileHover
|
id: tileHover
|
||||||
}
|
}
|
||||||
|
// Middle-click closes, as in the bar's window list.
|
||||||
|
TapHandler {
|
||||||
|
acceptedButtons: Qt.MiddleButton
|
||||||
|
onTapped: HyprlandService.closeWindow(tile.win.address)
|
||||||
|
}
|
||||||
|
// Close without visiting the workspace; shown on hover.
|
||||||
|
Rectangle {
|
||||||
|
objectName: "workspacePreviewClose"
|
||||||
|
readonly property real size: Math.min(20, Math.min(tile.width, tile.height) - 8)
|
||||||
|
visible: size >= 12
|
||||||
|
opacity: tileHover.hovered ? 1 : 0
|
||||||
|
enabled: tileHover.hovered
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.margins: 4
|
||||||
|
width: size
|
||||||
|
height: size
|
||||||
|
radius: size / 2
|
||||||
|
color: closeHover.hovered ? Qt.alpha("#ff5f57", 0.85) : Qt.alpha(Theme.surface, 0.85)
|
||||||
|
border.width: 1
|
||||||
|
border.color: Theme.hairline
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.duration / 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MouseArea {
|
Behavior on color {
|
||||||
anchors.fill: parent
|
ColorAnimation {
|
||||||
|
duration: Theme.duration / 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: Icons.available ? "" : "×"
|
||||||
|
font.family: Icons.available ? Icons.family : ""
|
||||||
|
font.pixelSize: Math.round(parent.size * 0.6)
|
||||||
|
color: Theme.text
|
||||||
|
}
|
||||||
|
HoverHandler {
|
||||||
|
id: closeHover
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: root.chosen()
|
}
|
||||||
|
TapHandler {
|
||||||
|
onTapped: HyprlandService.closeWindow(tile.win.address)
|
||||||
|
}
|
||||||
|
Accessible.role: Accessible.Button
|
||||||
|
Accessible.name: "Close " + (tile.win.title || tile.win.appId || "window")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user