pragma ComponentBehavior: Bound import QtQuick import QtQuick.Layouts // Workspaces.qml import Quickshell import Quickshell.Hyprland import Quickshell.Widgets import qs.Common import qs.Services WrapperMouseArea { id: workspacesWidget 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 { property var monitor: workspacesWidget.monitor Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Repeater { id:workspacesRepeater property var monitor: parent.monitor model: 5 delegate: Rectangle { id: workspacesRectangle property string type: "workspace" required property var modelData property var index: modelData // Get the workspace data from the model property int workspaceIndex: parent.monitor === "DP-2" ? modelData + 5 : modelData property int workspaceIndexAlign: workspaceIndex+1 property var workspace: Hyprland.workspaces.values.length > workspaceIndex ? Hyprland.workspaces.values[workspaceIndex] : null property bool workspaceActive: workspace === Hyprland.focusedWorkspace? true:false property var topLevels: HyprlandService.topLevelWorkspaces property var hasTopLevel: topLevels.filter(topLevelworkspace => topLevelworkspace.id === workspaceIndexAlign).length ? true:false Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter implicitHeight: Theme.heightGaps radius: 25 states: [ State { name: "Active" when: workspacesRectangle.workspaceActive PropertyChanges { workspacesRectangle{ color: Theme.color6; implicitWidth: Theme.barSize*1.5}} }, State { name: "Filled" when: !workspacesRectangle.workspaceActive && workspacesRectangle.hasTopLevel PropertyChanges { workspacesRectangle{ color: Theme.backgroudColorBright; implicitWidth: Theme.barSize}} }, State { name: "Empty" when: !workspacesRectangle.workspaceActive && !workspacesRectangle.hasTopLevel PropertyChanges { workspacesRectangle{ color: Theme.backgroudColor;implicitWidth: Theme.barSize}} } ] Behavior on color { ColorAnimation { duration: Theme.animationDuration } } Behavior on implicitWidth { NumberAnimation { duration: Theme.animationDuration } } Text { property int workspaceName: workspacesRectangle.workspaceIndexAlign > 5? workspacesRectangle.workspaceIndexAlign -5: workspacesRectangle.workspaceIndexAlign anchors.centerIn: parent text: workspaceName font.bold: true font.pixelSize: Theme.pixelSize font.family: Theme.fontFamily color: Theme.textColor } MouseArea { anchors.fill: parent hoverEnabled: true onEntered: { if (parent.hasTopLevel) { PopUpHover.start(workspacesRectangle, "workspace") } } onExited: { PopUpHover.exit() } onClicked: { if(workspacesRectangle.workspace.id === Hyprland.focusedWorkspace.id) {return} ; Hyprland.dispatch("workspace " + workspacesRectangle.workspace.id); } } } } } }