• This repository has been archived on 02/Feb/2024
  • Stars
    star
    217
  • Rank 178,706 (Top 4 %)
  • Language
    C
  • License
    MIT License
  • Created about 7 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ”† Programmatically get & set the keyboard & display backlight brightness on Macs. Flash your keyboard to the music! (only works on <2015 Macs)

Control Mac Keyboard Brightness: kbrightness & dbrightness

Programmatically flash the keyboard lights and control display brightness on Macs. You can flash them to the beat of music, or use it for alerts and notifications.

This was inspired by @tcr's repo. This is also an alternative to the old iSpazz iTunes plugin, which no longer works. I had trouble finding any other easy-to-use binary for controlling keyboard brightness, so I made one.

Flashing keyboard gif Flashing display gif

Usage

  • blink is a shortcut to flash the keyboard lights [n] times for [t] seconds each time
  • kbrightness manages the keyboard backlight brightness
  • dbrightness manages the display backlight brightness
  • python3 audio.py flash the keyboard based on the audio input from your mic, makes it flash to the beat of music

Use blink in your shell scripts to alert you when things have succeeded or failed. e.g. wget https://example.com/large-file.mp4 && blink 2 or ./tests.py || blink 3 1

git clone https://github.com/pirate/mac-keyboard-brightness
cd mac-keyboard-brightness/

./kbrightness          # gets current keyboard brightness
# 0.286447
./kbrightness 0.85     # sets keyboard brightness to 85%

./dbrightness          # gets current display brightness
# 0.938477
./dbrightness 0.42     # sets display brightness to 42%
=======

./blink                # flash the keyboard lights once (good for subtle alerts, e.g. git pull && blink 2)
./blink 2              # flash the keyboard lights twice
./blink 10 0.1         # flash the keyboard lights 10 times, for 0.1 seconds each time
./blink 1000 0.01      # turn your keyboard into a disco strobe

=======

# Flash your keyboard to the beat of the music! (uses mic input)
brew install python3 pyaudio portaudio
pip3 install --upgrade pyaudio audioop
python3 audio.py

You should be able to download the repo and use the binaries without needing to recompile anything (tested on macOS Sierra, High Sierra, and Mojave).

Why?

It's fun. Here are some ideas:

  • make a bitbar menubar app to control keyboard brightness
  • make your keyboard lights flash for security alerts using Security Growler
  • make your keyboard flash right before your display is about to sleep
  • make your keyboard flash on incoming email
  • make your keyboard flash to the beat of music
  • make your keyboard flash when your boss's iPhone comes within bluetooth range

Advanced

If you want to write more advanced programs to update the brightness at higher frequencies (e.g. to make your keyboard flash to music), you can use the C functions directly.

  • setDisplayBrightness, getDisplayBrightness
  • setKeyboardBrightness, getKeyboardBrightness
  • getLightSensors: get ambient light sensor values, see @tcr's original repo

Compile each file individually with:

gcc -std=c99 -o kbrightness keyboard-brightness.c -framework IOKit -framework ApplicationServices
# OR
gcc -std=c99 -o dbrightness display-brightness.c -framework IOKit -framework ApplicationServices

Links

More Repositories

1

wireguard-docs

πŸ“– Unofficial WireGuard Documentation: Setup, Usage, Configuration, and full example setups for VPNs supporting both servers & roaming clients.
Shell
4,398
star
2

sites-using-cloudflare

πŸ’” Archived list of domains using Cloudflare DNS at the time of the CloudBleed announcement.
1,911
star
3

security-growler

πŸ“‘ A Mac menubar app that notifies you whenever SSH, VNC, sudo, or other auth events occur.
Python
857
star
4

crypto-trader

πŸ’° Cryptocurrency trading bot library with a simple example strategy (trading via Gemini).
Python
608
star
5

mesh-networking

🌐 LEGO blocks for networking, a Python library to help create and test flexible network topologies across real and simulated physical links.
JavaScript
356
star
6

wikipedia-mirror

🌐 Guide and tools to run a full offline mirror of Wikipedia.org with three different approaches: Nginx caching proxy, Kiwix + ZIM dump, and MediaWiki/XOWA + XML dump
Shell
331
star
7

WebRTCChat

πŸ” Pure Browser To Browser Chat (STUN & ICE Servers optional)
JavaScript
254
star
8

bash-utils

A collection of hand-crafted bash scripts for various common tasks.
Shell
209
star
9

fish-utils

πŸ”§ My utility belt of fish functions, writing these has saved me many hours in the long run... I hope...
Shell
135
star
10

spellchecker

πŸ“– A spell-checker extending Peter Norvig's with multi-typo correction, hamming distance weighting, and more.
Python
96
star
11

mesh-botnet

🐍 Proof-of-concept python IRC botnet for orchestrating macOS computers (harmless due to SIP & Gatekeeper)
Python
84
star
12

django-http2-middleware

⚑️Django middleware to automatically send preload headers before views runs, enabling faster HTTP2 server-push (with CSP support).
Python
67
star
13

django-concurrency-talk

🎭 Database Integrity in Django: Safely Handling Critical Data in Distributed Systems
JavaScript
53
star
14

internet-archiving-talk

🎭 An introduction to the Internet Archiving ecosystem, tooling, and some of the ethical dilemmas that the community faces.
JavaScript
47
star
15

gzint

βœ‚οΈ A python3 library for efficiently storing massive integers (stands for gzipped-integer).
Python
41
star
16

macOS-global-autocomplete

πŸ“ƒ System-wide autocompleting that learns what you type and works in any app! (also slightly scary maybe don't use this...)
C
40
star
17

quebec-power-grid-talk

🎭 Quebec's 735kv power lines can survive the apocalypse, but can they run TCP?!
JavaScript
33
star
18

Cpp-Data-Structures

πŸ“ C++ Implementations of data structures & algorithms from PSU course CS162/CS163
C++
23
star
19

nicksweeting.com

πŸ’» The code for my website, including the game of life and other easter eggs.
HTML
18
star
20

500.html

A nice 500.html page template to use in django/jinja2 projects.
HTML
9
star
21

experiments

✨ Random (sometimes xkcd-inspired) Python, Haskell, and JS experiments involving data science and algorithm fun.
Python
9
star
22

inject-luxinate

πŸ’‰ Inject download buttons into web pages that Luxinate is capable of downloading songs from.
Python
7
star
23

StoryCoin

A proof-of-work blockchain that grows organically as participants add lines to a shared story.
Rust
7
star
24

txmoderna.com

Moderna's domain name is modernatx, not txmoderna
HTML
5
star
25

china-vpn

πŸ€„ Wordpress site which powers my free VPN service (with extras)
PHP
5
star
26

music-bot

♬ A facebook messenger bot that listens for music links in chats and converts them to Apple Music IDs.
JavaScript
4
star
27

bond

Bond - the spy agent
Clojure
4
star
28

squasher-browser-extension

Extension to collect all open browser tabs for a given domain into a new window (with suspender support).
JavaScript
4
star
29

pirate.github.io

Nothing to see here.
HTML
3
star
30

docker.hera

Setup for the Hera Cloudflare Argo Tunnel manager for Docker
3
star
31

throws

❗ Proposal for a new 'throws' keyword in python.
Python
3
star
32

archivebox-codespace

Codespace scratchpad for working on ArchiveBox development
EJS
2
star
33

meshnet

MeshNet
Java
2
star
34

Violent-Python

Code that I adapted from the "Violent Python" book
HTML
2
star
35

stdeb

produce Debian packages from Python packages
Python
2
star
36

stevesweeting

🎢 Steve Sweeting Music
CSS
1
star
37

Lidarr

Looks and smells like Sonarr but made for music.
C#
1
star
38

official-images

Primary source of truth for the Docker "Official Images" program
Shell
1
star