Hide icon from Dock

  1. 3 days ago

    Hi guy, with this code I can hide my App icon from Dock. But when I try in compiled version don't work.

    I have this code in my App.Open() event:

    Dim myProcess As ProcessMBS
    myProcess = New ProcessMBS
    myProcess.GetCurrentProcess        
    If myProcess.TransformProcessType(myProcess.kProcessTransformToUIElementApplication) = 0 Then
    End If

    Why doesn't it work in the compiled version?

    Then I noticed that in debug mode the icon appears for a moment and then disappears. The above code is right at the beginning of the App Open.
    Is't possible not to make it appear at all?

    Search for NSUIElement

  2. Christian S

    Mar 25 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    Do you see an error in Console.app?

    Also you could just put in key in info.plist to have your app be hidden by default.

  3. Christian S

    Mar 25 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    Did you try kProcessTransformToBackgroundApplication or kProcessTransformToForegroundApplication instead?

  4. kProcessTransformToBackgroundApplication work in debug mode, work also in compiled mode, but if I move the App in application folder It does not work anymore.

  5. Norman P

    Mar 25 Pre-Release Testers, Xojo Pro outside drowning sorrows

    I'd do this

    @ChristianSchmitz Also you could just put in key in info.plist to have your app be hidden by default.

  6. @Norman P I'd do this

    Can you help me? What should I write?

  7. Christian S

    Mar 25 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Answer Germany

    Search for NSUIElement

  8. Norman P

    Mar 25 Pre-Release Testers, Xojo Pro outside drowning sorrows

    you need to update your apps plist to have en entry that sets LSUIElement

    see https://forum.xojo.com/11024-how-to-start-app-with-no-window-and-without-icon-in-dock
    where they discuss how to set this in the plist

  9. 	<key>LSBackgroundOnly</key>
    	<integer>1</integer>

    Solved!

  10. Sam R

    Mar 25 Pre-Release Testers, Xojo Pro, Third Party Store Hengchun, Pingtung, Taiwan

    Note of warning; under 10.14 and newer; there are restrictions applied to applications that hide their dock icon (for security purposes). There isn't a complete list of the things that Apple deactivate / don't allow.

    I would suggest that you seriously consider two things.

    1. Do you really want to hide the dock icon?
    2. Once your application is complete, are there any features that are impacted by hiding the dock icon.
  11. Emile S

    Mar 25 Europe (France, Strasbourg)

    @Sam R Do you really want to hide the dock icon?

    Good question Sam: why ?

  12. 2 days ago

    Tim P

    Mar 26 Pre-Release Testers, Xojo Pro Rochester, NY
    Edited 2 days ago

    Please try this app out, countdown.zip

    If that works correctly, then the NSApp method for hiding the dock icon (the one I'm pretty sure is the preferred method) is functional.

  13. Emile S

    Mar 26 Europe (France, Strasbourg)

    @Tim P Please try this app out, countdown.zip

    Stunning :( (and unfortunately fake news ;)).

    Oh, and disturbing; it makes me seconds to understand what happened.

    A very special case. ;)

  14. Tim P

    Mar 26 Pre-Release Testers, Xojo Pro Rochester, NY

    @Emile S Stunning :( (and unfortunately fake news ;)).

    lol, I had made it back in February. It had a limited release here on the forum and on twitter . It also apparently will count up when the date passes, heh.

    This way for hiding dock icons has been encouraged since around the time code signing apps came into play. Using LSUIElement became impossible for some apps, as you could no longer modify Info.plist due to the signature. Another benefit is that developers have control over the dock icon without needing to relaunch.

  15. Emile S

    2 days ago Europe (France, Strasbourg)

    I do not downloaded it when you [ANN] it, so without the context, it was disturbing. But, yes, this is an example.

    Fake News: who can say for sure this will happens ?
    (but a similar scenario appears on TV / Movies and the heroes wins).

    Take care all.

  16. yesterday

    Richard D

    yesterday Pre-Release Testers, Xojo Pro Europe (UK, London)

    @Tim P countdown.zip

    just download and try this and icon on the dock bounced and the show '2 days to XDC' which is 2 days ago.

or Sign Up to reply!