Neutralino.computer
Neutralino.computer namespace contains methods related to the user's hardware.
computer.getMemoryInfo()
Returns system memory statistics in bytes.
Return Object (awaited):
physicalObject: Physical memory information.totalNumber: Total physical memory.availableNumber: Available physical memory.
virtualObject: Virtual memory information.totalNumber: Total virtual memory.availableNumber: Available virtual memory.
let memoryInfo = await Neutralino.computer.getMemoryInfo();
console.log(`RAM size: ${memoryInfo.physical.total}B`);
computer.getArch()
Returns the CPU architecture identifier: x64 (x86 64bit/arm64), ia32 (x86 32bit), arm, itanium,
or unknown.
Return String (awaited):
CPU architecture.
let arch = await Neutralino.computer.getArch();
console.log(arch);
computer.getKernelInfo()
Returns operating system kernel information.
Return Object (awaited):
variantString: Kernel type:Linux,Darwin,Windows NT, orUnknown.versionString: Version in the<major>.<minor>.<patch>-<build_number>format.
let kernelInfo = await Neutralino.computer.getKernelInfo();
console.log(`Kernel: ${kernelInfo.variant}`);
computer.getOSInfo()
Returns operating system information.
Return Object (awaited):
nameString: Operating system name.descriptionString: Operating system description.versionString: Version in the<major>.<minor>.<patch>-<build_number>format.
let osInfo = await Neutralino.computer.getOSInfo();
console.log(`OS: ${osInfo.name}`);
computer.getCPUInfo()
Returns the CPU information.
Return Object (awaited):
vendorString: Vendor name.modelString: Model name.frequencyNumber: The current CPU frequency in hertz (Hz).architectureString: CPU architecture name. Returns the same value as thegetArchfunction.logicalThreadsNumber: Number of logical threads in the parallelism model.physicalCoresNumber: Number of physical cores in the CPU.physicalUnitsNumber: Number of physical CPU hardware units in the motherboard.
let cpuInfo = await Neutralino.computer.getCPUInfo();
console.log(`CPU model: ${cpuInfo.model}`);
computer.getDisplays()
Returns information about all connected displays.
Return Object (awaited):
An array of Display objects.
Display
idNumber: A virtual display identifier.resolutionObject: Display resolution information.widthNumber: Display width.heightNumber: Display height.
dpiNumber: DPI (Dots Per Inch) value.bppNumber: BPP (Bits Per Pixel) value (also known as the color depth).refreshRateNumber: Refresh rate in hertz (Hz).
let displays = await Neutralino.computer.getDisplays();
for(let display of displays) {
console.log(display);
}
computer.getMousePosition()
Returns the current mouse cursor position.
Return Object (awaited):
xNumber: Distance from the left edge of the screen in pixels.yNumber: Distance from the top edge of the screen in pixels.
let pos = await Neutralino.computer.getMousePosition();
console.log(`Pos: ${pos.x}, ${pos.y}`);
computer.setMousePosition(x, y)
Updates the current mouse cursor position. Throws NE_CO_UNLTOSC if cursor position update is not implemented (e.g., on Wayland) or fails.
Parameters
xNumber: Distance from the left edge of the screen in pixels.yNumber: Distance from the top edge of the screen in pixels.
await Neutralino.computer.setMousePosition(50, 60);
computer.setMouseGrabbing(grabbing)
Activates or deactivates confining mouse cursor within the app window region. Throws NE_CO_UNLTOMG if mouse grabbing is not implemented (e.g., on Wayland) or fails.
Parameters
grabbingBoolean: Mouse grabbing state. Activates iftrueand deactivates iffalse.
await Neutralino.computer.setMouseGrabbing(true);
computer.sendKey(key, state)
Simulates a key press, down, or up event. Throws NE_CO_UNLTOSK if keyboard simulation is not implemented (e.g., on Wayland) or fails.
Parameters
keyNumber: Platform-specific key code. e.g., 38 refers to the letter 'a' on Linux (X11)stateString (optional): Keyboard button state. Accepted values:press,down, andup. The default value ispress.
// Simulate letter 'a' press on GNU/Linux (X11):
await Neutralino.computer.sendKey(38)
// Simulate Ctrl + V keyboard shortcut on GNU/Linux (X11):
await Neutralino.computer.sendKey(105, 'down') // Hold right control
await Neutralino.computer.sendKey(55, 'down') // Hold letter 'v'
await Neutralino.computer.sendKey(55, 'up') // Release letter 'v'
await Neutralino.computer.sendKey(105, 'up') // Release right control