kevva / brightness Goto Github PK
View Code? Open in Web Editor NEWChange screen brightness
License: MIT License
Change screen brightness
License: MIT License
// @ewnd9
Is there a way to add a listener to watch brightness changing?
I'm on linux and my code as below ::
brightness.set(0.5).then(() => {
console.log('Changed brightness to o.5');
}).catch(err => {
console.log(err);
})
getting Error: No backlight device found.
Thanks in advance.
It's pains me deeply to open this issue...
It seems like http://www.nirsoft.net/utils/nircmd2.html has ability to set brightness. Not get though, but I guess set is good enough for now. Make sure to use the nircmdc
binary. You need to run it in a real Windows install, not VM.
I'm having the same problems with your library that also affects this one too. I can set the brightness, the script closes, and then 30 seconds later the OS resets the brightness back to the level it was before the script ran.
I have disabled the "Automatically adjust brightness" setting in the OSX control panel, and I don't know why else this would be occurring.
Hello. I get a crash on my system:
$ sw_vers -productVersion
10.10.3
$ node -v
v0.12.2
$ npm install -g brightness
/usr/local/bin/brightness -> /usr/local/lib/node_modules/brightness/cli.js
[email protected] /usr/local/lib/node_modules/brightness
├── [email protected]
├── [email protected]
└── [email protected] ([email protected], [email protected], [email protected], [email protected])
$ brightness --help
Change screen brightness
Example
$ brightness
$ brightness 0.8
$ brightness
/usr/local/lib/node_modules/brightness/node_modules/osx-brightness/index.js:25
var str = reg.exec(stdout)[0];
^
TypeError: Cannot read property '0' of null
at /usr/local/lib/node_modules/brightness/node_modules/osx-brightness/index.js:25:29
at ChildProcess.exithandler (child_process.js:742:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Socket.<anonymous> (child_process.js:1183:11)
at Socket.emit (events.js:107:17)
at Pipe.close (net.js:485:12)
Setting the brightness with $ brightness <number>
does indeed work.
Currently only setting the brightness is supported.
What operating systems and computers is currently supported? Can't get it to work on Windows 10 build 10166 on a Samsung utralbook.
Brightness is not changing in my Elementary OS.
would a PR with ios support be accepted to this library? I'm interested in doing that. Need it for work plus it's hacktoberfest.
Is there any way to prevent using sudo
every time I run this thing? It can be very harmful.
Since updating to macOS 10.12.4, changing the screen brightness using the following pattern leads to different/unwanted/unintended behavior:
Instead of the 2nd step changing the screen brightness starting from the level set in step 1, macOS 10.12.4 uses the brightness level from before step 1 as its starting point.
Error: Only Windows systems are supported
I think it should catch
the errors anyway.
$ brightness s
/usr/local/lib/node_modules/brightness/node_modules/osx-brightness/index.js:74
throw new TypeError('Expected a number');
^
TypeError: Expected a number
at Object.exports.set (/usr/local/lib/node_modules/brightness/node_modules/osx-brightness/index.js:74:9)
at Object.<anonymous> (/usr/local/lib/node_modules/brightness/cli.js:27:12)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Please add typescript support
declare module 'brightness' {
export function set(brightness: number): Promise<void>
export function get(): Promise<number>
}
Should implement a interactive CLI where the user can click uparrow/downarrow to adjust the brightness.
This is the error that occurs when executing on linux platform.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.