Preview task-group selections until Meta is released
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.plasma.core as PlasmaCore
|
||||
import org.kde.plasma.components as PlasmaComponents
|
||||
import org.kde.taskmanager as TaskManager
|
||||
import org.kde.pipewire as PipeWire
|
||||
|
||||
PlasmaCore.Dialog {
|
||||
id: root
|
||||
|
||||
property string windowId: ""
|
||||
property string windowTitle: ""
|
||||
property int position: 0
|
||||
property int count: 0
|
||||
|
||||
visible: false
|
||||
type: PlasmaCore.Dialog.Tooltip
|
||||
// A Qt tooltip needs a parent surface; this standalone helper has none.
|
||||
// Plasma's tooltip role still keeps it out of the taskbar and focus history.
|
||||
flags: Qt.Tool | Qt.FramelessWindowHint | Qt.WindowDoesNotAcceptFocus | Qt.WindowTransparentForInput
|
||||
hideOnWindowDeactivate: false
|
||||
|
||||
mainItem: ColumnLayout {
|
||||
width: Kirigami.Units.gridUnit * 18
|
||||
height: implicitHeight
|
||||
spacing: Kirigami.Units.smallSpacing
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: width * 9 / 16
|
||||
|
||||
Loader {
|
||||
id: thumbnail
|
||||
anchors.fill: parent
|
||||
active: root.visible && root.windowId !== ""
|
||||
sourceComponent: PipeWire.PipeWireSourceItem {
|
||||
nodeId: request.nodeId
|
||||
objectSerial: request.objectSerial
|
||||
|
||||
TaskManager.ScreencastingRequest {
|
||||
id: request
|
||||
uuid: root.windowId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
anchors.centerIn: parent
|
||||
visible: !thumbnail.item || !thumbnail.item.ready
|
||||
text: qsTr("Window preview unavailable")
|
||||
opacity: 0.7
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
Layout.fillWidth: true
|
||||
text: root.windowTitle
|
||||
elide: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("%1 of %2 · Release Meta to switch · Esc to cancel").arg(root.position).arg(root.count)
|
||||
wrapMode: Text.WordWrap
|
||||
opacity: 0.7
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user