Skip to content

Instantly share code, notes, and snippets.

@lgrachov
Created July 8, 2024 21:30
Show Gist options
  • Save lgrachov/1cc2bb7f840786252af150994913fac0 to your computer and use it in GitHub Desktop.
Save lgrachov/1cc2bb7f840786252af150994913fac0 to your computer and use it in GitHub Desktop.
Toggle screenshot shadow on macOS

Toggle screenshot shadow

This is a simple Bash script I made to toggle the screenshot shadow on Mac computers.

Requirements

Bash 2 or later macOS Mojave 10.14.0 or later

Usage

To toggle, just run the script. If it says access denied, run this command:

# You must be in the folder where you downloaded the .sh file
$ chmod +x toggleScreenshotShadow.sh
# Then run the file like this
$ ./toggleScreenshotShadow

Difference

Images from macOS defaults

With shadow:

Screenshot with shadow

Without shadow:

Screenshot without shadow

Notice how the image has scaled up? The image is scaled because the shadow taking up the pixels has been removed.

#!/bin/bash
SHADOWVAL=`defaults read com.apple.screencapture "disable-shadow"`
if [ $SHADOWVAL = '0' ]; then
defaults write com.apple.screencapture "disable-shadow" -bool "true"
echo "Screenshot shadow is on"
else
defaults write com.apple.screencapture "disable-shadow" -bool "false"
echo "Screenshot shadow is off"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment