Originally I thought adding new line should work. The problem is, the line height is too big. How can I make it more dense(closer to each other)?
There's the following example on git starting line 41. But apple docs say that custom view inside of NSStatusItem is deprecated. (not sure if it's deprecated for views inside of NSMenuItem)
let statusBar = NSStatusBar.system
statusBarItem = statusBar.statusItem(withLength: NSStatusItem.squareLength)
statusBarItem.button?.title = "123\n456"
UPD
What I got so far. It's not Y centred though. And statusItem?.button?.frame = CGRect(x: 0.0, y: -2.0, ...
seems incorrect and shifts the leading icon to the bottom.
var comb = NSMutableAttributedString(attributedString: str1)
comb.append(br) // new line
comb.append(str2)
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.maximumLineHeight = 9
comb.addAttribute(NSAttributedString.Key.paragraphStyle, value:paragraphStyle, range:NSMakeRange(0, comb.length))
statusItem?.button?.attributedTitle = comb
UPD (retarted approach with \n and baselineoffset)
var comb = NSMutableAttributedString(attributedString: NSAttributedString(string: "\n")) // this
comb.append(top)
comb.append(br)
comb.append(bottom)
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.maximumLineHeight = 9
comb.addAttribute(NSAttributedString.Key.baselineOffset, value: 3.0, range:NSMakeRange(0, comb.length))