Skip to content
Browse files

Merge pull request #24 from francescolaffi/master

Square status bar icon
  • Loading branch information...
2 parents cfaad18 + 5487a5c commit 6e1d82f5abd83981533f0b9a43c20af55b723508 @jyr committed
Showing with 16 additions and 1 deletion.
  1. +16 −1 MNPP.app/Contents/Resources/MNPPAppDelegate.py
View
17 MNPP.app/Contents/Resources/MNPPAppDelegate.py
@@ -34,8 +34,23 @@ def applicationDidFinishLaunching_(self, sender):
#def awakeFromNib(self):
statusItem = NSStatusBar.systemStatusBar().statusItemWithLength_(NSVariableStatusItemLength).retain()
statusItem.setMenu_(self.statusMenu)
- statusItem.setTitle_("MNPP")
statusItem.setHighlightMode_(YES)
+ statusItem.setToolTip_("MNPP: Mac + Nginx + Percona + PHP/Python")
+
+ font = NSFontManager.sharedFontManager().convertFont_toHaveTrait_(NSFont.menuBarFontOfSize_(11), NSBoldFontMask)
+ #first row has a high line height to keep the icon vertical centered
+ parStyleFirstRow = NSParagraphStyle.defaultParagraphStyle().mutableCopy()
+ parStyleFirstRow.setAlignment_(NSCenterTextAlignment)
+ parStyleFirstRow.setMinimumLineHeight_(15)
+ #second row has low line height to keep the icon compact
+ parStyleSecondRow = NSParagraphStyle.defaultParagraphStyle().mutableCopy()
+ parStyleSecondRow.setParagraphStyle_(parStyleFirstRow)
+ parStyleSecondRow.setMaximumLineHeight_(10)
+ #the char \u2009 is a thin space
+ title = NSMutableAttributedString.alloc().initWithString_attributes_(u"MN\nP\u2009P", {NSFontAttributeName: font})
+ title.addAttribute_value_range_(NSParagraphStyleAttributeName, parStyleFirstRow, NSMakeRange(0,3))
+ title.addAttribute_value_range_(NSParagraphStyleAttributeName, parStyleSecondRow, NSMakeRange(3,3))
+ statusItem.setAttributedTitle_(title)
@objc.IBAction
def showPreferencesWindow_(self, sender):

0 comments on commit 6e1d82f

Please sign in to comment.
Something went wrong with that request. Please try again.