nsstatusbar

NSStatusItem's menu are not shown in Full Screen Model for the Mac os 10.13.1

我与影子孤独终老i 提交于 2019-12-07 12:02:52
问题 all: I have added one NSStatusItem in the status bar for my test app, and it works well in Mac ox 10.12, not only normal model, but also full screen model. When i switch to Mac os 10.13, it is failed to show the menu in the full screen model. self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength]; self.statusItem.highlightMode = YES; self.statusItem.menu = self.dummyMenu; [self.statusItem.menu setDelegate:self]; self.statusItem.image = image; does

Highlight NSStatusItem when triggered programmatically

风格不统一 提交于 2019-12-07 06:59:05
问题 I have an NSStatusItem with an attached menu that I'm triggering with a global hotkey. If I click the menu item I get the highlight as usual, if I use the hotkey the highlight isn't triggered. Does anyone know a way to trigger the highlight? I've tried overriding the view and drawing it myself in drawRect but if there is a nicer way to do it I'd love to hear. Thanks! The reason I don't want to override the view is then I have to handle icon positioning, clicking to activate the menu, etc. 回答1

Detect click on OS X menu bar?

偶尔善良 提交于 2019-12-06 10:42:55
I'm curious if there's a trick to detecting a click on the Menu Bar as a whole. I know I can detect a click on an NSStatusItem or NSMenu, but I am looking for events pertaining to the empty space of the Menu Bar. Looking through the documentation, it does not seem possible. However, I wanted to know if anyone had a workaround for this functionality? You can install a local event monitor using NSEvent addLocalMonitorForEventsMatchingMask:handler: See the documentation located here . 来源: https://stackoverflow.com/questions/7249239/detect-click-on-os-x-menu-bar

Highlight NSStatusItem when triggered programmatically

依然范特西╮ 提交于 2019-12-05 17:00:42
I have an NSStatusItem with an attached menu that I'm triggering with a global hotkey. If I click the menu item I get the highlight as usual, if I use the hotkey the highlight isn't triggered. Does anyone know a way to trigger the highlight? I've tried overriding the view and drawing it myself in drawRect but if there is a nicer way to do it I'd love to hear. Thanks! The reason I don't want to override the view is then I have to handle icon positioning, clicking to activate the menu, etc. This does the magic in macOS 10.13.6 with Xcode 10. guard let m = statusItem.menu else { return }

Status bar font is bold for some reason

做~自己de王妃 提交于 2019-12-04 05:58:42
问题 The clock, carrier, battery part in my device is normal, like in 1st picture. When I open my app, after loading the app in memory it starts to animate and make the navigation bar bold and bigger font. I am not even sure if this is a good or bad thing, but I would like to know how this happened. Here is how I setup the rootVC if it has anything to do with this issue: window = UIWindow(frame: UIScreen.mainScreen().bounds) window!.rootViewController = VCOrganizer.LaunchVCHolder window!

NSPopover transiency when popover is in status bar

那年仲夏 提交于 2019-12-02 16:22:15
I'm making an app which lives in status bar. When status item is clicked, NSPopover pops up. It looks like this: Here's the problem: I want it to be "transient", that is if I click anywhere outside of the popover, it will close. And while NSPopoverBehaviorTransient works fine when popover is in a window, it doesn't work when it's in status bar. How can I implement such behavior myself? radex It turned out to be easy: - (IBAction)openPopover:(id)sender { // (open popover) if(popoverTransiencyMonitor == nil) { popoverTransiencyMonitor = [NSEvent addGlobalMonitorForEventsMatchingMask

Status bar font is bold for some reason

家住魔仙堡 提交于 2019-12-02 10:35:30
The clock, carrier, battery part in my device is normal, like in 1st picture. When I open my app, after loading the app in memory it starts to animate and make the navigation bar bold and bigger font. I am not even sure if this is a good or bad thing, but I would like to know how this happened. Here is how I setup the rootVC if it has anything to do with this issue: window = UIWindow(frame: UIScreen.mainScreen().bounds) window!.rootViewController = VCOrganizer.LaunchVCHolder window!.backgroundColor = QorumColors.ThemeBlue window!.makeKeyAndVisible() macserv It looks like your app does not

Is it possible to add a NSStatusItem to a specific position in NSStatusBar?

↘锁芯ラ 提交于 2019-12-01 03:19:01
问题 I use self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength]; to add an statusItem to the systemStatusBar on OSX. The statusItem then appears on the left-most position in the systemStatusBar. I was wondering if there is a way to add such an item to a specific index e.g. on the left side of the system clock? 回答1: Yes and no. Using private API you can specify priority for adding NSStatusItem . I have developed a tiny category for NSStatusBar

How to open a NSPopover at a distance from the system bar?

£可爱£侵袭症+ 提交于 2019-12-01 00:27:11
I'm opening a NSPopover with the action of an icon in the status bar. myPopover.show(relativeTo: button.bounds, of: button, preferredEdge: NSRectEdge.minY) This works fine with the exception that the distance from the popover and the system bar is zero: I'd like to achieve the same result as the Dropbox app which renders the popover at a small distance from the system bar: I've tried using button.bounds.offsetBy(dx: 0.0, dy: 20.0) which doesn't affect the position of the popover and button.bounds.offsetBy(dx: 0.0, dy: -20.0) which puts the popover above the system bar: So how can I position

How to update NSMenu while it's open?

ぐ巨炮叔叔 提交于 2019-11-30 20:43:13
I have a NSMenu with dynamically added NSMenuItems. The NSMenu is not refreshing properly while it's kept open. I am calling NSMenu update method in NSEventTrackingRunLoopModes . I have implemented following methods to update NSMenu. - (void)menuNeedsUpdate:(NSMenu *)menu { for (NSInteger index = 0; index < count; index++) [self menu:menu updateItem:[menu itemAtIndex:index] atIndex:index shouldCancel:NO]; } - (BOOL)menu:(NSMenu *)menu updateItem:(NSMenuItem *)item atIndex:(NSInteger)index shouldCancel:(BOOL)shouldCancel` - (NSInteger)numberOfItemsInMenu:(NSMenu *)menu I am dynamically