Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@jneuendorf

This comment has been minimized.

Copy link

commented Jan 17, 2019

This is REALLY awesome! Thank you soo much ❤️ 😄

@HashBah

This comment has been minimized.

Copy link

commented Jan 17, 2019

How do I open it properly? i downloaded it and tried to drag adn to open it manuaelly with terminal but nothing seem to work. it just gives says session finished.

@chestertc

This comment has been minimized.

Copy link

commented Mar 2, 2019

Managed to fix the problem in two iterations! Really awesome! Thank you so much!!

@nativeman2

This comment has been minimized.

Copy link

commented Aug 30, 2019

(tears in my eyes)
This script is awesome.

@kigster

This comment has been minimized.

Copy link
Owner Author

commented Sep 4, 2019

How do I open it properly? i downloaded it and tried to drag adn to open it manuaelly with terminal but nothing seem to work. it just gives says session finished.

How to Run This Script

  1. Open Terminal application
  2. Paste the following code, setting SCAN_PERCENT to the percentage desired. Less than 100 is underscan, more than 100 is overscan.
SCAN_PERCENT=100
curl -fsSL http://bit.ly/fix-underscan > /tmp/fmu; bash /tmp/fmu ${SCAN_PERCENT}
@kigster

This comment has been minimized.

Copy link
Owner Author

commented Sep 4, 2019

(tears in my eyes)
This script is awesome.

❤️

@kigster

This comment has been minimized.

Copy link
Owner Author

commented Sep 18, 2019

Please note — the script now lives as a part of bashmatic library and therefore installs it into ~/.bashmatic.

@ianvoyager

This comment has been minimized.

Copy link

commented Sep 25, 2019

Hi kirsten, I have attempted to use your script many times however I simply cannot get it to work on my Mac Mini running 10.14.6 in regards to setting / resetting the overscan and under scan issues when connected to my TV via HDMI cable.

I have taken some screen shots of the errors or screens I get in terminal; here is the link.

Thanks in advance!

@kigster

This comment has been minimized.

Copy link
Owner Author

commented Sep 25, 2019

Yes, I can see the error thanks for posting images.

In the second screen shot you have ${10} as the last argument. Change that to just 10 and it should work.

I apologize as I’m working on bashmatic framework now and may have introduced breaking bugs, so email your screen shots to kigster AT gmail.com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.