diff options
| author | srdusr <trevorgray@srdusr.com> | 2024-01-29 23:59:59 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2024-01-29 23:59:59 +0200 |
| commit | 1c38dbe55a79c9eeaccf0c1ee8d1adaabb7c0039 (patch) | |
| tree | 092a6dbe4811172678fb2446d1b03e34e7ebe481 | |
| parent | 0512f913476757b6a4a866b569ccf97259c8ac1f (diff) | |
| download | dotfiles-1c38dbe55a79c9eeaccf0c1ee8d1adaabb7c0039.tar.gz dotfiles-1c38dbe55a79c9eeaccf0c1ee8d1adaabb7c0039.zip | |
Add xob manage-brightness
| -rwxr-xr-x | .config/xob/manage-brightness | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/.config/xob/manage-brightness b/.config/xob/manage-brightness new file mode 100755 index 0000000..496900f --- /dev/null +++ b/.config/xob/manage-brightness @@ -0,0 +1,16 @@ +#!/bin/node + +const fs = require('fs') +const { exec } = require("child_process"); + +let device = "intel_backlight"; + +brightnessFile = `/sys/class/backlight/${device}/brightness`; +maxBrightnessFile = `/sys/class/backlight/${device}/max_brightness`; + +maxValue = parseInt(fs.readFileSync(maxBrightnessFile, 'utf8')); + +fs.watch(brightnessFile, () => { + value = parseInt(fs.readFileSync(brightnessFile, 'utf8')); + console.log(Math.round(value / maxValue * 100)); +}) |
