isheadless

package module
v0.0.0-...-cbcc774 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2018 License: LGPL-3.0 Imports: 1 Imported by: 1

README

IsHeadless

This little Go package provides a function isheadless.IsHeadless() bool. This function tells whether the Go program is running in a headless environment.

Examples

On Windows, isheadless.IsHeadless() always returns false. (Note that this is not correct as it ignores the edge case of running on Windows 10 IoT Core headless.)

On all other systems, isHeadless.IsHeadless() returns false if an environment variable named DISPLAY exists. The behavior is the same as with Java's java.awt.GraphicsEnvironment.isHeadless(). That is:

  • If DISPLAY is unset or set but empty, IsHeadless() returns true.
  • If DISPLAY is set and non-empty, IsHeadless() returns false.

Limitations

  • Currently, this function always returns false on Windows. The fact that Windows 10 IoT Core can be headless is ignored and unsupported.
  • Currently, this function does not support Android. On Android, it will always return true, no matter whether this is headless Android or "normal" Android.
  • Currently, this function always inspects the DISPLAY variable on all other operating systems, assuming X11 or an equivalent. This is wrong on those operating systems which provide a UI through means independent of a DISPLAY environment variable.

Documentation

Overview

Package isheadless provides a function to find out whether the environment of the process is headless.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsHeadless

func IsHeadless() bool

IsHeadless returns whether or not the environment of the current process is headless. That is, whether or not a display, keyboard, and mouse can be supported in this environment.

Types

This section is empty.

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL