"write text" on the desktop/wallpaper

Is there any way to “write text” on the desktop/wallpaper? A kind of drawing dynamic information on it …
If not, then I could use a window and write text into that, but how to make that window always attached to the desktop (like the backmost [opposite to the frontmost] window) ?
Any idea?
Thanks !
Luciano

Something like this:

Place an OverlayMBS at the right level.

See example

1 Like

This will always draw a window at the desktop level if you want to go that route.

self.NSWindowMBS.Level = -20

Thanks a lot to both.
Unfortunately I do not have the Monkeybread Extensions.
Any alternative ?

Not built-in, but you can do all of this with declares and plist entries.

This may help:

Thanks !
But when I try to open the “macoslib.xojo_project” everything crashes. I am not sure it is due to the versions of Xojo I am using (Xojo 2022 Release 2) or the system (12.6).

When you say everything crashes do you mean the IDE. Or are you talking about the example application crashing when run.

If it is the latter, there is currently a bug in the preferences module of macoslib that causes it to crash if it finds a preference file for the project and tries to read it. Deleting the preferences file allows the project to run, but it then re-creates the preference file. Meaning it will crash the next time, over and over.

macOSlib it’s self is a module which can be added to your own applications and used without this issue. Obviously the example project is pretty vital in demonstrating how to used it.

I think the file you have to delete to get the project to run is:

~/Library/Preferences/com.declaresub.macoslib.plist

I did as suggested and still when I “run” the project it crashes, but the IDE survive.
I then went step-by-step and found that when during the initialisations it calls:

TestCarbon
TestCoreFoundation
TestCocoa ' call this only after TestCoreFoundation because it relies on prefs settings from the former call!
TestATSFont
TestCertTools

At the last step (= TestCertTools) it crashes.
and within the “TestCertTools”, it crashes when arrives to
“dim p7 as Ptr = d2i_PKCS7_fp (fp, nil)”

If I inactivate the " TestCertTools", then everything else is OK, meaning I can “run” the “macoslib.xojo_project”

I id some testing and it seems basically to work without plugin.
Just a new project with a Desktop Window (containing colored canvases and a label in my test).
Adjust the Window Properties:
No Close, Maximize, Minimize, and Fullscreen button Button
Not Resizable
Has BackgroundColor ON

In the opening Event put following code

Soft Declare Function CGWindowLevelForKey Lib "AppKit" (key As Integer) As Integer
Soft Declare Sub setLevel Lib "AppKit" Selector "setLevel:" (id As Ptr, level As Int32)
Soft Declare Sub setStyleMask Lib "AppKit" Selector "setStyleMask:" (id As Ptr, mask As UInt32)

Const kCGDesktopWindowLevelKey    = 2
Const NSWindowStyleMaskBorderless = 0
Const NSColor_clearColor = &c000000FF

Self.BackgroundColor = NSColor_clearColor
setLevel(Self.Handle, CGWindowLevelForKey(kCGDesktopWindowLevelKey))
setStyleMask(Self.Handle, NSWindowStyleMaskBorderless)

It seems to work basically and perhaps it is a good start.
Please share your findings and improvements.

1 Like

This is awesome!!!
Exactly what I was looking for!!!
Thanks a lot.