Skip to content

Instantly share code, notes, and snippets.

@soutar
Last active August 29, 2015 14:06
Show Gist options
  • Save soutar/593a927aab9b1be6249b to your computer and use it in GitHub Desktop.
Save soutar/593a927aab9b1be6249b to your computer and use it in GitHub Desktop.
Add x spacers to your Dock in Mac OS X (./add_spacer.sh x)
#!/bin/bash
function add_spacer {
[[ $1 =~ ^[0-9]+$ ]] && times=$1 || times=1
echo "Adding $times spacer(s)"
i=0;
while [[ $i -lt $times ]]; do
defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'
((i++))
done
echo "Killing Dock..."
sleep 2 # Wait for something or other or the spacers won't appear
killall Dock
}
add_spacer $1
@soutar
Copy link
Author

soutar commented Sep 22, 2014

Installation instructions:

  • git clone https://gist.github.com/593a927aab9b1be6249b.git
  • mv 593a927aab9b1be6249b/add_spacer.sh /usr/local/bin/add_spacer
  • chmod +x /usr/local/bin/add_spacer

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