Skip to content

Instantly share code, notes, and snippets.

@kigster
Last active April 25, 2022 17:32
Show Gist options
  • Save kigster/7ce9e879883cf4899fa0de94a57dfaf0 to your computer and use it in GitHub Desktop.
Save kigster/7ce9e879883cf4899fa0de94a57dfaf0 to your computer and use it in GitHub Desktop.
This shell script walks you through the steps required to change the monitor underscan or overscan value on OS-X, when the Display Preferences are not providing the underscan/overscan slider for a given display. This process was documented by Ishan Sharma here: http://ishan.co/external-monitor-underscan and is a part of BashMatic library.
#!/usr/bin/env bash
#
# Script to change underscan/overscan value of a monitor on OS-X.
# © 2016-2019 Konstantin Gredeskoul, distributed under the MIT License.
#
#———————————————————————————————————————————————————————————————————————————————————————————
# EXCEPT AS REPRESENTED IN THIS AGREEMENT, ALL WORK PRODUCT BY DEVELOPER IS PROVIDED "AS IS".
# OTHER THAN AS PROVIDED IN THIS AGREEMENT, DEVELOPER MAKES NO OTHER WARRANTIES, EXPRESS OR
# IMPLIED, AND HEREBY DISCLAIMS ALL IMPLIED WARRANTIES, INCLUDING ANY WARRANTY OF
# MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE.
#———————————————————————————————————————————————————————————————————————————————————————————
#
# How to run this script?
# 1. Open Terminal application (/Applications/Utilities/Terminal.app)
#
# 2. Decide if you want to reduce (negative) or increase (positive) screen size.
# You should think of a number of percentage points to change it by, for example
# it could be -5 (for underscan) or 5 for overscan.
#
# 3. Set the following variable to this number by pasting the following, and changing the value:
#
# export SCAN_CHANGE_PERCENT=5 # overscan, change 5 to -5 for underscan
#
# 3. Copy and paste the following commands:
#
# curl -fsSL http://bit.ly/change-underscan-osx > ./change-underscan
# chmod 755 ./change-underscan
# ./change-underscan ${SCAN_CHANGE_PERCENT}
#
# 4. You can also run it as:
#
# ./change-underscan 5
#
# 5. Follow the prompts and perform actions asked by the script.
#
# 6. Enjoy being able to see Mac OSX top menu and your dock :)
curl -fsSL http://bit.ly/bashmatic-bootstrap | /usr/bin/env bash
if [[ -d ~/.bashmatic ]]; then
source ~/.bashmatic/init.sh
change-underscan "$1"
else
echo "The script $0 was installed correctly, however underlying library"
echo "was not. Please install it by running the following:"
echo
echo " cd ~/"
echo " curl -so bashmatic.zip https://codeload.github.com/kigster/bashmatic/zip/master"
echo " unzip bashmatic.zip && mv bashmatic-master ~/.bashmatic"
echo
echo "After that, re-run this script."
fi
@shaizaa
Copy link

shaizaa commented Dec 3, 2020

@kigster - Is there a way to use this script for the built in display? My laptop fell and the display cracked slightly. I am not able to use about an inch of space on the right side of my monitor and would love to be able to use a modified version of this script to edit the built in display size.

@beegeesquare
Copy link

I'm trying to run the script and it is getting stuck, not matter how long I wait it is not proceeding any further. Can you provide some insight as to what could be the problem?

./change-underscan 5
✓   WARNING: This script is now deprecated and will be removed eventually.
✓            Please use the following to install Bashmatic moving forward:
✓            bash -c "$(curl -fsSL https://bashmatic.re1.re); bashmatic-install -v"
Already on 'master'

  « SUCCESS »    ✔  Your BashMatic has been successfully installed.

^C
ruby:1:in initialize: Interrupt

@fdominguezclaro
Copy link

Thank you @kigster! Worked perfectly on MacOS 11.5.1

@pedro-espinosa
Copy link

I have the exact same issue as @itsazzad

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