Search code examples
c#monocross-platformscreensaver

How does screen savers work on Mac OS X and Linux?


In Windows a screen saver is just an executable with a .scr extension dumped in the system32, and it is controlled with three switches (/p, /c and /s, I think).

How does screen savers work on Mac OS X and Linux? Do they work similarly in Mac OS X and Linux (Gnome, KDE, Ubuntu, or wherever the difference is) or is it completely different?

Also, can they be developed in C#/Mono?


Solution

  • The screensaver system in OSX is that a screensaver (typically, but not necessarily) is an Objective-C library, extending a base class to implement methods such as drawing, a preference pane, a preview mode and so on.

    There is a good tutorial on writing them here.

    While Objective-C is the language expected, it is straightforward enough to couple together a C/C++ implementation behind the Objective-C API.

    There is an API (a bridge) to allow other languages to inter-operate with Objective-C APIs. This is used, for example, here to allow OSX screen savers written in Python. I imagine a similar approach is feasible for Mono.

    xscreensaver is now developed mostly on OSX, and uses the OSX screensaver API there and something else on X11.