@cjser/is-wayland
v0.1.0-cjser.2
Published
Check if the current Linux session is using Wayland
Downloads
24
Maintainers
Readme
is-wayland
Check if the current Linux session is using Wayland
Install
npm install is-waylandUsage
import isWayland from 'is-wayland';
if (isWayland()) {
console.log('Running in Wayland');
// Use wl-clipboard tools
} else {
console.log('Not running in Wayland');
// Use X11 tools
}How it works
The package detects Wayland sessions by checking:
WAYLAND_DISPLAYenvironment variable - The primary indicator set by Wayland compositorsXDG_SESSION_TYPEenvironment variable - Set by display managers to indicate session type
Returns false on non-Linux platforms.
Related
- is-docker - Check if the process is running inside a Docker container
- is-wsl - Check if the process is running inside Windows Subsystem for Linux
cjser
This package is a CommonJS-compatible build generated by cjser for projects that still need require() support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.
Original repository: https://github.com/sindresorhus/is-wayland
