[Mono-osx] How to hide mono and windows form in Mac Dock

d_v dan.vandermolen at figpsoft.com
Thu Feb 5 11:50:31 EST 2009

Baker, GJ (Gareth) wrote:
> If you want to stop the apps icon from appearing in the dock a bit of
> googling found this:
> -----
> In order to get rid of the dock icon, you must modify the file named
> 'Info.plist' inside the Application's package (i.e.
> Sherlock.app/Contents/Info.plist). Open this file in your favourite text
> editor and add the following section (if it's already present simply
> change the 0 to a 1 in the string tag:
> [KEY]NSUIElement[/KEY]
> NOTE: I substituted the standard square brackets for the purposes of
> posting here; you must substitute the angle brackets when editing.
> -----
> Hop this helps
> Gareth Baker
> -----Original Message-----
> From: mono-osx-bounces at lists.ximian.com
> [mailto:mono-osx-bounces at lists.ximian.com] On Behalf Of d_v
> Sent: 05 February 2009 15:17
> To: mono-osx at lists.ximian.com
> Subject: Re: [Mono-osx] How to hide mono and windows form in Mac Dock
> Sandy Armstrong wrote:
>> On 02/05/2009 05:29 AM, d_v wrote:
>>> Sandy Armstrong wrote:
>>>> On 02/04/2009 01:16 PM, d_v wrote:
>>>>> Hi there,
>>>>> I figure I can not run my C# 2.0 .NET Windows Service on mono, so I
> am
>>>>> running the equivalent Windows Form (application) on mono.
>>>>> However the script editor, mono, and sometiimes the form (windows
> state
>>>>> is
>>>>> set to minimized) are all visible in the Dock.  I use a script to
>>>>> launch
>>>>> mono and the .exe.
>>>>> What do you advise is the best way to hide these programs from the
>>>>> Dock?
>>>>> I am hoping for a manual way to do this and maybe a way to do it in
>>>>> setup/or
>>>>> code so I do not have to bother the user with setting this up.
>>>> Make a Mac app bundle.  Download the OS X versions of MonoDevelop,
>>>> Banshee, or Tomboy for examples of how this is done.  These are all
> gtk#
>>>> apps, but I don't see why it wouldn't work with winforms apps.
>>>> By the way, there's a mono-osx list that might be more helpful with
>>>> future Mac questions.
>>>> Best,
>>>> Sandy
>>>> _______________________________________________
>>>> Mono-osx mailing list
>>>> Mono-osx at lists.ximian.com
>>>> http://lists.ximian.com/mailman/listinfo/mono-osx
>>> Thanks for the tip.
>>> So I started looking up "Mac bundles" and I found this link:
>>> http://www.mono-project.com/Guide:Running_Mono_Applications and a
> section
>>> at
>>> the very end called "Macpack, Mac OS X only"
>>> Is this the way I do it?  But I am not using cocoa sharp...
>> I don't personally know.  Banshee has some stuff integrated in their 
>> makefiles.  When I make my bundles for Tomboy and Tasque I use a
> little 
>> script:
>> http://svn.gnome.org/viewvc/tomboy/trunk/bundle-mac-app.sh?view=markup
>> Notice that in SVN I keep a "skeleton" of the .app hierarchy (in a 
>> directory called "osx").  Then I just copy the skeleton and the
> binaries 
>> to the right folder.
>> You can right-click any app and "Show Package Contents" to get an idea
>> of how things are laid out, too.
>> Sandy
>> _______________________________________________
>> Mono-osx mailing list
>> Mono-osx at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-osx
> Thanks Sandy,
> This creates a bundle for me nicley (Now it hides the apple script form
> the
> Dock, but I still can't hide mono and my application from the Mac OS X
> 10.5.6 dock).
> http://code.google.com/p/cocoa-sharp-dev/wiki/WinFormsTutorial  (macpack
> tutorial)
> Terminal command to build a Mac OS X bundle with Macpack:
>    macpack -n:MyApp -a: MyApp.exe -o:. -m:1 
> This will create a Mac bundle and optionally (-r) copy your DLLs and
> support
> files to the Resources subfolder in the package.  The new bundle can be
> launched by double-clicking on it in the finder.  The finder reads the
> directory tree and realizes that it is really an App and treats the
> bundle
> like a single file. If you want to explore the subdirectory, you need to
> right click (or Ctrl-click for single button mice) and select "Show
> Package
> Contents". 
> Ensure all DLLs and support files (.exe.config) are in the Resources
> folder. 
> Note: that if you are using
> System.Reflection.Assembly.GetExecutingAssembly().Location  code in C#
> code,
> it will now point to the bundle name by default, not the .exe name, so
> save
> the bundle with the same root name as the .exe (you can rename the
> bundle
> later or try the Info.plist file).  
> This is what my Info.plist file looks like:
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
> "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
> <plist version="1.0">
> <dict>
> 	<key>CFBundleIdentifier</key>
> 	<string>MyApp</string>
> 	<key>CFBundleExecutable</key>
> 	<string>MyApp</string>
> 	<key>CFBundleIconFile</key>
> 	<string></string>
> 	<key>NSUIElement</key>
> 	<string>1</string>
> </dict>
> </plist>
> -- 
> View this message in context:
> http://www.nabble.com/How-to-hide-mono-and-windows-form-in-Mac-Dock-tp21
> 839765p21853372.html
> Sent from the Mono - OSX mailing list archive at Nabble.com.
> _______________________________________________
> Mono-osx mailing list
> Mono-osx at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-osx
> _______________________________________________
> Mono-osx mailing list
> Mono-osx at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-osx

Thanks Garth, I also found that info.

I tried both : LSUIElement and NSUIElement it did not hide my form icon or
mono in the dock.

The following did not work: I tried what you said about recreating the
bundle (but the plist file is still empty of those entries) and I also tried
taking out the plist file and changing it and placing it back in the bundle
with a new timestamp.

The icon would only work if I move the plist file to the desktop, change it,
then copy it back to the bundle and reboot.  I should have known, since the
bundle did not show the icon in the finder or in the dock after the plist

So now the mono framework icon in the dock uses the new icon briefly, then
flashes back to the default "mono-head" icon after 1-2 seconds.  The form
shows a white/grey mini-form with my new tiny icon on the side.  When I open
the form and minimize it however, the old mono-head icon is back...  Strange

I tried the same tests with a real "Macintosh" icon (not my creation) with
the same results.
Maybe I should mention that I am using standard .NET Windows Forms and not
cocoa forms...
View this message in context: http://www.nabble.com/How-to-hide-mono-and-windows-form-in-Mac-Dock-tp21839765p21855983.html
Sent from the Mono - OSX mailing list archive at Nabble.com.

More information about the Mono-osx mailing list