Lazarus
Installation => macOS / Mac OS X => Topic started by: yazzdi on August 29, 2019, 10:24:10 pm
-
We wrote a FPC/Lazarus program that is a helper program to another FPC/Lazarus program that we also wrote.
When the helper program runs, I want it to be as invisible as possible.
That includes not showing up in the dock, and not showing up on the CMD-TAB list of programs.
In addition, is it possible for the program to not have a main menu, currently the helper program has a tiny menu, but it has no use for a menu at all. But since the Apple symbol is part of the menu, I expect that Apple insists on a menu bar for every program.
-
Why not make it a console app instead?
-
>Why not make it a console app instead?
It’s got dialogs that it needs to shows at various times.
-
When the helper program runs, I want it to be as invisible as possible.
That includes not showing up in the dock, and not showing up on the CMD-TAB list of programs.
In addition, is it possible for the program to not have a main menu, currently the helper program has a tiny menu, but it has no use for a menu at all. But since the Apple symbol is part of the menu, I expect that Apple insists on a menu bar for every program.
I don't know if what I'm going to suggest can be done on a mac but, on Windows, you could have the helper program be a dynamically loaded and unloaded service.
That would meet all the requirements you've mentioned so far. In a unix environment, that would be making your helper program a daemon. If you think that is a solution, you could ask for how a daemon is created in FPC, which is not something I can help you with, since I am not well versed on that platform.
-
you're looking into creating an "agent app".
In order to do that, you need to add special option into your app bundle Info.plist file:
LSUIElement (https://developer.apple.com/documentation/bundleresources/information_property_list/lsuielement?language=objc)
<key>LSUIElement</key>
<true/>
There's a documentation regarding that on FPC wiki.
https://wiki.freepascal.org/Carbon_Interface#Hiding_application_from_the_Dock
It resides in Carbon section, but it applies to Cocoa. (this should be moved to "OS X Programming Tips", rather than being widgetset specific)
-
I have a sneaky suspicion I have seen this discussion (with this example) several times before, either on this forum or on the ML.
Bart
-
https://forum.lazarus.freepascal.org/index.php/topic,36691.msg245081.html#msg245081
-
Moved Hiding an app from the Dock content from Carbon Interface page to its own page:
https://wiki.freepascal.org/Hiding_a_macOS_app_from_the_Dock
and referenced in the Carbon Interface and the OS X Programming Tips pages.
-
Thank you!
-
Many thanks for the helpful replies!