From 9b8ff3181aba03386174722e9d2e87e8171ce1f7 Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Fri, 31 Oct 2025 13:21:00 +0100 Subject: [PATCH] Refines notification timing for timed prompts Adjusts notification display duration calculation for more predictable behavior Improves timing logic for prompts with different delay intervals: - Ensures notifications end 500ms before next tick for delays >1s - Maintains minimum 300ms display time to prevent flickering - Keeps existing logic for short delay intervals --- commands/timedPrompts.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/timedPrompts.ts b/commands/timedPrompts.ts index c7593dc..d7135bc 100644 --- a/commands/timedPrompts.ts +++ b/commands/timedPrompts.ts @@ -177,11 +177,12 @@ export class TimedPromptsCommand { const totalPrompts = this.promptQueue.length; // Calculate notification duration: slightly less than delay to avoid overlap - // For very short delays (<=1s), use 900ms or delay-100ms (whichever is smaller) + // For delays >1s, end 500ms before next tick + // For delays <=1s, use 900ms or delay-100ms (whichever is smaller) // Clamp to minimum 300ms to prevent flicker/invisible notices const delayMs = Math.max(0, delaySeconds * 1000); const notificationDuration = - delayMs > 1000 ? (delayMs - 500) : Math.max(300, Math.min(900, delayMs - 100)); + delayMs >= 1000 ? (delayMs - 500) : Math.max(300, Math.min(900, delayMs - 100)); const notice = new Notice( `Writing Prompt ${promptNumber}/${totalPrompts}:\n\n${prompt}`,