Node.js module to configure basic system parameters (brightness and audio).
npm install system-control
# Based on the os, install corresponding peer dependencies
# For Windows users,
npm install win-audio
# For Unix users,
npm install loudness
const { audio } = require('system-control');
audio.volume().then(volume => console.log(volume)) // get system volume
audio.volume(80)
.then(() => console.log('volume changed')) // set system volume
.catch((err) => console.error(err));
import { audio } from 'system-control';
(async () => {
const volume = await audio.volume() // get system volume
try {
await audio.volume(80) // set system volume
console.log(`volume changed from ${volume} to 80`)
} catch (e) {
console.error(e);
}
})()
value
: number | undefined
await audio.volume(10) // set volume
await audio.volume() // get volume
value
: boolean | undefined
await audio.muted(true) // set muted
await audio.muted() // get muted
value
: number | undefined
await display.brightness(10) // set brightness
await display.brightness() // get brightness