SebastianSchmidt/node-gsettings-wrapper

Wrapper around the gsettings command line tool.

★ 3Forks 0JavaScriptGitHub ↗Compare

README

node-gsettings-wrapper

NPM version Build Status Coverage Status

Wrapper around the gsettings command line tool.

Installation

npm install node-gsettings-wrapper --save

Basic Usage

const GSettings = require("node-gsettings-wrapper");

// Check if GSettings is available:
if (!GSettings.isAvailable()) {
  console.log("The gsettings command line tool is not available.");
  process.exit(1);
}

// Get a schema by ID:
const schema = GSettings.Schema.findById("org.gnome.desktop.interface");

// Get a key of a schema by ID:
let animationsKey = schema.findKeyById("enable-animations");

// Other way to get a key:
animationsKey = GSettings.Key.findById(
        "org.gnome.desktop.interface", "enable-animations");

// Display the value of a key:
console.log("enable-animations: " + animationsKey.getValue());

// Monitor a key for value changes:
const removeKeyListener = animationsKey.addListener((key, value) => {
  console.log("New value: " + value);
});

// Terminate key monitoring after 5 seconds:
setTimeout(removeKeyListener, 5000);

Read the API documentation.

Documentation

Contributors

SebastianSchmidt

Issues