diff --git a/src/ui/App.swift b/src/ui/App.swift index 7feb6c54..bf751c18 100644 --- a/src/ui/App.swift +++ b/src/ui/App.swift @@ -36,7 +36,7 @@ class App: NSApplication, NSApplicationDelegate { Preferences.registerDefaults() statusItem = Menubar.make(self) loadMainMenuXib() - initPreferencesDependentComponents() + thumbnailsPanel = ThumbnailsPanel() Spaces.initialDiscovery() Applications.initialDiscovery() Keyboard.listenToGlobalEvents(self) @@ -55,8 +55,9 @@ class App: NSApplication, NSApplicationDelegate { } // we put application code here which should be executed on init() and Preferences change - func initPreferencesDependentComponents() { - thumbnailsPanel = ThumbnailsPanel(self) + func resetPreferencesDependentComponents() { + ThumbnailsView.recycledViews = ThumbnailsView.recycledViews.map { _ in ThumbnailView() } + thumbnailsPanel!.thumbnailsView.layer!.cornerRadius = Preferences.windowCornerRadius } func hideUi() { diff --git a/src/ui/main-window/ThumbnailView.swift b/src/ui/main-window/ThumbnailView.swift index d4319a44..5c3cb555 100644 --- a/src/ui/main-window/ThumbnailView.swift +++ b/src/ui/main-window/ThumbnailView.swift @@ -22,7 +22,7 @@ class ThumbnailView: NSStackView { observeDragAndDrop() } - func updateRecycledCellWithNewContent(_ element: Window, _ mouseDownCallback: @escaping MouseDownCallback, _ mouseMovedCallback: @escaping MouseMovedCallback, _ newHeight: CGFloat,_ screen: NSScreen) { + func updateRecycledCellWithNewContent(_ element: Window, _ mouseDownCallback: @escaping MouseDownCallback, _ mouseMovedCallback: @escaping MouseMovedCallback, _ newHeight: CGFloat, _ screen: NSScreen) { window_ = element // element.itemView = self if thumbnail.image != element.thumbnail { diff --git a/src/ui/preferences-window/PreferencesWindow.swift b/src/ui/preferences-window/PreferencesWindow.swift index 10292090..d8ce6fef 100644 --- a/src/ui/preferences-window/PreferencesWindow.swift +++ b/src/ui/preferences-window/PreferencesWindow.swift @@ -18,7 +18,10 @@ class PreferencesWindow: NSWindow { let newValue = LabelAndControl.getControlValue(senderControl) LabelAndControl.updateControlExtras(senderControl, newValue) Preferences.set(senderControl.identifier!.rawValue, newValue) - (App.shared as! App).initPreferencesDependentComponents() + // some preferences require re-creating some components + if ["iconSize", "fontHeight", "theme"].contains(where: { $0 == senderControl.identifier!.rawValue }) { + (App.shared as! App).resetPreferencesDependentComponents() + } } private func setupWindow() {