Files
z-bar-qt/Modules/Bar/Bar.qml
T
zach 052e3a7800
C++ / fmt (pull_request) Successful in 9s
JS/TS / fmt (pull_request) Successful in 14s
JS/TS / lint (pull_request) Successful in 16s
Python / fmt (pull_request) Successful in 25s
Python / lint (pull_request) Successful in 26s
Python / test (pull_request) Successful in 52s
Python / typecheck (pull_request) Successful in 1m6s
Rust / fmt (pull_request) Successful in 33s
Rust / build (pull_request) Successful in 1m30s
Python / buildcheck (pull_request) Successful in 2m17s
C++ / build (pull_request) Successful in 3m49s
Rust / clippy (pull_request) Successful in 1m11s
C++ / clang-tidy (pull_request) Successful in 5m7s
Merge branch 'main' into feat/fullscreen-reveal-bar
2026-08-15 19:53:59 +02:00

226 lines
4.9 KiB
QML

pragma ComponentBehavior: Bound
import Quickshell
import QtQuick
import QtQuick.Layouts
import qs.Modules
import ZShell.Config
import qs.Modules.SysTray
import qs.Modules.Network
import qs.Modules.Updates
RowLayout {
id: root
required property bool fullscreen
required property bool isHovered
required property Wrapper popouts
required property ClipWrapper popoutsWrapper
required property ShellScreen screen
readonly property int vPadding: 6
required property PersistentProperties visibilities
function checkPopout(x: real): void {
const ch = childAt(x, height / 2) as EntryWrapper;
const id = ch?.entryId;
if (!ch || id === undefined) {
if (!popouts.currentName.startsWith("traymenu") || Config.bar.tray.showOnHover)
popouts.hasCurrent = false;
return;
}
if (visibilities.sidebar || visibilities.dashboard || visibilities.resources || visibilities.settings)
return;
if (id === "statusIcons" && Config.bar.popouts.statusIcons) {
const items = (ch.item as StatusIcons).items;
const localX = mapToItem(items, x, 0).x;
const icon = items.childAt(localX, items.height / 2);
if (icon) {
popouts.currentName = icon.name;
popouts.currentCenter = Qt.binding(() => icon.mapToItem(root, icon.implicitWidth / 2, 0).x);
popouts.hasCurrent = true;
}
} else if (id === "tray" && Config.bar.popouts.tray && Config.bar.tray.showOnHover) {
const tray = ch.item as TrayIcons;
const layout = tray.layout;
const localX = mapToItem(layout, x, 0).x;
const trayItem = layout.childAt(localX, layout.height / 2);
if (trayItem) {
const idx = trayItem.index;
popouts.currentName = `traymenu${idx}`;
popouts.currentCenter = Qt.binding(() => {
const it = tray.items.itemAt(idx);
return it ? it.mapToItem(root, it.implicitWidth / 2, 0).x : popouts.currentCenter;
});
popouts.hasCurrent = true;
}
if (!popouts.currentName.startsWith("traymenu"))
popouts.hasCurrent = false;
}
if (id === "updates") {
popouts.currentName = "updates";
popouts.currentCenter = Qt.binding(() => ch.item.mapToItem(root, (ch.item as Item).implicitWidth / 2, 0).x);
popouts.hasCurrent = true;
}
}
spacing: Tokens.spacing.small
Repeater {
id: repeater
model: ScriptModel {
values: Config.bar.entries.values.filter(e => e.enabled)
}
DelegateChooser {
role: "id"
DelegateChoice {
roleValue: "hyprsunset"
delegate: EntryWrapper {
HyprsunsetWidget {
visible: !root.fullscreen || root.isHovered
}
}
}
DelegateChoice {
roleValue: "spacer"
delegate: EntryWrapper {
Layout.fillWidth: true
}
}
DelegateChoice {
roleValue: "workspaces"
delegate: EntryWrapper {
Workspaces {
screen: root.screen
visible: !root.fullscreen || root.isHovered
}
}
}
DelegateChoice {
roleValue: "tray"
delegate: EntryWrapper {
TrayIcons {
loader: root
popouts: root.popouts
visible: !root.fullscreen || root.isHovered
}
}
}
DelegateChoice {
roleValue: "statusIcons"
delegate: EntryWrapper {
StatusIcons {
}
}
}
DelegateChoice {
roleValue: "resources"
delegate: EntryWrapper {
Resources {
visibilities: root.visibilities
visible: !root.fullscreen || root.isHovered
}
}
}
DelegateChoice {
roleValue: "updates"
delegate: EntryWrapper {
UpdatesWidget {
visible: !root.fullscreen || root.isHovered
}
}
}
DelegateChoice {
roleValue: "notifBell"
delegate: EntryWrapper {
NotifBell {
popouts: root.popouts
visibilities: root.visibilities
visible: !root.fullscreen || root.isHovered
}
}
}
DelegateChoice {
roleValue: "clock"
delegate: EntryWrapper {
Clock {
loader: root
popouts: root.popouts
visibilities: root.visibilities
visible: !root.fullscreen || root.isHovered
}
}
}
DelegateChoice {
roleValue: "activeWindow"
delegate: EntryWrapper {
WindowTitle {
bar: root
visible: !root.fullscreen || root.isHovered
}
}
}
DelegateChoice {
roleValue: "network"
delegate: EntryWrapper {
NetworkWidget {
}
}
}
DelegateChoice {
roleValue: "media"
delegate: EntryWrapper {
MediaWidget {
visible: !root.fullscreen || root.isHovered
}
}
}
}
}
component EntryWrapper: Item {
readonly property string entryId: modelData.id
required property int index
default property Item item
required property var modelData
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: index === 0 ? root.vPadding : (entryId === "statusIcons") ? -root.spacing + Tokens.spacing.extraSmall : 0
Layout.rightMargin: index === repeater.count - 1 ? root.vPadding : 0
children: item
implicitHeight: item?.implicitHeight ?? 0
implicitWidth: item?.implicitWidth ?? 0
}
}