eythaann/Seelen-UI · error · Error
Current monitor not found
Error message
Current monitor not found
What it means
The window-manager widget resolves its target monitor via `monitors.value.find((m) => m.id === monitorId)` where `monitorId` comes from the widget's decoded `decoded.monitorId!`. If the backend monitor list has no such id, the `widgetRect` derivation throws `Current monitor not found`, preventing WM window-rect calculations.
Source
Thrown at src/ui/svelte/window-manager/state.svelte.ts:81
sheet.addVariable("--config-margin-left", `${settings.workspaceMargin.left}px`);
sheet.addVariable("--config-margin-right", `${settings.workspaceMargin.right}px`);
sheet.addVariable("--config-margin-bottom", `${settings.workspaceMargin.bottom}px`);
sheet.addVariable("--config-border-offset", `${settings.border.offset}px`);
sheet.addVariable("--config-border-width", `${settings.border.width}px`);
sheet.applyToDocument();
});
});
// =================================================
// Positioning
// =================================================
const monitorId = Widget.getCurrent().decoded.monitorId!;
const widgetRect = $derived.by(() => {
const monitor = monitors.value.find((m) => m.id === monitorId);
if (!monitor) {
throw new Error("Current monitor not found");
}
const rect = { ...monitor.rect };
const tbConfig = fullSettings.byWidget["@seelen/fancy-toolbar"];
const tbMonitorConfig = (fullSettings.monitorsV3[monitor.id] as any)?.byWidget?.[
"@seelen/fancy-toolbar"
] ?? {
enabled: true,
};
if (
tbConfig.enabled &&
tbMonitorConfig.enabled &&
(tbConfig.hideMode === HideMode.Never || isTouchPrimary.value)
) {
const tbSize = Math.round(
(tbConfig.itemSize + tbConfig.padding * 2 + tbConfig.margin * 2) * monitor.scaleFactor,
);View on GitHub (pinned to dee4aaa940)
Solutions
- Guard the derivation: return a default rect or skip rendering when the monitor is missing.
- Re-request the current monitor id on `MonitorsChanged` instead of trusting the stale `decoded.monitorId!`.
- Verify the widget creation flow passes a valid, current monitor id into the widget URL.
Example fix
// before
const monitor = monitors.value.find((m) => m.id === monitorId);
if (!monitor) throw new Error("Current monitor not found");
// after
const monitor = monitors.value.find((m) => m.id === monitorId);
if (!monitor) return null; // or fallback rect
Defensive patterns
Strategy: validation
Validate before calling
const monitorId = Widget.getCurrent().decoded.monitorId;
if (!monitorId || !monitors.value.some((m) => m.id === monitorId)) {
// skip rendering or re-request the monitor before using widgetRect
} Type guard
function hasValidMonitor(id: string | undefined): id is string {
return !!id && monitors.value.some((m) => m.id === id);
} Try / catch
try {
const rect = widgetRect.value;
} catch (e) {
if ((e as Error).message === "Current monitor not found") {
// re-fetch monitor list, then retry once
} else throw e;
} Prevention
- Don't trust stale `decoded.monitorId!`; re-resolve on monitor changes.
- Wait for the monitors signal to load before first derivation.
- Validate the widget URL's monitorId at widget creation time.
When it happens
Trigger: The widget was created for a monitor id that no longer exists in `monitors.value` (display unplugged between widget creation and render); `decoded.monitorId` is stale in the widget URL/definition; monitors signal not yet loaded at first derivation.
Common situations: Monitor hot-plug while a WM toolbar widget is attached; stale widget definition cached with an old monitor id; race at app startup before the first monitor list event.
Related errors
- Current monitor not found
- Current monitor not found
- LazyRune was not initialized
- no key provided to $t()
- Monitor settings not initialized ${device.id}
AI-assisted analysis of eythaann/Seelen-UI@dee4aaa940 (2026-09-03).
Data as JSON: /api/errors/4d8d4ccff87394ae.
Report an issue: GitHub.