App like menu item

Hi!

I don’t know how to ask this…

I want to create a “invisible” application, that implements an item on menu bar.

Like “date and time”, like “dropbox”, like “wi-fi”, etc…

Is it possible to do this with xojo?

How?

Alex

I think this may help:
https://forum.xojo.com/48251-mac-menubar-apps

You can do that.
Check NSStatusItemMBS class in our MBS Xojo Cocoa Plugins and later mark your app to be invisible.

Set the LSUIElement key in your app’s Info.plist to YES and then check a user default at launch to determine if your app should be running as an agent.

Until Xojo offers us a way to edit the plist for our apps, you will need to do this step manually.

You can run a build script on each build with this code:

Dim App As String = CurrentBuildLocation + "/" + CurrentBuildAppName + ".app" Call DoShellCommand("/usr/bin/defaults write " + App + "/Contents/Info ""LSUIElement"" YES")

Half-manually. You have to create an Info.plist that contains your additional values manually. Add that to your project and it gets included/merged when building your app. See Using a plist.
The documentation is not quite good on that… if you want to see an example with a customization in Info.plist (to include custom fonts): Custom AppFonts
And I remember others doing this with a PostBuild Script (which edits the Info.plist) - the downside of that is that it only works when building on macOS. Adding an Info.plist to your project works on all Targets you’re building the macOS app.

I understand and do that for my status bar apps, but wasn’t trying to go that deep into the process of manipulating the Non Release Version property in a scenario where you track those things. I use a BuildAutomation script that calls out to sed and adds the LSUIElement key to the existing plist provided by Xojo during the build.

You can use App Wrapper to edit the plist, coupled with a build script so it can be applied for debug builds (along with Sandboxing and such).

Agreed @Sam Rowlands - but I’d created the Build Script long before I started using App Wrapper :).

XCode (and it is not alone) is able to do that.

BTW: how large in RAM is a Xojo application nowaday ?

Two of my LSUIElement apps are 11MB and 14MB. My largest is 103MB, but it has a glut of pre-compiled AppleScript files included and hasn’t been thinned or recompiled as Cocoa.

Any other way without MBS plugins?

Xcode

The MacOSLib package has the declares and info.

macoslib repository

Where can i ask for new functionality on xojo? Feedback?

I wouldn’t hold your breath on this one, Xojo has been ignoring it for 10 years as of April.
<https://xojo.com/issue/1792>

That was started in the original REALbasic bug reporting and even predates fogbugz. :open_mouth:

hahahaha

[quote=393554:@Tim Jones]The MacOSLib package has the declares and info.

macoslib repository[/quote]

Excellent!!

I’m testing it…

The NSStatusItem does not run on 64bit?