Guest User

pgwall

a guest
Apr 14th, 2010
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.19 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. minfonts="25"       # Set minimum font size here.
  4. maxfonts="100"      # Set maximum font size here.
  5.  
  6. bcolor="#111111"    # Set default background color here.
  7. lcolor="#c0c0c0"    # Set default line color here.
  8. tcolor="#ffffff"    # Set default top color here.
  9. dcolor="#1793d1"    # Set default dependency color here.
  10.  
  11. maxwidth="99999"    # Set maximum width of the wallpaper here.
  12. maxheight="99999"   # Set maximum height of the wallpaper here.
  13.  
  14. cd $HOME
  15. createimage () {
  16. pacgraph -b $bcolor -l $lcolor -t $tcolor -d $dcolor -p $minfonts $maxfonts
  17. width=`identify -format %[fx:w] pacgraph.png`
  18. height=`identify -format %[fx:h] pacgraph.png`
  19. }
  20.  
  21. setwallpaper () {
  22. if [ $width -le "$maxwidth" ] && [ $height -le "$maxheight" ]; then
  23.     gconftool-2 -s --type=string /desktop/gnome/background/picture_filename $HOME/pacgraph.png
  24.     gconftool-2 -s --type=string /desktop/gnome/background/picture_options stretched
  25.     exit 0
  26.     else
  27.         createimage
  28.         setwallpaper
  29. fi
  30. }
  31.  
  32. about ()
  33. {
  34. cat << EOF
  35. pgwall is a small bash script, written by Thijs Kleintjens.
  36. The purpose of writing this script was not to create something usefull,
  37. it was to become more familiar with the Bourne Again Shell.
  38.  
  39. This script is based upon a nice little piece of software called pacgraph,
  40. created by keenerd, available in the Arch User Repository.
  41. Information about pacgraph is available here: kmkeen.com/pacgraph
  42.  
  43. You can copy, modify, redistribute, or anything else you want to do with pgwall, without asking me.
  44.  
  45. To contact me you can send an e-mail to [email protected]
  46. My website is Chef1411.com
  47. EOF
  48. }
  49.  
  50. usage ()
  51. {
  52. cat << EOF
  53. Usage: pgwall [options]
  54.  
  55. Options:
  56.     -a,     --about         Display information about the author.
  57.     -h,     --help          Display this usage information.
  58.     -v,     --version       Display pgwall version.
  59.     -b COLOR,   --background COLOR  Set background color, default is "#111111".
  60.     -l COLOR,   --line COLOR        Set line color, default is "#c0c0c0".
  61.     -t COLOR,   --top COLOR     Set top color, default is "#ffffff".
  62.     -d COLOR,   --dependency COLOR  Set dependency color, default is "#1793d1".
  63.     -mw WIDTH,  --maxwidth WIDTH    Set the maximum width of the entire wallpaper, default is unlimited (99999).
  64.     -mh HEIGHT, --maxheight HEIGHT  Set the maximum height of the entire wallpaper, default is unlimited (99999).
  65.     -mif MIN-FONT,  --minfont MIN-FONT  Set minimum font size, default is "25".
  66.     -maf MAX-FONT,  --maxfont MAX-FONT  Set maximum font size, default is "100".
  67.  
  68. COLOR has to be in hex code.
  69. Report gpwall bugs to [email protected]"
  70. EOF
  71. }
  72.  
  73. version ()
  74. {
  75. cat << EOF
  76. pgwall v2
  77. 14/04/2010
  78. EOF
  79. }
  80.  
  81. while [ "$1" != "" ]; do
  82.     case $1 in
  83.         -a | --about )      shift
  84.                     about
  85.                     exit 0
  86.                     ;;
  87.         -h | --help )       usage
  88.                     exit 0
  89.                     ;;
  90.         -v | --version )    version
  91.                     exit 0
  92.                     ;;
  93.         -b | --background ) bcolor="$2"; shift
  94.                     ;;
  95.         -l | --line )       lcolor="$2"; shift
  96.                     ;;
  97.         -t | --top )        tcolor="$2"; shift
  98.                     ;;
  99.         -d | --dependency ) dcolor="$2"; shift
  100.                     ;;
  101.         -mw | --maxwidth )  maxwidth="$2"; shift
  102.                     ;;
  103.         -mh | --maxheight ) maxheight="$2"; shift
  104.                     ;;
  105.         -mif | --minfont )  minfonts="$2"; shift
  106.                     ;;
  107.         -maf | --maxfont )  maxfonts="$2"; shift
  108.                     ;;
  109.         * )         usage
  110.                     exit 1
  111.     esac
  112.     shift
  113. done
  114.  
  115. createimage
  116. setwallpaper
Advertisement
Add Comment
Please, Sign In to add comment