Last active
October 29, 2020 17:18
-
-
Save tmarki/dc1ee2b48ab6f47c4fea95b9d1220187 to your computer and use it in GitHub Desktop.
Keep built-in MacBook monitor off when an external display is connected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# Keep internal Macbook monitor off when an external monitor is connected | |
# Requires https://formulae.brew.sh/formula/brightness | |
while true | |
do | |
if [[ `brightness -l 2>/dev/null|grep 'display 1'` ]] | |
then | |
if [[ -z `brightness -l 2>/dev/null|grep 'display 1: brightness 0.000000'` ]] | |
then | |
brightness -d 1 0 | |
fi | |
fi | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added condition to prevent unnecessary setting of brightness when not needed.