[squeak-dev] what's the standard way of finding out from Smalltalk if one is running headless?

Igor Stasenko siguctua at gmail.com
Wed Aug 31 16:40:10 UTC 2011

On 31 August 2011 18:28, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> I thought to test things like Display extent & DisplayScreen
> actualScreenDepth but these either fall back to values in the pre-headless
> image or don't fail and answer the actual display depth, even though the VM
> is running headless (at least on Mac they do).

ahaa! you seem to be facing same problems as we had :)

Nothing. I found no reliable way to detect that image are running
headless, there is no VM api for exposing that. And this is sad.

The way how pharo images detecting it currently is to check a
command-line arguments passed to VM.
SmalltalkImage isHeadless
in pharo 1.3 - 1.4 images.

it is ugly, but i think this is better than detecting via Display,
because its more direct.

We should fix that.
either by adding a new primitive , or adding new system attribute..

But my personal preference is to let image control the headless mode,
i.e. instead of making VM decide whether image should be forced to run
headless or not,
an image should check a command line,
and then instruct VM to create a window or not.
This IMO would be the best solution to the problem. VM should provide
access to features and/or facilities, and image should decide whether
use them or not.

Even if VM decides to not allow UI, then it should report to an image
that given facility is not available, and play with it in nice manner,
but not like today when image has no idea what happens
and leaving it without any clues in what environment it running.

Best regards,
Igor Stasenko AKA sig.

More information about the Squeak-dev mailing list