Advertisement
Guest User

preller

a guest
Mar 27th, 2011
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.23 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # no opt    revoke everything
  4. # f         force hide
  5. # ff        force hide + change wp
  6.  
  7. ### set the path to your worksafe image ###
  8. WP=${HOME}/Pictures/Wallpapers/HQ2/1290661555171.jpg
  9. ### set the path to your worksafe image ###
  10.  
  11. if [ -e ${HOME}/Desktop/.hidden ] && [ "$1" != "f" ] && [ "$1" != "ff" ]; then
  12.     chflags nohidden ${HOME}/Desktop/*
  13.     if [ -s ${HOME}/Desktop/.hidden ]; then
  14.         # myPic = variable for .hidden content
  15.         osascript -e 'set myPic to do shell script "cat ~/Desktop/.hidden"
  16.         tell application "System Events" to set picture of desktop 1 to myPic'
  17.     fi
  18.     rm ${HOME}/Desktop/.hidden
  19.     echo "*** Desktop restored ***"
  20.     exit 0
  21. else
  22.     chflags hidden ${HOME}/Desktop/*
  23.     touch ${HOME}/Desktop/.hidden
  24.     echo "*** Desktop cleared ***"
  25. fi
  26.  
  27. if [ "$1" = "ff" ] && [ ! -s ${HOME}/Desktop/.hidden ]; then
  28.     /usr/libexec/PlistBuddy -c "Print Background:default:ImageFilePath" ${HOME}/Library/Preferences/com.apple.desktop.plist > ${HOME}/Desktop/.hidden
  29.     osascript << EOT                                            
  30. tell application "System Events" to set picture of desktop 1 to "$WP"
  31. EOT
  32.     echo "*** Wallpaper changed ***"
  33.     exit 0
  34. elif [ "$1" = "ff" ]; then
  35.     echo "*** Wallpaper is already sfw ***"
  36.     exit 0
  37. fi
  38.  
  39. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement