pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

hahaha private pastebin - collaborative debugging tool What's a private pastebin?


Posted by oblek - xfce desktop on Sat 1 Dec 05:52 (modification of post by view diff)
report abuse | download | new post

  1. #!/bin/bash
  2. #
  3. # script: change_backgrounds.sh - bash version
  4. #
  5. # version 2007.3.7
  6. #
  7. # description: randomly replace gnome background with one from a directory
  8. #
  9. # credits: David Loschiavo [http://www.djlosch.com], Steven Van Ingelgem, Sudhanshu [http://home.iitk.ac.in/~sudhansh]
  10. #
  11. # license: GPL
  12. #
  13. # change bg_path to ur wallpapers folder. the subfolders are automatically added.
  14. # where the wallpaper reside, see more at http://vladstudio.com
  15. bg_path="/usr/share/xfce4/backdrops/vladstudio"
  16. extensions="jpg png gif jpeg JPG GIF PNG"
  17. temp_bg_list=/tmp/backdrop.list.$$
  18.  
  19. # try to remove the old list, bail out if failed
  20. rm -f $temp_bg_list.$$ || exit 1
  21.  
  22. for extension in $extensions; do
  23.     find $bg_path -iregex ".*.$extension" >> "$temp_bg_list"
  24. done
  25.  
  26. cnt=`wc -l "$temp_bg_list" | cut -f1 -d" "`
  27. all_bgs=`echo \`expr $RANDOM % $cnt\``
  28.  
  29. selected_bg=`head -n$all_bgs "$temp_bg_list" | tail -n1`
  30.  
  31. echo -e "# xfce backdrop list\n$selected_bg">/etc/backdrops.list
  32.  
  33. #get the pid for xfdesktop
  34. pid=`ps -e | grep xfdesktop | awk '{print $1}'`
  35.  
  36. #a regular expression containing the names of the processes
  37. #that will defer the switching, since killing with USR1 will lockup the program
  38. deferred='(mplayer|vlc)'
  39.  
  40. if [[ -z $pid ]] && [[ -n `ps -e | egrep $deferred` ]]; then
  41.     echo "" &> /dev/null
  42. else
  43.     renice 19 -p $pid &> /dev/null
  44.     kill -USR1 $pid
  45.     renice 0 -p $pid &> /dev/null
  46. fi

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post