From 4a0932d2419dc235358deda6213d95e64377b188 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sat, 6 Aug 2016 17:43:55 -0700 Subject: [PATCH] add script to show/hide desktop icons --- desktop-icons | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 desktop-icons diff --git a/desktop-icons b/desktop-icons new file mode 100755 index 0000000..8894e72 --- /dev/null +++ b/desktop-icons @@ -0,0 +1,21 @@ +#!/bin/bash + +# Toggle the visibility of Desktop icons. + +# Desktop icons are visible if the CreateDesktop setting is missing or +# if it exists and is set to 1, true, yes, or on (case insensitive). +# Desktop icons are hidden if the CreateDesktop setting exists and +# is set to any value other than 1, true, yes, or on. + +# The $icons variable is the value of CreateDesktop if it exists or is +# the empty string if it doesn't. + +icons=`defaults read com.apple.finder CreateDesktop 2> /dev/null` + +shopt -s nocasematch +case "$icons" in + "" | "1" | "true" | "yes" | "on" ) + defaults write com.apple.finder CreateDesktop 0 && killall Finder;; + * ) + defaults write com.apple.finder CreateDesktop 1 && killall Finder;; +esac