Merge pull request #584 from incanus/246-dock-unread-pref

add hidden pref for show/hide dock unread count
This commit is contained in:
Brent Simmons 2019-03-12 10:40:56 -07:00 committed by GitHub
commit 976d52ad49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -58,6 +58,7 @@ struct AppDefaults {
// Hidden prefs
static let showTitleOnMainWindow = "KafasisTitleMode"
static let hideDockUnreadCount = "Issue246HideDockUnreadCount"
}
private static let smallestFontSizeRawValue = FontSize.small.rawValue
@ -111,6 +112,10 @@ struct AppDefaults {
return bool(for: Key.showTitleOnMainWindow)
}
static var hideDockUnreadCount: Bool {
return bool(for: Key.hideDockUnreadCount)
}
static var timelineSortDirection: ComparisonResult {
get {
return sortDirection(for: Key.timelineSortDirection)

View File

@ -347,7 +347,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
// MARK: - Dock Badge
@objc func updateDockBadge() {
let label = unreadCount > 0 ? "\(unreadCount)" : ""
let label = unreadCount > 0 && !AppDefaults.hideDockUnreadCount ? "\(unreadCount)" : ""
NSApplication.shared.dockTile.badgeLabel = label
}