Hide application icon from dock, but keep icon in task switcher? - objective-c

It's possible to show/hide the application's icon from both the Dock and the Task Switcher by setting the "Application is agent (UIElement)" property to YES/NO.
However, is it possible to have an application show in the Task Switcher (Cmd + Tab), but not appear in the Dock?
Thanks.

I'm reasonably certain that this is impossible, and that the dock and the app switcher are using the exact same list to decide what should appear in them.
The reason for my believing this is that there's actually a procedure for removing an app's icon from the Dock, while the target app is running, that has nothing to do with the LSUIElement key. (It consists, essentially, of renaming/moving the app bundle and then restarting the Dock.) Even doing that, though, the app doesn't appear in the switcher.
(You can find the full procedure on macosxhints.com, if you're interested.)

Related

How to detect when an app is launched on macOS?

I have a background process running on the user’s macOS machine. Its job is to detect whenever any app is launched on the machine. Currently, I am detecting the NSNotificationCenter’s NSWorkspaceDidLaunchApplicationNotification event. This works perfectly for detecting when an app is freshly launched (i.e. the app had no instance already running at that time).
But, on macOS, if we click the red cross button at the top-left corner, it generally closes the app window and the app continues to run in the background. This is also evident by the app icon visible on the dock with the dot indicator below it. If I click the app icon on the dock and then launch it, the NSWorkspaceDidLaunchApplicationNotification event won’t be triggered.
To track such events, I tried using the NSWorkspaceDidActivateApplicationNotification event. Using this event, I was able to detect all the app launch scenarios. The problem is that this event gets triggered whenever the app comes into focus such as switching windows using command+tab, clicking on its dock icon, changing between two apps, …
Is there a way to filter out these triggers or identify which action led to the trigger? Or is there some other event/ method I can listen to which gives the required filtered triggers? I only want to detect scenarios where a new window of the app is created.
What you seems to want is two different things, as was mentioned in comments, which should be processed separately to be reached.
To detect app launch, when the new process is started. You could use the NSWorkspaceDidLaunchApplicationNotification if it is enough (usually for visual user apps), or kqueue if it is not, or even EndpointSecurity framework to rule them all.
To track the window(s) in the already launched app. Visually, if the white dot under app dock icon is there, the app is still launched.
There is an Accessibility framework for this task, you could track the event of window creation, window destruction, get count of windows from target process id, visibility state and etc.
It is a bit abandoned and has no updates since maybe release, but it will work for you in most cases.

vb desktop icon different from application icon

I am trying to set the icon of my application. I set the icon once before by changing the property of the form and the property of the project. Now I am trying to change the icon to a different one. The icons of the form and the application have been successfully changed, but when I copy the application to the desktop, the desktop icon still remains the previous one. Can anyone please tell me how to change the desktop icon?
Thanks,
Kai
If you change the icon properly on the form it should get visible in the Taskbar immediately as soon as you start your application.
However even if you did change the project icon properly and therefore your executable has the correct (new) icon (check that in your \bin-folder) you can get the wrong (old) icon from the desktop because you system might retrieve it from the icon cache.
Please check the following link to understand that topic and to see how you can enforce windows to renew its icon cache.
Win 7--: http://www.winability.com/repair-windows-desktop-icon-cache/
Win 8++: http://www.winability.com/how-to-erase-icon-thumbnail-cache-windows-8/

How to hide the automator application icon when running

I create a automator application and set it to run at logon, and I check the "Hide" box, but it still shows up (the gear icon) in the status bar. How can I hide it?
I check the "Hide" box here:
but the gear icon is still shown (the worse part is that it never stops rotating!)
Is it possible to hide this icon, or let it stop rotating?
control-click on it, and choose Show Package Contents from the pop-up menu. Inside the Contents folder, open up Info.plist, and change LSUIElement from No to Yes (if using Property List Editor) — or change the line after the LSUIElement key line to (if using a text editor). Save Info.plist.
Now when the alarm triggers, the Automator plugin will run in the background, without a Dock icon or a menu bar, and the focus will remain on the application you’re using.
Three things to note:
You might have to move the plug-in out of the iCal folder and back in
for this to work. Tiger caches the LSUIElement info; moving the app
forces Tiger to renew the cache.
You probably do not want to do this with any iCal plugin that has
dialogs or requires user interaction! This works best for maintenance
actions, automated downloads, and that sort of thing.
Third, this will work with any Automator workflow that is saved as an
application, not just with iCal plugins.”
Then Clear your Cache

Change Icon on Task Bar for VB.net

I have a program in vb.net which is ready to be published.
Its a small detail, but I'd like to change the icon on both the published app shortcut on my desktop, but more importantly on my taskbar (like where the chrome circle shows up).
Is there any way to accomplish this?
To change the main icon for your application, go to the "Application" tab under the project property page, and change the "Icon:" combo box.

How to create a background-running Cocoa application?

How do I create a Cocoa app that runs in the background (not in the dock, and not in the menu bar either; just in the background).
Does the app need admin privileges? I hope not. Actually it shouldn't, because it's enough that the app runs in the background for that user only, i.e. not for all users.
And I guess I can make it "launch when log-in" by just adding it to the user's Account Preferences, so that shouldn't be a problem.
In your Info.plist set LSBackgroundOnly to 1.
In your Info.plist, set LSUIElement to the string “1”.
The main difference is that a UI-element agent can have a UI (order in a window). A background-only app should be completely faceless; whatever UI it has should exist in a separate application or preference pane.