import QtQuick import Quickshell import Quickshell.Hyprland import "../../../config" import "../states/Apps" Row { id: workspacesRow required property HyprlandMonitor thisMonitor spacing: Config.spacing_fun(bar.height) Repeater { model: Hyprland.workspaces Loader { active: modelData.monitor === thisMonitor sourceComponent: Rectangle { id: wsRect property var workspaceData: modelData width: { var cw = wsNum.width if (wsIconsRow.children.length > 0) cw += Config.spacing_fun(bar.height) + wsIconsRow.width Math.max(cw + Config.spacing_fun(bar.height)*2, wsNum.height + Config.spacing_fun(bar.height)*2) } height: wsNum.height + Config.spacing_fun(wsNum.height) radius: Config.radius_fun(height) color: wsArea.containsMouse ? Colors.tertiaryContainer : workspaceData.active ? Colors.primaryContainer : Colors.secondaryContainer border.color: wsArea.containsMouse ? Colors.tertiaryContainer_fg : workspaceData.active ? Colors.primaryContainer_fg : Colors.secondaryContainer_fg border.width: Config.border_width MouseArea { id: wsArea hoverEnabled: true cursorShape: Qt.PointingHandCursor anchors.fill: parent onClicked: { console.log("[Workspaces] Switch to workspace: " + workspaceData.id) Hyprland.dispatch("workspace " + workspaceData.id) Hyprland.dispatch("hl.dsp.focus({ workspace = "+workspaceData.id+" })") } Row { anchors.centerIn: parent spacing: Config.spacing_fun(parent.height) Text { id: wsNum text: workspaceData.id anchors.verticalCenter: parent.verticalCenter color: wsArea.containsMouse ? Colors.tertiary : workspaceData.active ? Colors.primary : Colors.secondary font.pixelSize: Config.iconSize(bar.height) font.family: Config.font font.bold: true } Row { id: wsIconsRow spacing: Config.spacing_fun(workspacesRow.height) anchors.verticalCenter: parent.verticalCenter Repeater { model: AppsState.iconsForWorkspace(workspaceData.id) delegate: Text { text: modelData color: wsArea.containsMouse ? Colors.tertiary : Colors.secondary font.pixelSize: Config.labelSize(bar.height) font.family: Config.font } } } } } } } } Text { visible: Hyprland.workspaces.length === 0 text: "No Workspaces" color: Colors.error font.pixelSize: Config.iconSize(bar.height) } }