Files
Quickbar/Widgets/WindowSwitcher.qml

148 lines
3.6 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import Quickshell
import Quickshell.Widgets
import qs.Services
import Quickshell.Wayland
import QtQuick.Effects
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.layer: WlrLayer.Overlay
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
exclusionMode: ExclusionMode.Ignore
ScreencopyView {
id: raveel
anchors.fill: parent
captureSource: screen
}
MultiEffect {
source: raveel
anchors.fill: raveel
blurEnabled: true
blurMax: 32
blur: 1.0
}
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
highlightMoveDuration: 100
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: parent.activate()
}
ScreencopyView {
anchors.fill: parent
live: true
captureSource: parent.modelData.topLevel.wayland
}
IconImage {
anchors {
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
}
property int workspaceId: parent.modelData.topLevel.workspace.id
property var desktopEntry: parent.modelData.desktopEntry ? parent.modelData.desktopEntry : null
width: 30
height: 30
source: (parent.modelData && desktopEntry.icon) ? Quickshell.iconPath(desktopEntry.icon, 1) : "aaa"
}
}
}
}
}