import QtQuick import Quickshell import qs.config import qs.custom import qs.services import "modules" import "popouts" as BarPopouts Item { id: root required property PersistentProperties uiState required property ShellScreen screen required property BarPopouts.Wrapper popouts anchors.left: parent.left anchors.top: parent.top anchors.right: parent.right implicitHeight: Config.bar.height // Modules NixOS { id: nixos objectName: "nixos" anchors.left: parent.left } Workspaces { id: workspaces anchors.left: nixos.right workspaces: root.uiState.workspaces } Window { id: window objectName: "window" // Expand window title from center as much as possible // without intersecting other modules anchors.centerIn: parent implicitWidth: 2 * Math.min( (parent.width / 2) - workspaces.x - workspaces.width, tray.x - (parent.width / 2)) - 40 } Tray { id: tray objectName: "tray" anchors.right: clock.left anchors.rightMargin: 8 } Clock { id: clock objectName: "clock" anchors.right: statusIcons.left anchors.rightMargin: 12 } StatusIcons { id: statusIcons objectName: "statusIcons" anchors.right: power.left anchors.rightMargin: 6 } Power { id: power uiState: root.uiState anchors.right: parent.right anchors.rightMargin: 6 } // Popout Interactions function checkPopout(x: real): void { const ch = childAt(x, height / 2); if (!ch) { popouts.hasCurrent = false; return; } const name = ch.objectName; const left = ch.x; const chWidth = ch.implicitWidth; if (name === "nixos") { popouts.currentName = "nixos"; popouts.currentCenter = 0; popouts.hasCurrent = true; } else if (name === "statusIcons") { const layout = ch.children[0]; const icon = layout.childAt(mapToItem(layout, x, 0).x, layout.height / 2); if (icon && icon.objectName) { popouts.currentName = icon.objectName; popouts.currentCenter = Qt.binding(() => icon.mapToItem(root, 0, icon.implicitWidth / 2).x); popouts.hasCurrent = true; } else if (icon && !icon.objectName) { popouts.hasCurrent = false; } } else if (name === "tray") { const index = Math.floor(((x - left) / chWidth) * tray.repeater.count); const trayItem = tray.repeater.itemAt(index); if (trayItem) { popouts.currentName = `traymenu${index}`; popouts.currentCenter = Qt.binding(() => trayItem.mapToItem(root, 0, trayItem.implicitWidth / 2).x); popouts.hasCurrent = true; } } else if (name === "clock") { popouts.currentName = "calendar"; popouts.currentCenter = ch.mapToItem(root, chWidth / 2, 0).x; popouts.hasCurrent = true; } else if (name === "window" && Hypr.activeToplevel) { const inner = ch.childAt(mapToItem(ch, x, 0).x, height / 2) if (inner) { popouts.currentName = "activewindow"; popouts.currentCenter = ch.mapToItem(root, chWidth / 2, 0).x; popouts.hasCurrent = true; } else { popouts.hasCurrent = false; } } else { popouts.hasCurrent = false; } } }