Add themes selector

This commit is contained in:
2026-03-08 15:03:42 +11:00
parent a6c8218bab
commit 9d05bc586a
9 changed files with 179 additions and 8 deletions

View File

@@ -19,6 +19,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
observeDisplayPreference()
observeSizePreferences()
observeFontSizeChanges()
observeTerminalThemeChanges()
}
func applicationWillTerminate(_ notification: Notification) {
@@ -58,6 +59,16 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
.store(in: &cancellables)
}
/// Live-update terminal colors across all sessions.
private func observeTerminalThemeChanges() {
UserDefaults.standard.publisher(for: \.terminalTheme)
.removeDuplicates()
.sink { newTheme in
TerminalManager.shared.updateAllThemes(TerminalTheme.resolve(newTheme))
}
.store(in: &cancellables)
}
}
// MARK: - KVO key paths
@@ -67,6 +78,10 @@ private extension UserDefaults {
double(forKey: NotchSettings.Keys.terminalFontSize)
}
@objc var terminalTheme: String {
string(forKey: NotchSettings.Keys.terminalTheme) ?? NotchSettings.Defaults.terminalTheme
}
@objc var showOnAllDisplays: Bool {
bool(forKey: NotchSettings.Keys.showOnAllDisplays)
}