Skip to content

Commit

Permalink
Adjusts sizes and paddings in menu bar
Browse files Browse the repository at this point in the history
  • Loading branch information
pakerwreah committed Jul 27, 2023
1 parent d3590cd commit 43d3155
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Calendr/MenuBar/StatusItemViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,16 @@ class StatusItemViewModel {
let (icons, text) = iconsAndText

let title = NSAttributedString(string: text, attributes: [
.font: NSFont.systemFont(ofSize: 13, weight: showBackground ? .regular : .medium)
.font: NSFont.systemFont(ofSize: 12.5, weight: showBackground ? .regular : .medium)
])

let radius: CGFloat = 3
let border: CGFloat = 0.5
let padding: NSPoint = showDate ? .init(x: 4, y: 1) : .init(x: border, y: border)
let padding: NSPoint = showDate ? .init(x: 4, y: 1.5) : .init(x: border, y: border)
let textSize = title.length > 0 ? title.size() : .zero
let spacing: CGFloat = 4
var iconsWidth = icons.map(\.size.width).reduce(0) { $0 + $1 + spacing }
let height = max(icons.map(\.size.height).reduce(0, max), textSize.height)
let height = max(icons.map(\.size.height).reduce(0, max), 15)
if title.length == 0 {
iconsWidth -= spacing
}
Expand Down Expand Up @@ -226,7 +226,7 @@ private func drawIconDate(rect: CGRect, iconSize: CGFloat, dateProvider: DatePro
let paragraph = NSMutableParagraphStyle()
paragraph.alignment = .center
NSAttributedString(string: date, attributes: [
.baselineOffset: -(2.5 / 16) * iconSize,
.baselineOffset: -(3 / 16) * iconSize,
.font: NSFont.systemFont(ofSize: (9 / 16) * iconSize),
.foregroundColor: NSColor.red,
.paragraphStyle: paragraph
Expand Down

0 comments on commit 43d3155

Please sign in to comment.