From ea14071d229ae674202088f3542d3fe319184308 Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Fri, 24 Oct 2025 16:51:35 +0200 Subject: [PATCH] Improves notification duration calculation for timed prompts Refines notification display timing logic to prevent flickering and ensure smoother user experience Adjusts notification duration calculation for short delays, using a more nuanced approach that: - Caps notification time at 900ms or delay-100ms for very short intervals - Maintains existing behavior for longer delays --- commands/timedPrompts.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/timedPrompts.ts b/commands/timedPrompts.ts index b807a0f..849f1d8 100644 --- a/commands/timedPrompts.ts +++ b/commands/timedPrompts.ts @@ -177,9 +177,10 @@ export class TimedPromptsCommand { const totalPrompts = this.promptQueue.length; // Calculate notification duration: slightly less than delay to avoid overlap - // For very short delays (<=1s), cap at 500ms; otherwise end 500ms before next tick + // For very short delays (<=1s), use 900ms or delay-100ms (whichever is smaller) + // to prevent flicker; otherwise end 500ms before next tick const delayMs = delaySeconds * 1000; - const notificationDuration = delayMs > 1000 ? (delayMs - 500) : 500; + const notificationDuration = delayMs > 1000 ? (delayMs - 500) : Math.min(900, delayMs - 100); const notice = new Notice( `Writing Prompt ${promptNumber}/${totalPrompts}:\n\n${prompt}`,