Always show Badge Count in OS X - macos

Apple's own apps such as Reminders show Badge count even if they are not running or after quitting them
Other apps (some even with Helper apps) show badge when they are running, but it disappears as soon as you quit the application
is there a way, user side, or programming side, we can do to always show this badge, even when the app is not running?
I searched a lot in Google, didn't find anything about "always" showing this badge, maybe "badge count" is the wrong keyword

Yes, Create dock Tile Plug-in.
Starting in OS X v10.6, you can customize an application’s Dock tile
icon and menu when the application is not running.
When your application needs to customize the Dock tile, it manipulates the NSDockTile object that was provided to the initial call to the setDockTile: method.
To dynamically change the application's Dock icon, you can draw a Dock icon using a custom view. See Using a Custom View to Draw a Dock Icon.
To add text to a Dock icon, you can apply a badge label. See Changing the Text of a Badge Label.

Related

Qt application, hiding Mac dock & menu if there's only one display and show them if there are more

I'm building a full-screen application in Qt. If there is only one display, the Dock and Menu should be hidden but if there is more than one display,the Dock and Menu should only be hidden on the display showing the application and show one of the other displays.
I tried using
<key>LSUIPresentationMode</key>
<integer>4</integer>
but this also hides the Dock and Menu on every display instead of only the one containing the application.
Any feedback would be appreciated. Thanks

display notification number in MAC cocoa application

i want to display notification (like the number that exist when a application is minimized in utorrent or itunes (when u have some update) or in outlook the number of unread mails).
I am using this for a messaging application so when the application is minimized and i receive a message then it must display the number of unread messages.
Do i need to use apple push notification as in the case of iPhone applications if so is there some other way ?
Thanks
You can do this using NSDockTile. See also the Dock Tile Programming Guide.
If your refering to the little red badge in the top right corner of an application dock icon then thats called the Dock Badge Label, You can easly set this through code, Because I do all my programing in Cocoa Applescript / AppleScript Objective C i struggle with C so Ill use a simple code:
You should be able to set the Dock Icon Badge with this:
[[NSApp dockTile] setBadgeLabel: #"1"];
// Sets the Dock Badge to "1"
(PS I just guessed this because I had to mentally convert this to Objective C) but this should work

NSStatusItem menu does not show up in lion full screen app

I have a foreground application that shows a NSStatusItem along with a menu (via NSStatusItem setMenu:(NSMenu *)menu). However, this menu does not display when I am looking at another app in fullscreen mode (say Safari) in Lion.
I know that I can make it work by setting NSBGOnly to true in the Info.plist file (or NSUIElement), but both methods will make my app icon disappear from the task switcher as well as hide the main menu once I manage to focus my app.
Finally, I have tried setting NSUIElement to true and do the following in my app upon startup (see also How to hide the Dock icon):
ProcessSerialNumber psn = { 0, kCurrentProcess };
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
This made the menubar appear again as well as the dock icon but the original problem (status item menu does not show up in another fullscreen app) is visible again. Whatever I try, I can't win.
Any suggestions would be highly appreciated!
Unfortunately I think this is expected behaviour. Your app is considered a foreground app, so all its UI is disabled while another app is in full screen. You should file a bug if you feel that status items in foreground apps should still be available to other apps in full screen mode.
Probably the best solution would be to split your app into two parts, an agent app which has LSUIElement set to true, which creates and manages the status item and its menu, and your main foreground app which does most of the work and which launches and manages the agent app.
There are a variety of inter-process communication methods that you can use to get the two apps talking to each other, such as Distributed Objects or Apple Events.

NSWindow, how not to be part of a screenshot?

My Cocoa app displays a transparent window on the screen, but when the user tries to take a screenshot using Mac OS X's built-in screen capture key with the option of selecting full windows (Command-Shift-4, then Space Bar), my window gets highlighted as part of the possible windows to capture.
How can I tell my Window or App not to allow this? My Window already refuses to be the Main Window or Key Window through -canBecomeKeyWindow and -canBecomeMainWindow both returning NO, but this still happens.
The Window is also at the NSModalPanelWindowLevel and NSScreenSaverWindowLevel does the same thing.
Notice that every window is eligible for screenshots, even the desktop, dock and menu bar, which are special windows. You can even take a screenshot of the Exposé overlay window itself. This leads me to believe that there is no way to do this.
I suppose you could hook the Command+Shift+4 key event and hide the window, but that key combo is user-definable, so it is subject to change.

disable menu bar and dock programmatically in mac

i am new to mac programming and i have to perform a task. I need to make an application that will run at startup and cover the complete screen and will not close until my custom passcode is inserted.
The menu bar and dock needs to be hidden behind this application and the application cannot be closed until the information is given.
So far i have written the code that would run at startup . But i cant seem to disable the menu bar and dock and lock all user actions unless he gives the passcode i want.
What to do !!!!
This article contains some good info and links on creating a full-screen app that hides the Dock and menubar.
If you want to hide the Menu-Bar in Swift (Xcode, Mac OS X Application), you do:
NSMenu.setMenuBarVisible(false)
If you want to show the Menu-Bar again:
NSMenu.setMenuBarVisible(true)
Please keep in mind, that "setMenuBarVisible" is a class function and does not exist for instances of a class. So the following line is not possible:
NSApplication.sharedApplication().mainMenu!.setMenuBarVisible(false)
And will result in an error, saying, that the func "setMenuBarVisible" is not defined.

Resources