From 3019dd58d73b8c198f07f32e56da25eac510253e Mon Sep 17 00:00:00 2001 From: Louis Pontoise Date: Sat, 10 Oct 2020 03:02:01 +0900 Subject: [PATCH] fix: apparition delay preference would sometimes not be respected --- src/ui/App.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ui/App.swift b/src/ui/App.swift index 9de4b549..9b56801c 100644 --- a/src/ui/App.swift +++ b/src/ui/App.swift @@ -25,6 +25,8 @@ class App: AppCenterApplication, NSApplicationDelegate { var globalShortcutsAreDisabled = false var shortcutIndex = 0 var appCenterDelegate: AppCenterCrash? + // multiple delayed display triggers should only show the ui when the last one triggers + var delayedDisplayScheduled = 0 override init() { super.init() @@ -254,8 +256,12 @@ class App: AppCenterApplication, NSApplicationDelegate { if (!Windows.list.contains { $0.shouldShowTheUser }) { hideUi(); return } Windows.updateFocusedWindowIndex(0) Windows.cycleFocusedWindowIndex(1) + delayedDisplayScheduled += 1 DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Preferences.windowDisplayDelay) { () -> () in - self.rebuildUi(screen) + if self.delayedDisplayScheduled == 1 { + self.rebuildUi(screen) + } + self.delayedDisplayScheduled -= 1 } } else { cycleSelection(.leading)