pirate / mac-keyboard-brightness Goto Github PK
View Code? Open in Web Editor NEWπ Programmatically get & set the keyboard & display backlight brightness on Macs. Flash your keyboard to the music! (only works on <2015 Macs)
License: MIT License
π Programmatically get & set the keyboard & display backlight brightness on Macs. Flash your keyboard to the music! (only works on <2015 Macs)
License: MIT License
I found that the answer posted here works well https://stackoverflow.com/a/39589275
(Happy to submit a pull request if you like)
I set the keyboard brightness to 0
./kbrightness 0
Press the power button to sleep, wake the mac up and then I get 100% brightness for keyboard.
Is this a desirable behavior? How to set key brightness permanently?
M1 Max 16" MBP
Ok, I was running the audio.py
file and got this...
$ python3 audio.py
[+] Starting...
Traceback (most recent call last):
File "audio.py", line 46, in <module>
runloop(stream)
File "audio.py", line 35, in runloop
data = stream.read(CHUNK)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyaudio.py", line 608, in read
return pa.read_stream(self._stream, num_frames, exception_on_overflow)
OSError: [Errno -9981] Input overflowed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "audio.py", line 48, in <module>
stream.stop_stream()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyaudio.py", line 524, in stop_stream
pa.stop_stream(self._stream)
OSError: Stream not open
Love this utility. Currently blinking along to Days of the New.
I had not previously installed many python libs so the README.md step was not enough to get audio.py to run.
Error:
$ pip3 install --upgrade pyaudio audioop
Collecting pyaudio
Downloading PyAudio-0.2.11.tar.gz
Collecting audioop
Could not find a version that satisfies the requirement audioop (from versions: )
No matching distribution found for audioop
Fix:
brew install python3
brew install portaudio
pip3 install pyaudio
Then like the README says:
python3 audio.py
Refs:
https://stackoverflow.com/questions/31236194/installing-pyaudio-for-python3-on-osx
macOS sierra version: 10.12.5 (16F73)
mbp 15-in, 2016
Display controls work fine but keyboard read and write operations fail:
$ ./dbrightness
0.650391
$ ./dbrightness .8
$ ./kbrightness
getLightSensors() error: failed to find ambient light sensor
getKeyboardBrightness() error
0.000000
$ ./kbrightness 1.0
getLightSensors() error: failed to find ambient light sensor
setKeyboardBrightness() error
I will update with more info when I have some time to debug this evening (and will pr if I find the issue).
[+] Starting...
Traceback (most recent call last):
File "audio.py", line 46, in
runloop(stream)
File "audio.py", line 35, in runloop
data = stream.read(CHUNK)
File "/usr/local/lib/python3.6/site-packages/pyaudio.py", line 608, in read
return pa.read_stream(self._stream, num_frames, exception_on_overflow)
OSError: [Errno -9981] Input overflowed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "audio.py", line 48, in
stream.stop_stream()
File "/usr/local/lib/python3.6/site-packages/pyaudio.py", line 524, in stop_stream
pa.stop_stream(self._stream)
OSError: Stream not open
did git clone, and can't get kbrightness to work. it always gives this error
Failed to connect to AppleLMUController getKeyboardBrightness() error
OS X High Sierra 10.13.4 (17E199) [or is called macOS High Sierra now?]
Model Name: MacBook Pro
Model Identifier: MacBookPro14,3
Processor Name: Intel Core i7
Processor Speed: 3.1 GHz
Number of Processors: 1
Total Number of Cores: 4
L2 Cache (per Core): 256 KB
L3 Cache: 8 MB
Memory: 16 GB
Boot ROM Version: MBP143.0175.B00
SMC Version (system): 2.45f0
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.