mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-05-02 00:40:14 +00:00
fix(menubar): variable width for both compact and default mode
This commit is contained in:
parent
46f945fd72
commit
3355e3699e
1 changed files with 2 additions and 5 deletions
|
|
@ -5,9 +5,7 @@ import Observation
|
||||||
private let refreshIntervalSeconds: UInt64 = 15
|
private let refreshIntervalSeconds: UInt64 = 15
|
||||||
private let nanosPerSecond: UInt64 = 1_000_000_000
|
private let nanosPerSecond: UInt64 = 1_000_000_000
|
||||||
private let refreshIntervalNanos: UInt64 = refreshIntervalSeconds * nanosPerSecond
|
private let refreshIntervalNanos: UInt64 = refreshIntervalSeconds * nanosPerSecond
|
||||||
/// Fixed so the popover's anchor point doesn't shift each time today's cost changes.
|
private let statusItemWidth: CGFloat = NSStatusItem.variableLength
|
||||||
private let statusItemFixedWidth: CGFloat = 130
|
|
||||||
private let statusItemCompactWidth: CGFloat = NSStatusItem.variableLength
|
|
||||||
private let popoverWidth: CGFloat = 360
|
private let popoverWidth: CGFloat = 360
|
||||||
private let popoverHeight: CGFloat = 660
|
private let popoverHeight: CGFloat = 660
|
||||||
private let menubarTitleFontSize: CGFloat = 13
|
private let menubarTitleFontSize: CGFloat = 13
|
||||||
|
|
@ -127,8 +125,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func setupStatusItem() {
|
private func setupStatusItem() {
|
||||||
let width = isCompact ? statusItemCompactWidth : statusItemFixedWidth
|
statusItem = NSStatusBar.system.statusItem(withLength: statusItemWidth)
|
||||||
statusItem = NSStatusBar.system.statusItem(withLength: width)
|
|
||||||
guard let button = statusItem.button else { return }
|
guard let button = statusItem.button else { return }
|
||||||
button.target = self
|
button.target = self
|
||||||
button.action = #selector(handleButtonClick(_:))
|
button.action = #selector(handleButtonClick(_:))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue