Skip to content

Commit

Permalink
fix: apparition delay preference would sometimes not be respected
Browse files Browse the repository at this point in the history
  • Loading branch information
lwouis committed Oct 10, 2020
1 parent c1a0b05 commit 3019dd5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/ui/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3019dd5

Please sign in to comment.