Skip to content

Commit

Permalink
Vertical align statusbar text with icon (#57)
Browse files Browse the repository at this point in the history
* text better vertical align with icon

* text center horizontally
  • Loading branch information
scrodde authored Aug 29, 2023
1 parent 9f8e6f1 commit d456fe1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion TomatoBar/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,16 @@ class TBStatusItem: NSObject, NSApplicationDelegate {
}

func setTitle(title: String?) {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineHeightMultiple = 0.9
paragraphStyle.alignment = NSTextAlignment.center

let attributedTitle = NSAttributedString(
string: title != nil ? " \(title!)" : "",
attributes: [NSAttributedString.Key.font: digitFont]
attributes: [
NSAttributedString.Key.font: digitFont,
NSAttributedString.Key.paragraphStyle: paragraphStyle
]
)
statusBarItem?.button?.attributedTitle = attributedTitle
}
Expand Down

0 comments on commit d456fe1

Please sign in to comment.