refactor: use entries directly in bar object instead of nested components + various fixes and additions to settings
C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 11s
JS/TS / lint (pull_request) Successful in 23s
Python / lint (pull_request) Successful in 30s
Python / fmt (pull_request) Successful in 32s
Python / test (pull_request) Successful in 1m1s
Python / typecheck (pull_request) Failing after 52s
C++ / build (pull_request) Successful in 1m45s
Rust / fmt (pull_request) Successful in 57s
Rust / build (pull_request) Successful in 1m50s
Rust / clippy (pull_request) Successful in 1m44s
Python / buildcheck (pull_request) Successful in 2m29s
C++ / clang-tidy (pull_request) Successful in 3m31s
C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 11s
JS/TS / lint (pull_request) Successful in 23s
Python / lint (pull_request) Successful in 30s
Python / fmt (pull_request) Successful in 32s
Python / test (pull_request) Successful in 1m1s
Python / typecheck (pull_request) Failing after 52s
C++ / build (pull_request) Successful in 1m45s
Rust / fmt (pull_request) Successful in 57s
Rust / build (pull_request) Successful in 1m50s
Rust / clippy (pull_request) Successful in 1m44s
Python / buildcheck (pull_request) Successful in 2m29s
C++ / clang-tidy (pull_request) Successful in 3m31s
This commit is contained in:
+68
-67
@@ -12,17 +12,18 @@ import qs.Modules.Updates
|
||||
RowLayout {
|
||||
id: root
|
||||
|
||||
required property bool fullscreen
|
||||
required property Wrapper popouts
|
||||
required property ClipWrapper popoutsWrapper
|
||||
required property ShellScreen screen
|
||||
required property bool fullscreen
|
||||
readonly property int vPadding: 6
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
function checkPopout(x: real): void {
|
||||
const ch = childAt(x, height / 2) as WrappedLoader;
|
||||
const ch = childAt(x, height / 2) as EntryWrapper;
|
||||
const id = ch?.entryId;
|
||||
|
||||
if (!ch || ch?.id === "spacer") {
|
||||
if (!ch || id === undefined) {
|
||||
if (!popouts.currentName.startsWith("traymenu") || Config.bar.tray.showOnHover)
|
||||
popouts.hasCurrent = false;
|
||||
return;
|
||||
@@ -31,32 +32,38 @@ RowLayout {
|
||||
if (visibilities.sidebar || visibilities.dashboard || visibilities.resources || visibilities.settings)
|
||||
return;
|
||||
|
||||
if (ch.id === "tray") {
|
||||
const tray = ch.item;
|
||||
const localPos = tray.mapFromItem(root, x, height / 2);
|
||||
const sub = tray.getHoveredSubItem(localPos.x, localPos.y);
|
||||
if (sub) {
|
||||
popouts.currentName = sub.id;
|
||||
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 centerX = sub.item.mapToItem(root, sub.item.width / 2, 0).x;
|
||||
return centerX;
|
||||
const it = tray.items.itemAt(idx);
|
||||
return it ? it.mapToItem(root, it.implicitWidth / 2, 0).x : popouts.currentCenter;
|
||||
});
|
||||
popouts.hasCurrent = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!popouts.currentName.startsWith("traymenu") || Config.bar.tray.showOnHover)
|
||||
if (!popouts.currentName.startsWith("traymenu"))
|
||||
popouts.hasCurrent = false;
|
||||
}
|
||||
|
||||
const id = ch.id;
|
||||
const top = ch.x;
|
||||
const item = ch.item;
|
||||
const itemWidth = item.implicitWidth;
|
||||
|
||||
if (id === "updates") {
|
||||
popouts.currentName = "updates";
|
||||
popouts.currentCenter = Qt.binding(() => item.mapToItem(root, itemWidth / 2, 0).x);
|
||||
popouts.currentCenter = Qt.binding(() => ch.item.mapToItem(root, (ch.item as Item).implicitWidth / 2, 0).x);
|
||||
popouts.hasCurrent = true;
|
||||
}
|
||||
}
|
||||
@@ -66,7 +73,9 @@ RowLayout {
|
||||
Repeater {
|
||||
id: repeater
|
||||
|
||||
model: Config.bar.entries
|
||||
model: ScriptModel {
|
||||
values: Config.bar.entries.filter(e => e.enabled)
|
||||
}
|
||||
|
||||
DelegateChooser {
|
||||
role: "id"
|
||||
@@ -74,8 +83,8 @@ RowLayout {
|
||||
DelegateChoice {
|
||||
roleValue: "hyprsunset"
|
||||
|
||||
delegate: WrappedLoader {
|
||||
sourceComponent: HyprsunsetWidget {
|
||||
delegate: EntryWrapper {
|
||||
HyprsunsetWidget {
|
||||
visible: !root.fullscreen
|
||||
}
|
||||
}
|
||||
@@ -84,7 +93,7 @@ RowLayout {
|
||||
DelegateChoice {
|
||||
roleValue: "spacer"
|
||||
|
||||
delegate: WrappedLoader {
|
||||
delegate: EntryWrapper {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
@@ -92,8 +101,8 @@ RowLayout {
|
||||
DelegateChoice {
|
||||
roleValue: "workspaces"
|
||||
|
||||
delegate: WrappedLoader {
|
||||
sourceComponent: Workspaces {
|
||||
delegate: EntryWrapper {
|
||||
Workspaces {
|
||||
screen: root.screen
|
||||
visible: !root.fullscreen
|
||||
}
|
||||
@@ -103,8 +112,8 @@ RowLayout {
|
||||
DelegateChoice {
|
||||
roleValue: "tray"
|
||||
|
||||
delegate: WrappedLoader {
|
||||
sourceComponent: TrayWidget {
|
||||
delegate: EntryWrapper {
|
||||
TrayIcons {
|
||||
loader: root
|
||||
popouts: root.popouts
|
||||
visible: !root.fullscreen
|
||||
@@ -112,11 +121,20 @@ RowLayout {
|
||||
}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "statusIcons"
|
||||
|
||||
delegate: EntryWrapper {
|
||||
StatusIcons {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DelegateChoice {
|
||||
roleValue: "resources"
|
||||
|
||||
delegate: WrappedLoader {
|
||||
sourceComponent: Resources {
|
||||
delegate: EntryWrapper {
|
||||
Resources {
|
||||
visibilities: root.visibilities
|
||||
visible: !root.fullscreen
|
||||
}
|
||||
@@ -126,8 +144,8 @@ RowLayout {
|
||||
DelegateChoice {
|
||||
roleValue: "updates"
|
||||
|
||||
delegate: WrappedLoader {
|
||||
sourceComponent: UpdatesWidget {
|
||||
delegate: EntryWrapper {
|
||||
UpdatesWidget {
|
||||
visible: !root.fullscreen
|
||||
}
|
||||
}
|
||||
@@ -136,8 +154,8 @@ RowLayout {
|
||||
DelegateChoice {
|
||||
roleValue: "notifBell"
|
||||
|
||||
delegate: WrappedLoader {
|
||||
sourceComponent: NotifBell {
|
||||
delegate: EntryWrapper {
|
||||
NotifBell {
|
||||
popouts: root.popouts
|
||||
visibilities: root.visibilities
|
||||
visible: !root.fullscreen
|
||||
@@ -148,8 +166,8 @@ RowLayout {
|
||||
DelegateChoice {
|
||||
roleValue: "clock"
|
||||
|
||||
delegate: WrappedLoader {
|
||||
sourceComponent: Clock {
|
||||
delegate: EntryWrapper {
|
||||
Clock {
|
||||
loader: root
|
||||
popouts: root.popouts
|
||||
visibilities: root.visibilities
|
||||
@@ -161,8 +179,8 @@ RowLayout {
|
||||
DelegateChoice {
|
||||
roleValue: "activeWindow"
|
||||
|
||||
delegate: WrappedLoader {
|
||||
sourceComponent: WindowTitle {
|
||||
delegate: EntryWrapper {
|
||||
WindowTitle {
|
||||
bar: root
|
||||
visible: !root.fullscreen
|
||||
}
|
||||
@@ -172,8 +190,8 @@ RowLayout {
|
||||
DelegateChoice {
|
||||
roleValue: "network"
|
||||
|
||||
delegate: WrappedLoader {
|
||||
sourceComponent: NetworkWidget {
|
||||
delegate: EntryWrapper {
|
||||
NetworkWidget {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,8 +199,8 @@ RowLayout {
|
||||
DelegateChoice {
|
||||
roleValue: "media"
|
||||
|
||||
delegate: WrappedLoader {
|
||||
sourceComponent: MediaWidget {
|
||||
delegate: EntryWrapper {
|
||||
MediaWidget {
|
||||
visible: !root.fullscreen
|
||||
}
|
||||
}
|
||||
@@ -190,34 +208,17 @@ RowLayout {
|
||||
}
|
||||
}
|
||||
|
||||
component WrappedLoader: Loader {
|
||||
required property bool enabled
|
||||
required property string id
|
||||
component EntryWrapper: Item {
|
||||
readonly property string entryId: modelData.id
|
||||
required property int index
|
||||
|
||||
function findFirstEnabled(): Item {
|
||||
const count = repeater.count;
|
||||
for (let i = 0; i < count; i++) {
|
||||
const item = repeater.itemAt(i);
|
||||
if (item?.enabled)
|
||||
return item;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function findLastEnabled(): Item {
|
||||
for (let i = repeater.count - 1; i >= 0; i--) {
|
||||
const item = repeater.itemAt(i);
|
||||
if (item?.enabled)
|
||||
return item;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
default property Item item
|
||||
required property var modelData
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.leftMargin: findFirstEnabled() === this ? root.vPadding : 0
|
||||
Layout.rightMargin: findLastEnabled() === this ? root.vPadding : 0
|
||||
active: enabled
|
||||
visible: enabled
|
||||
Layout.leftMargin: index === 0 ? root.vPadding : (entryId === "statusIcons") ? -root.spacing + Appearance.spacing.extraSmall : 0
|
||||
Layout.rightMargin: index === repeater.count - 1 ? root.vPadding : 0
|
||||
children: item
|
||||
implicitHeight: item?.implicitHeight ?? 0
|
||||
implicitWidth: item?.implicitWidth ?? 0
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user