Skip to content

Instantly share code, notes, and snippets.

@tmarki
Last active October 29, 2020 17:18
Show Gist options
  • Save tmarki/dc1ee2b48ab6f47c4fea95b9d1220187 to your computer and use it in GitHub Desktop.
Save tmarki/dc1ee2b48ab6f47c4fea95b9d1220187 to your computer and use it in GitHub Desktop.
Keep built-in MacBook monitor off when an external display is connected
#!/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
@tmarki
Copy link
Author

tmarki commented Oct 29, 2020

Added condition to prevent unnecessary setting of brightness when not needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment