Check if the current Linux session is using Wayland
npm install is-waylandimport 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
}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.