Files
Quickbar/Widgets/WindowSwitcher.qml

123 lines
3.1 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import Quickshell
import Quickshell.Widgets
import qs.Services
import qs.Common.Styled
import qs.Common
import Quickshell.Wayland
PanelWindow {
id: root
anchors {
left: true
bottom: true
right: true
top: true
}
implicitWidth: screen.width
// implicitWidth: 400
implicitHeight: screen.height
color: "transparent"
visible: true
signal clear
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
MouseArea {
anchors.fill: parent
onClicked: root.clear()
}
Rectangle {
id: notifWindow
anchors.centerIn:parent
implicitHeight: 300
implicitWidth: listview.contentWidth
color: "transparent"
ListView {
id: listview
anchors.fill: parent
clip: true
spacing: 5
orientation: ListView.Horizontal
focus:true
highlight: Rectangle { color: "black"; radius: 5 }
highlightFollowsCurrentItem: true
keyNavigationEnabled: false
Keys.onPressed: (event) => {
switch (event.key) {
case Qt.Key_L: // move down
case Qt.Key_D:
if (currentIndex < count - 1)
currentIndex++
event.accepted = true
break
case Qt.Key_H: // move up
case Qt.Key_A:
if (currentIndex > 0)
currentIndex--
event.accepted = true
break
case Qt.Key_Return:
currentItem.activate()
event.accepted = true
break
case Qt.Key_Escape:
root.clear()
break
}
}
model: HyprlandService.sortedDesktopApplicationsModel
delegate: Rectangle {
required property var modelData
implicitHeight: 300
implicitWidth: 300
color: "transparent"
function activate() {
modelData.topLevel.wayland.activate()
root.clear()
}
MouseArea {
anchors.fill: parent
onClicked: activate()
}
ScreencopyView {
anchors.fill: parent
live: true
captureSource: modelData.topLevel.wayland
}
IconImage {
anchors.bottom: parent.bottom
property int workspaceId: modelData.topLevel.workspace.id
property var desktopEntry: modelData.desktopEntry
width: 30
height: 30
source: (modelData && desktopEntry.icon) ? Quickshell.iconPath(desktopEntry.icon, 1) : "aaa"
}
}
}
}
}