Hide and show desktop icons with a Perl script (MacOS)

There are many utilities in the App Store that easily allow hide all the desktop stuff, and they are useful when going to plug a projector to our Mac Book… But there is an easy way, a simple Perl script that when launched hides (or shows if already hidden) icons from our Desktop. 

#!/usr/bin/env perl
$current = `defaults read com.apple.finder CreateDesktop`;
chomp($current);
if (!$current) { $what = 'true' } else {$what = 'false'}
`defaults write com.apple.finder CreateDesktop -bool $what`;
`killall Finder`;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s