diff --git a/Bar/Left.qml b/Bar/Left.qml index ba4ab81..c872390 100644 --- a/Bar/Left.qml +++ b/Bar/Left.qml @@ -8,17 +8,18 @@ import "../Color.js" as Colors import "../Components/" import "../Services/" import "./Center" +import "./Left/" Container { + id: root + required property HyprlandMonitor monitor boxHeight: 25 boxWidth: 40 exclusiveMonitor: monitor - Item { - StyledText { - text: WorkspaceManager.getWorkspacesForMonitor(monitor) - } + defaultItem: WorkspaceContainer { + monitor: root.monitor } } diff --git a/Bar/Left/WorkspaceContainer.qml b/Bar/Left/WorkspaceContainer.qml new file mode 100644 index 0000000..ae5101f --- /dev/null +++ b/Bar/Left/WorkspaceContainer.qml @@ -0,0 +1,29 @@ +import QtQuick +import Quickshell +import Quickshell.Hyprland +import "../../Components/" +import "../../Services/" + +Item { + id: root + + required property HyprlandMonitor monitor + + Row { + anchors.fill: parent + + Repeater { + model: WorkspaceManager.getWorkspacesForMonitor(root.monitor) + + CenteredText { + text: console.log("some") + } + + // WorkspaceSelector { + // required property HyprlandWorkspace modelData + // + // workspace: modelData + // } + } + } +} diff --git a/Bar/Left/WorkspaceSelector.qml b/Bar/Left/WorkspaceSelector.qml new file mode 100644 index 0000000..523ad4f --- /dev/null +++ b/Bar/Left/WorkspaceSelector.qml @@ -0,0 +1,17 @@ +import QtQuick +import Quickshell +import Quickshell.Hyprland +import "../../Components/" +import "../../Services/" + +Item { + id: root + + required property HyprlandWorkspace workspace + + Rectangle { + StyledText { + text: "some" + } + } +} diff --git a/Services/WorkspaceManager.qml b/Services/WorkspaceManager.qml index 0bd91e2..93b2f8d 100644 --- a/Services/WorkspaceManager.qml +++ b/Services/WorkspaceManager.qml @@ -6,17 +6,32 @@ import Quickshell.Hyprland Singleton { id: root - function getWorkspacesForMonitor(monitor) { - let allWorkspaces = Hyprland.workspaces; - let monitorWorkspaces = []; + function getAllNumberedWorkspaces() { + let allWorkspaces = Hyprland.workspaces.values; + let filteredWorkspaces = []; for (let workspace in allWorkspaces) { let currentWorkspace = allWorkspaces[workspace]; - - if (currentWorkspace.monitor == monitor) { - console.log("correct"); - } else { - console.log("incorrect"); + if (!currentWorkspace.name.includes("special")) { + if (currentWorkspace) { + filteredWorkspaces.push(currentWorkspace); + } } } } + + function getWorkspacesForMonitor(monitor) { + let allWorkspaces = getAllNumberedWorkspaces(); + let monitorWorkspaces = []; + + for (let workspace in allWorkspaces) { + let currentWorkspace = allWorkspaces[workspace]; + if (currentWorkspace.monitor == monitor) { + console.log(currentWorkspace.id); + if (currentWorkspace) { + monitorWorkspaces.push(currentWorkspace); + } + } + } + return monitorWorkspaces; + } }