Skip to content

Commit

Permalink
Set appearance in main queue
Browse files Browse the repository at this point in the history
  • Loading branch information
gao-sun committed Mar 23, 2021
1 parent 44706d3 commit 217bd72
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions eul/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
self.checkUpdateRepeatedly()
}
}
appearanceCancellable = preferenceStore.$appearanceMode.sink {
self.window.appearance = $0.nsAppearance
appearanceCancellable = preferenceStore.$appearanceMode.sink { mode in
DispatchQueue.main.async {
self.window.appearance = mode.nsAppearance
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion eul/StatusBar/StatusBarManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class StatusBarManager {
self.refresh()
}
appearanceModeCancellable = preferenceStore.$appearanceMode.sink { value in
self.item.setAppearance(value.nsAppearance)
DispatchQueue.main.async {
self.item.setAppearance(value.nsAppearance)
}
}
}

Expand Down

0 comments on commit 217bd72

Please sign in to comment.