From 14e7988ae2c97e341f5a77140a993310f684d888 Mon Sep 17 00:00:00 2001 From: Gnohz Gniy <0x00eeee@gmail.com> Date: Wed, 20 Nov 2024 13:11:24 +0800 Subject: [PATCH] UI tweaks (nit-picking) --- LunarBarMac/Sources/Main/AppDelegate.swift | 4 ++-- LunarBarMac/Sources/Main/AppMainVC+Menu.swift | 4 ++-- LunarBarMac/Sources/Shared/AppDefinitions.swift | 2 +- LunarBarMac/Sources/Shared/AppIconFactory.swift | 2 +- LunarBarMac/Sources/Shared/AppPreferences.swift | 8 ++++---- LunarBarMac/Sources/Views/DateGridCell.swift | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/LunarBarMac/Sources/Main/AppDelegate.swift b/LunarBarMac/Sources/Main/AppDelegate.swift index f1d2d31..0adfe9c 100644 --- a/LunarBarMac/Sources/Main/AppDelegate.swift +++ b/LunarBarMac/Sources/Main/AppDelegate.swift @@ -21,8 +21,8 @@ class AppDelegate: NSObject, NSApplicationDelegate { private var popoverClosedTime: TimeInterval = 0 func applicationDidFinishLaunching(_ notification: Notification) { - // We rely on tooltips a lot, this changes the initial delay to 800ms to be faster - UserDefaults.standard.setValue(800, forKey: "NSInitialToolTipDelay") + // We rely on tooltips to display information, change the initial delay to 1s to be faster + UserDefaults.standard.setValue(1000, forKey: "NSInitialToolTipDelay") // Prepare public holiday data _ = HolidayManager.default diff --git a/LunarBarMac/Sources/Main/AppMainVC+Menu.swift b/LunarBarMac/Sources/Main/AppMainVC+Menu.swift index 3be83d6..dfa93c4 100644 --- a/LunarBarMac/Sources/Main/AppMainVC+Menu.swift +++ b/LunarBarMac/Sources/Main/AppMainVC+Menu.swift @@ -146,7 +146,7 @@ private extension AppMainVC { item.setOn(AppPreferences.General.menuBarIcon == .date) if let image = AppIconFactory.createDateIcon() { - item.image = image.resized(with: CGSize(width: 17, height: 12)) + item.image = image.resized(with: CGSize(width: 16.8, height: 12)) // 1.4:1 } else { Logger.assertFail("Failed to create the icon") } @@ -162,9 +162,9 @@ private extension AppMainVC { // Dark mode preferences [ - (Localized.UI.menuTitleSystem, Appearance.system), (Localized.UI.menuTitleLight, Appearance.light), (Localized.UI.menuTitleDark, Appearance.dark), + (Localized.UI.menuTitleSystem, Appearance.system), ].forEach { (title: String, appearance: Appearance) in menu.addItem(withTitle: title) { [weak self] in self?.updateAppearance(appearance) diff --git a/LunarBarMac/Sources/Shared/AppDefinitions.swift b/LunarBarMac/Sources/Shared/AppDefinitions.swift index e9954ff..1dc2630 100644 --- a/LunarBarMac/Sources/Shared/AppDefinitions.swift +++ b/LunarBarMac/Sources/Shared/AppDefinitions.swift @@ -29,9 +29,9 @@ enum Localized { static let menuTitleAppearance = String(localized: "Appearance", comment: "[Menu] Change dark mode preference") static let menuTitleCalendarIcon = String(localized: "Calendar Icon", comment: "[Menu] Use a calendar icon as the menu bar icon") static let menuTitleCurrentDate = String(localized: "Current Date", comment: "[Menu] Use the current date as the menu bar icon") - static let menuTitleSystem = String(localized: "System", comment: "[Menu] Follow the system appearance") static let menuTitleLight = String(localized: "Light", comment: "[Menu] Use the light appearance") static let menuTitleDark = String(localized: "Dark", comment: "[Menu] Use the dark appearance") + static let menuTitleSystem = String(localized: "System", comment: "[Menu] Follow the system appearance") static let menuTitleReduceMotion = String(localized: "Reduce Motion", comment: "[Menu] Disable animations when presenting the calendar popover") static let menuTitleReduceTransparency = String(localized: "Reduce Transparency", comment: "[Menu] Reduce transparency of the calendar panel") static let menuTitleFloatOnTop = String(localized: "Float on Top", comment: "[Menu] Float the popover on top") diff --git a/LunarBarMac/Sources/Shared/AppIconFactory.swift b/LunarBarMac/Sources/Shared/AppIconFactory.swift index a75fdbe..33f3dc1 100644 --- a/LunarBarMac/Sources/Shared/AppIconFactory.swift +++ b/LunarBarMac/Sources/Shared/AppIconFactory.swift @@ -22,7 +22,7 @@ enum AppIconFactory { private class DateIconView: NSView { private enum Constants { - static let iconSize = CGSize(width: 20, height: 14) + static let iconSize = CGSize(width: 21, height: 15) static let fontSize: Double = 12 static let cornerRadius: Double = 2.5 } diff --git a/LunarBarMac/Sources/Shared/AppPreferences.swift b/LunarBarMac/Sources/Shared/AppPreferences.swift index 2252cb3..96cf756 100644 --- a/LunarBarMac/Sources/Shared/AppPreferences.swift +++ b/LunarBarMac/Sources/Shared/AppPreferences.swift @@ -16,7 +16,7 @@ enum AppPreferences { @Storage(key: "general.initial-launch", defaultValue: true) static var initialLaunch: Bool - @Storage(key: "general.menu-bar-icon", defaultValue: .calendar) + @Storage(key: "general.menu-bar-icon", defaultValue: .date) static var menuBarIcon: MenuBarIcon { didSet { guard let delegate = NSApp.delegate as? AppDelegate else { @@ -64,19 +64,19 @@ enum MenuBarIcon: Codable { } enum Appearance: Codable { - case system case light case dark + case system @MainActor func resolved(with appearance: NSAppearance = NSApp.effectiveAppearance) -> NSAppearance? { switch self { - case .system: - return nil case .light: return NSAppearance(named: appearance.resolvedName(isDarkMode: false)) case .dark: return NSAppearance(named: appearance.resolvedName(isDarkMode: true)) + case .system: + return nil } } } diff --git a/LunarBarMac/Sources/Views/DateGridCell.swift b/LunarBarMac/Sources/Views/DateGridCell.swift index 479321d..cfeb604 100644 --- a/LunarBarMac/Sources/Views/DateGridCell.swift +++ b/LunarBarMac/Sources/Views/DateGridCell.swift @@ -373,7 +373,7 @@ private extension DateGridCell { } let showDetails = { - try await Task.sleep(for: .seconds(0.8)) + try await Task.sleep(for: .seconds(0.6)) let popover = DateDetailsView.createPopover( title: self.mainInfo, events: self.cellEvents