internal: fix errors due to sync loaders

This commit is contained in:
2 * r + 2 * t 2026-01-16 01:55:20 +11:00
parent 4f7f21a86d
commit 33c1c694de
9 changed files with 20 additions and 17 deletions

View file

@ -15,7 +15,7 @@ Item {
required property ShellScreen screen
required property Wallpaper wallpaper
readonly property bool shouldBeActive: Config.background.visualiser.enabled && (!Config.background.visualiser.autoHide || Hypr.monitorFor(screen).activeWorkspace.toplevels.values.every(t => t.lastIpcObject.floating))
readonly property bool shouldBeActive: Config.background.visualiser.enabled && (!Config.background.visualiser.autoHide || (Hypr.monitorFor(screen)?.activeWorkspace?.toplevels?.values.every(t => t.lastIpcObject?.floating) ?? true))
property real offset: shouldBeActive ? 0 : screen.height * 0.2
opacity: shouldBeActive ? 1 : 0

View file

@ -18,9 +18,9 @@ StyledRect {
return i % Config.bar.workspaces.shown;
}
property real leading: workspaces.itemAt(currentWsIdx)?.y ?? 0
property real trailing: workspaces.itemAt(currentWsIdx)?.y ?? 0
property real currentSize: workspaces.itemAt(currentWsIdx)?.size ?? 0
property real leading: workspaces.count > 0 ? workspaces.itemAt(currentWsIdx)?.y ?? 0 : 0
property real trailing: workspaces.count > 0 ? workspaces.itemAt(currentWsIdx)?.y ?? 0 : 0
property real currentSize: workspaces.count > 0 ? workspaces.itemAt(currentWsIdx)?.size ?? 0 : 0
property real offset: Math.min(leading, trailing)
property real size: {
const s = Math.abs(leading - trailing) + currentSize;

View file

@ -16,12 +16,15 @@ Item {
property list<var> pills: []
onOccupiedChanged: {
if (!occupied) return;
let count = 0;
const start = groupOffset;
const end = start + Config.bar.workspaces.shown;
for (const [ws, occ] of Object.entries(occupied)) {
if (ws > start && ws <= end && occ) {
if (!occupied[ws - 1]) {
const isFirstInGroup = Number(ws) === start + 1;
const isLastInGroup = Number(ws) === end;
if (isFirstInGroup || !occupied[ws - 1]) {
if (pills[count])
pills[count].start = ws;
else
@ -30,7 +33,7 @@ Item {
}));
count++;
}
if (!occupied[ws + 1])
if ((isLastInGroup || !occupied[ws + 1]) && pills[count - 1])
pills[count - 1].end = ws;
}
}
@ -48,8 +51,8 @@ Item {
required property var modelData
readonly property Workspace start: root.workspaces.itemAt(getWsIdx(modelData.start)) ?? null
readonly property Workspace end: root.workspaces.itemAt(getWsIdx(modelData.end)) ?? null
readonly property Workspace start: root.workspaces.count > 0 ? root.workspaces.itemAt(getWsIdx(modelData.start)) ?? null : null
readonly property Workspace end: root.workspaces.count > 0 ? root.workspaces.itemAt(getWsIdx(modelData.end)) ?? null : null
function getWsIdx(ws: int): int {
let i = ws - 1;

View file

@ -15,7 +15,7 @@ Item {
required property ShellScreen screen
readonly property HyprlandMonitor monitor: Hypr.monitorFor(screen)
readonly property string activeSpecial: (Config.bar.workspaces.perMonitorWorkspaces ? monitor : Hypr.focusedMonitor)?.lastIpcObject.specialWorkspace.name ?? ""
readonly property string activeSpecial: (Config.bar.workspaces.perMonitorWorkspaces ? monitor : Hypr.focusedMonitor)?.lastIpcObject?.specialWorkspace?.name ?? ""
layer.enabled: true
layer.effect: OpacityMask {

View file

@ -13,7 +13,7 @@ StyledClippingRect {
required property ShellScreen screen
readonly property bool onSpecial: (Config.bar.workspaces.perMonitorWorkspaces ? Hypr.monitorFor(screen) : Hypr.focusedMonitor)?.lastIpcObject.specialWorkspace.name !== ""
readonly property bool onSpecial: (Config.bar.workspaces.perMonitorWorkspaces ? Hypr.monitorFor(screen) : Hypr.focusedMonitor)?.lastIpcObject?.specialWorkspace?.name !== ""
readonly property int activeWsId: Config.bar.workspaces.perMonitorWorkspaces ? (Hypr.monitorFor(screen).activeWorkspace?.id ?? 1) : Hypr.activeWsId
readonly property var occupied: Hypr.workspaces.values.reduce((acc, curr) => {

View file

@ -35,8 +35,8 @@ Item {
if (mode === "winfo") {
detachedMode = mode;
} else {
detachedMode = "any";
queuedMode = mode;
detachedMode = "any";
}
focus = true;
}

View file

@ -108,7 +108,7 @@ ClippingRectangle {
const diff = Math.abs(root.session.activeIndex - pane.paneIndex);
const isActivePane = diff === 0;
let shouldBeActive = false;
if (!layout.initialOpeningComplete) {
shouldBeActive = isActivePane;
} else {
@ -120,7 +120,7 @@ ClippingRectangle {
shouldBeActive = layout.animationComplete;
}
}
loader.active = shouldBeActive;
}
@ -132,7 +132,7 @@ ClippingRectangle {
active: false
Component.onCompleted: {
pane.updateActive();
Qt.callLater(pane.updateActive);
}
onActiveChanged: {

View file

@ -16,6 +16,6 @@ QtObject {
readonly property EthernetState ethernet: EthernetState {}
readonly property LauncherState launcher: LauncherState {}
onActiveChanged: activeIndex = panes.indexOf(active)
onActiveIndexChanged: active = panes[activeIndex]
onActiveChanged: activeIndex = Math.max(0, panes.indexOf(active))
onActiveIndexChanged: if (panes[activeIndex]) active = panes[activeIndex]
}

View file

@ -47,7 +47,7 @@ Variants {
return 0;
const mon = Hypr.monitorFor(screen);
if (mon?.lastIpcObject.specialWorkspace.name || mon?.activeWorkspace?.lastIpcObject.windows > 0)
if (mon?.lastIpcObject?.specialWorkspace?.name || mon?.activeWorkspace?.lastIpcObject?.windows > 0)
return 0;
const thresholds = [];