import QtQuick import QtQuick.Layouts // Workspaces.qml import Quickshell import Quickshell.Hyprland import Quickshell.Widgets import qs.Common import qs.Services WrapperMouseArea { id: workspacesRoot property var monitor: "black" onWheel: (wheel) => { if (wheel.angleDelta.y > 0) { if ((Hyprland.focusedWorkspace.id) % 5 === 0) return ; Hyprland.dispatch("workspace " + (Hyprland.focusedWorkspace.id + 1)); } else if (wheel.angleDelta.y < 0) { if (Hyprland.focusedWorkspace.id === 1 || Hyprland.focusedWorkspace.id === 6) return ; Hyprland.dispatch("workspace " + (Hyprland.focusedWorkspace.id - 1)); } } RowLayout { Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Repeater { model: 5 delegate: Rectangle { id: workspacesRectangle required property var modelData property var index: modelData // Get the workspace data from the model property var workspace: { workspacesRoot.monitor === "DP-2" ? Hyprland.workspaces.values[index + 5] : Hyprland.workspaces.values[index]; } Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter implicitHeight: Theme.heightGaps implicitWidth: workspace.id === Hyprland.focusedWorkspace.id ? Theme.barSize* 1.5 : Theme.barSize radius: 25 color: { if (workspace.id === Hyprland.focusedWorkspace.id) { return Theme.color6 } if (HyprlandService.topLevelWorkspaces.filter(topLevelworkspace => topLevelworkspace.id === workspace.id).length) { return Theme.backgroudColorBright } return Theme.backgroudColor } PopupWindow { id: workspacesPopUp anchor.item: workspacesRectangle anchor.rect.y: workspacesRectangle.implicitHeight+5 anchor.rect.x: -implicitWidth/2 + workspacesRectangle.implicitWidth/2 implicitWidth: wsPopUpRow.implicitWidth*1.6 implicitHeight: 35 color:"transparent" Rectangle { anchors.fill: parent color: Theme.backgroudColor radius: 25 RowLayout { anchors{ horizontalCenter:parent.horizontalCenter verticalCenter:parent.verticalCenter } id: wsPopUpRow Repeater { model: HyprlandService.sortedDesktopApplications.get(workspacesRectangle.workspace.id) delegate: IconImage { required property var modelData width:30; height:30 source: (modelData && modelData.icon) ? Quickshell.iconPath(modelData.icon, 1) : "" } } } } } Timer { id: workspacesTimer interval: 300 onTriggered: { workspacesPopUp.visible = true } } Text { anchors.centerIn: parent text: workspacesRoot.monitor === "DP-2" ? workspacesRectangle.workspace.id - 5 : workspacesRectangle.workspace.id font.bold: true font.pixelSize: 14 font.family: Theme.fontFamily color: Theme.textColor } MouseArea { hoverEnabled: true onEntered: { if (HyprlandService.sortedDesktopApplications.get(workspacesRectangle.workspace.id)){ workspacesTimer.start() } } onExited: { workspacesTimer.stop() workspacesPopUp.visible = false } anchors.fill: parent onClicked: { if(workspacesRectangle.workspace.id === Hyprland.focusedWorkspace.id) {return} ; Hyprland.dispatch("workspace " + workspacesRectangle.workspace.id); } } Behavior on implicitWidth { NumberAnimation { duration: 100 } } } } } }