Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # no opt revoke everything
- # f force hide
- # ff force hide + change wp
- ### set the path to your worksafe image ###
- WP=${HOME}/Pictures/Wallpapers/HQ2/1290661555171.jpg
- ### set the path to your worksafe image ###
- if [ -e ${HOME}/Desktop/.hidden ] && [ "$1" != "f" ] && [ "$1" != "ff" ]; then
- chflags nohidden ${HOME}/Desktop/*
- if [ -s ${HOME}/Desktop/.hidden ]; then
- # myPic = variable for .hidden content
- osascript -e 'set myPic to do shell script "cat ~/Desktop/.hidden"
- tell application "System Events" to set picture of desktop 1 to myPic'
- fi
- rm ${HOME}/Desktop/.hidden
- echo "*** Desktop restored ***"
- exit 0
- else
- chflags hidden ${HOME}/Desktop/*
- touch ${HOME}/Desktop/.hidden
- echo "*** Desktop cleared ***"
- fi
- if [ "$1" = "ff" ] && [ ! -s ${HOME}/Desktop/.hidden ]; then
- /usr/libexec/PlistBuddy -c "Print Background:default:ImageFilePath" ${HOME}/Library/Preferences/com.apple.desktop.plist > ${HOME}/Desktop/.hidden
- osascript << EOT
- tell application "System Events" to set picture of desktop 1 to "$WP"
- EOT
- echo "*** Wallpaper changed ***"
- exit 0
- elif [ "$1" = "ff" ]; then
- echo "*** Wallpaper is already sfw ***"
- exit 0
- fi
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement