Menu status applications doubts [duplicate] - objective-c

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to create a Menubar application for Mac
I have implemented a feed with Cocoa, for Mac OS X.
It's a status application, displaying only the menu.Now basically I got three questions:
When I launch it I always see the application icon in the dock.But this is a menu status application, how do I remove the dock icon? It should be an application like Watts and Dropbox, a pure menu;
How do I prevent the user from launching the application multiple times? If the user does so, I would like to not launch a second instance of the application.

How do I prevent the user from launching the application multiple
times? If the user does so, I would like to not launch a second
instance of the application.
That would commonly be done using a filesystem lock (flock) on unix based systems.
But then again, Cocoa has an even simpler solution for that; you may check if an application is active by supplying its bundle identifier to the system.
NSRunningApplication runningApplicationsWithBundleIdentifier:
See the NSRunningApplication Reference for more.

Related

Changing a Universal Windows app to function as a game [duplicate]

This question already has an answer here:
Disable pointer mode for webview in Xbox UWP
(1 answer)
Closed 2 years ago.
I have a standard Universal Windows app that is actually a game in a WebView container (because HTML5) and I was wondering if there's any way to change something in the files of my project so that it's actually treated as a game (and likewise would be installed as such when deployed to Xbox One, Series X etc.) Obviously I want to get rid of the "change input mode" dialog as well or else I can't map the menu button for a pause function or anything else for which one would do so (and yes, that includes "Konami Code" implementations).
UPDATE 2020-09-16: This ended up being a duplicate question. Refer to the link in the information bar for what ultimately did the trick.
UPDATE 2020-10-21: I totally forgot to inform the mods of the duplication in prior discourse. This has now been addressed and the answer is noted above. I have also removed the link and description from the post to clean things up.
Two things since I opened this question which require my immediate request to close it to further discussion:
It turned out that the game type change is automatic once in the store, and
It also ended up being a duplicate question (for which the link is now in the information bar).

Cocoa Background Mode When all windows closed

I am developing an OS X app
That uses StatusBar and Also has Windows
I would to move my app to "background" (That only StatusBar will be shown and windows ofc and not applications main menu)
When all it's windows are closed.
(I want to do it so, the app won't appear in cmd+tab menu etc, I want only StatusBar to be).
I am quite don't know where in documents to look for it and if it is even possible.
I have found that in Info.Plist I can put a flag to enable "LSBackgroundOnly" - then I see only my StatusBar.
But I want to switch between background and foreground, Since I want to allow my user to open the main Application Window via the StatusBar menu as well.
What would be the best approach or where to look for this ?
Sorry to flag as a possible duplicate. The other question doesn't exactly have good keywords for searching, but the answer is the same:
Use or modify the code in the answer here.
The info.plist settings are or OSX versions before 10.9 and cannot be changed at runtime. 10.9+ you can use NSApplication's setActivationPolicy and application delegate functions to do what you want. See discussion here and here as well.

Another application window close

Similar to this question:
http://stackoverflow.com/questions/12422327/other-application-window-close-event
Is there a way other than Accessibility Model to monitor if another application window was closed (not terminated)? I can't require to have users turn on Accessibility mode in order for this to work. NSWorkspace Notifications will only tell you if the application was terminated.

In WinRT how to create an application that is always visible?

With windows 8, is it possible to create an application that is always visible? For instance, in previous versions of windows, there is the task bar with quick launch icons. Can I create something similar to the quick launch icons that are always on the screen?
If you are referring to a Windows 8 Store app then the answer is no. You can have a live tile and toast notifications that provides updates to the user which may cause the user to launch your application.
A good article to read to understand how your Windows Store apps will run on Windows 8 go here to learn about Application lifecycle (Windows Store apps). This will explain the App execution state.
It is not possible in the RT version, but the same is possible in the desktop version. If you have a desktop app, you can pin it to the taskbar. But any Window store app cannot be pinned to the taskbar. What you can do instead is move the app to the beginning of your Home screen, so anytime you click the Windows button your app will be visible right in front.
Do you mean always visible in the Star Menu screen? If so, you can add tile updating functionality to your application. As long as the user has the application pinned to the Start Menu, he would see the updates. Check the link below for an introductory tutorial.
http://blogs.msdn.com/b/windowsappdev/archive/2012/04/16/creating-a-great-tile-experience-part-1.aspx
"Quick Launch" has a very specific meaning, which you may or may not have been referring to in your question.
Below is the Quick Launch bar in Windows 8 - essentially a toolbar pointing to a location in your %AppData% directory. Prior to Windows 7 it was available by default, but the ability to now pin items directly to the taskbar rather supersedes it. Here's how you can restore Quick Launch if you really want to :)
It's, of course, available only in the Desktop mode and not on the Modern UI, where pinning a tile is the best you can hope for, and it's all up to the user to pin it AND to determine where it shows up on their Start Screen.
Another option worth mentioning (although more like system tray than quick launch) is lock screen presence. If the user chooses so and your app supports that, he can add it to his lock screen:
either as a a badge (up to 7 apps)
or as a tile notification (single app only)
This is not a way for the user to quickly start your app (other answers have already covered these options) but a way to stay visible and keep your user informed.

Icons in Activity Monitor?

In the above image some processes have "icons" beside their names. What characteristic must a process meet to have an "icon" beside its name? Note the defining characteristic is not simply being in the Applications folder since several processes location in the Applications folder don't have the icon.
In addition how can I check if a PID meets the defining criteria in Objective-C? (Using Cocoa on OSX)
I think only applications that appear with their icon in the dock when you open them do have an icon in the activity monitor.
Applications that have "checked in" with Launch Services as a UI app get icons. Technically speaking, anything that ends up calling LSApplicationCheckIn will get one, but that's not a call you can make yourself.
If you run a standard NSRunLoop, or even initialize NSApplication ([NSApplication sharedApplication]) you should get it.
My question is: what are you doing that you're not getting it?