Lazarus

Installation => macOS / Mac OS X => Topic started by: yazzdi on August 29, 2019, 10:24:10 pm

Title: Hiding my app from the dock and the CMD-TAB list of running programs
Post 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.

Title: Re: Hiding my app from the dock and the CMD-TAB list of running programs
Post by: Leledumbo on August 30, 2019, 12:07:24 pm
Why not make it a console app instead?
Title: Re: Hiding my app from the dock and the CMD-TAB list of running programs
Post by: yazzdi on August 30, 2019, 06:51:45 pm
>Why not make it a console app instead?

It’s got dialogs that it needs to shows at various times.
Title: Re: Hiding my app from the dock and the CMD-TAB list of running programs
Post by: 440bx on August 30, 2019, 10:45:55 pm
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.



Title: Re: Hiding my app from the dock and the CMD-TAB list of running programs
Post by: skalogryz on September 01, 2019, 04:22:55 pm
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)
Code: [Select]
  <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)
Title: Re: Hiding my app from the dock and the CMD-TAB list of running programs
Post by: Bart on September 01, 2019, 04:59:28 pm
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
Title: Re: Hiding my app from the dock and the CMD-TAB list of running programs
Post by: skalogryz on September 01, 2019, 06:45:21 pm
https://forum.lazarus.freepascal.org/index.php/topic,36691.msg245081.html#msg245081
Title: Re: Hiding my app from the dock and the CMD-TAB list of running programs
Post by: trev on September 02, 2019, 01:02:15 pm
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.
Title: Re: Hiding my app from the dock and the CMD-TAB list of running programs
Post by: skalogryz on September 03, 2019, 02:39:46 am
Thank you!
Title: Re: Hiding my app from the dock and the CMD-TAB list of running programs
Post by: yazzdi on September 03, 2019, 04:45:46 pm
Many thanks for the helpful replies!
TinyPortal © 2005-2018