Toggle Dashboard in OS X

Note: I have written an application that can accomplish this task.
You can check it out/download it here.

Toggle Dashboard

This is a quick little tutorial/script to enable and disable the dashboard on Leopard / Snow Leopard (might work on other operating systems, i haven’t tried). Dashboard is what pops up on your mac when you press the key that looks like a speedometer on your keyboard. I found that dashboard stays loaded in the background after it gets called to open, so I disabled it to guarantee that none of my resources would be allocated to dashboard because I find it useless.

The script is pretty straight forward. Running the script by itself will simply tell you the current state of the dashboard (enabled or disabled), and adding a “-t” switch to it will toggle the state… here’s the script

(I know there is a better way to grab command line arguments with a case statement in bash, but i don’t really know it, so if anyone want’s to show me that would be appreciated!)
EDIT
This is a rather old script, I have since learned getopt/getopts for bash

Example

The Code

#!/bin/bash
#
# toggledashboard.sh
# by Dave Eddy
# dave@daveeddy.com
# http://www.daveeddy.com
#

################ Check status of dashboard #########
BOOLEAN=`defaults read com.apple.dashboard mcx-disabled`
################ show the status ##################
if [[ $# != 1 ]]; then
if [[ BOOLEAN -eq 1 ]]; then
echo "Dashboard is disabled"
echo "use -t to toggle dashboard"
else
echo "Dashboard is enabled"
echo "use -t to toggle dashboard"
fi
fi
################ Toggle the dashboard ##############
if [ "$1" = "-t" ]; then
if [[ BOOLEAN -eq 1 ]]; then
defaults write com.apple.dashboard mcx-disabled -boolean NO
killall Dock
echo "Enabling Dashboard"
else
defaults write com.apple.dashboard mcx-disabled -boolean YES
killall Dock
echo "Disabling Dashboard"
fi
fi

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>