Bug 1518 - Cannot hide icon from Dock on Mac
Summary: Cannot hide icon from Dock on Mac
Status: NEW
Alias: None
Product: Gtk#
Classification: Mono
Component: gtk-sharp ()
Version: unspecified
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2011-10-16 13:45 UTC by cmre99
Modified: 2014-09-04 05:24 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Test case (26.37 KB, application/zip)
2014-09-04 05:24 UTC, Antonius Riha

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 1518 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description cmre99 2011-10-16 13:45:08 UTC
Mac requires an app bundle that contains an Info.plist file.  This files points to a startup script that starts mono and the specified app correctly.  When building an app using the StatusIcon object the icon appears in the menu bar of the Mac correctly.  However, the app icon also appears in the Dock.  The standard way of preventing this does not work ( putting an LSUIElement node with the value of 1 in the Info.Plist file ).  The icon still appears in the Dock.

Info.plist contents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

startTestGtk contents:


#get the bundle's MacOS directory full path
DIR=$(cd "$(dirname "$0")"; pwd)

#change these values to match your app

#set up environment

#mono version check

VERSION_MSG="$APPNAME requires the Mono Framework version $REQUIRED_MAJOR.$REQUIRED_MINOR or later."

MONO_VERSION="$(mono --version | grep 'Mono JIT compiler version ' |  cut -f5 -d\ )"
MONO_VERSION_MAJOR="$(echo $MONO_VERSION | cut -f1 -d.)"
MONO_VERSION_MINOR="$(echo $MONO_VERSION | cut -f2 -d.)"
if [ -z "$MONO_VERSION" ] \
	osascript \
	-e "set question to display dialog \"$VERSION_MSG\" with title \"$VERSION_TITLE\" buttons {\"Cancel\", \"Download...\"} default button 2" \
	-e "if button returned of question is equal to \"Download...\" then open location \"$DOWNLOAD_URL\""
	echo "$VERSION_MSG"
	exit 1

#get an exec command that will work on the current OS version
OSX_VERSION=$(uname -r | cut -f1 -d.)

if [ $OSX_VERSION -gt 9 ]; then  # If OSX version is 10.4
	MONO_EXEC="exec mono"
	MONO_EXEC="exec -a \"$PROCESS_NAME\" mono"

#run app using mono
Comment 1 Mikayla Hutchinson [MSFT] 2011-10-18 04:44:37 UTC
FWIW, LSUIElement works fine with MonoMac, so this is probably a GTK bug.
Comment 2 Ilber Ibrahimi 2012-02-10 14:21:28 UTC
It's not a GTK bug. I try both, pure Windows StatusIcon and GTK StatusIcon, in both of this the icon is still on the Mac Dock. Please check why the LSUIElement does not work with mono.
Comment 3 Antonius Riha 2014-09-04 05:24:55 UTC
Created attachment 7915 [details]
Test case

I've attached a test case that shows the difference between monomac and gtk#, when using the LSUIElement in Info.plist:
 * The monomac app stays in the background and no icon is visible in the dock (and also no window).
 * The gtk# app displays the window when launched