function updateBrightness(rootItem, source) { if (rootItem.updateScreenBrightnessJob) return; if (!source.data["PowerDevil"]) { return; } // we don't want passive brightness change send setBrightness call rootItem.disableBrightnessUpdate = true; if (typeof source.data["PowerDevil"]["Screen Brightness"] === 'number') { rootItem.screenBrightness = source.data["PowerDevil"]["Screen Brightness"]; } rootItem.disableBrightnessUpdate = false; }