[download]

local/bin/filvice

   1 #!/bin/bash
   2 
   3 color(){ # {{{
   4     local c=$1
   5 
   6     [[ $c == [0-9]* ]] &&
   7     c=color$1 && c=${!c}
   8 
   9     echo "$c"
  10 } # }}}
  11 
  12 f=~/.cache/filvice
  13 r=$(xrandr  | awk '/\*/ { print $1 }')
  14 s=$(echo $r | awk -F x '{ print $2 / 5 }')
  15 
  16 source ~/.theme/colors.sh
  17 primary=$color4 secondary=$color5
  18 
  19 while getopts rl0:1:2: OPT; do
  20     case $OPT in
  21         r) $0 $(< $f.arg); exit;;
  22         l) background=$color8;;
  23         0) background=$(color "$OPTARG");;
  24         1) primary=$(color "$OPTARG");;
  25         2) secondary=$(color "$OPTARG");;
  26     esac
  27 done
  28 
  29 echo "$@" > $f.arg
  30 cat <<SVG > $f.svg # {{{
  31 <svg width="95.06mm" height="216.6mm" viewBox="0 0 336.8 738.7" xmlns="http://www.w3.org/2000/svg">
  32   <path d="m336.6 704.5a168.4 34.78 0 0 1 -168.4 34.5 168.4 34.78 0 0 1 -168.39-34.5 168.4 34.78 0 0 1 168.39-35 168.4 34.78 0 0 1 168.4 35z" fill-opacity=".2" stroke-linecap="round" stroke-width="2" transform="translate(0, 10)"/>
  33   <path d="m256.1 529.3c0 78.5-31.4 94.1-99.9 94.1-68.53 0-74.28-19.3-74.28-97.8 0-78.4 14.12-103 82.68-103 68.5 0 91.5 28.3 91.5 106.7z" fill="$primary" stroke-linecap="round" stroke-linejoin="round" stroke-width="5"/>
  34   <path d="m100.7 474.4c-14.07-18.3-37.61-27.7-74.74-27.2 24.58-20.4 52.82-34 95.74-20.9z" fill="$primary" fill-rule="evenodd"/>
  35   <path d="m246.1 477c8.9-19.9 28.3-32.9 62.3-40.3-26.7-13.6-54.9-20.4-91.5.6z" fill="$primary" fill-rule="evenodd"/>
  36   <path d="m165.3 609.5c20.4-28.7 44.9-86.2 72.5-139.5 10.8-25.2 34.1-43.7 34.1-43.7l-34.7-6-52.1 107.2-27 82.6z" fill="#000" fill-opacity="0.4" fill-rule="evenodd" stroke-width=".9999"/>
  37   <path d="m159.6 614.5c-8.4-.8-37-107.5-69.76-154.1l-28.16-34.7 7.19-4.2 62.33 76z" fill="#000" fill-opacity="0.4" fill-rule="evenodd" stroke-width=".9999"/>
  38   <path d="m43.74 403.8c84.76-37.7 175.16-16.8 249.46 2.1-79 42.9-87.9 146.4-133.4 209.7-38.7-74.3-17.7-116.1-116.06-211.8z" fill="$secondary" fill-rule="evenodd" stroke-width=".92"/>
  39   <path d="m171.4 435.7c-91.57-13.1-67-109.8-62.8-192.5 5.7-110.9 39.2-172.57 113-160.02 64.8 10.46 32.4 77.92 15.7 187.72-16.8 109.9 9.9 175.2-65.9 164.8z" fill="#e6c8aa" stroke-linecap="round" stroke-linejoin="round" stroke-width="5"/>
  40   <circle cx="117.5" cy="183.1" r="4.239" stroke-linecap="round" stroke-linejoin="round" stroke-width="5"/>
  41   <path d="m108.1 168.4c9.9-2.6 18.3 3.2 25.6 14.2" fill="none" stroke="#000" stroke-width="6.1714"/>
  42   <circle cx="-169.8" cy="188.3" r="4.239" stroke-linecap="round" stroke-linejoin="round" stroke-width="5" transform="scale(-1 1)"/>
  43   <path d="m179.7 173.7-26.1 14.1" fill="none" stroke="#000" stroke-width="6.1714"/>
  44   <g transform="matrix(5.014 0 0 5.014 -2492 -2615)">
  45     <path d="m532.1 567.7c0 2.3-2.6 4.3-8.3 4.3-5.8 0-5-2-5-4.3 0-2.4-.8-4.2 5-4.2 5.7 0 8.3 1.8 8.3 4.2z" fill="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="5"/>
  46     <path d="m472.7 206.4c-.1 0-.2 0-.3 0v3.3h-2.2l-.1-3.1c-.3 0-.7.1-.9.2v2.9h-1.2v.6.3h1.2v3.4c.3.1.6.2 1 .3v-3.6h2.2v3.8h.3.7v-3.8h2.8v3.5c.4-.1.7-.2 1-.3v-3.2l3.5.1c0-.2 0-.3 0-.5s0-.3 0-.5h-3.5l-.1-2.9c-.3-.1-.6-.2-.9-.3v3.2l-2.9-.1v-3.3c-.2 0-.3 0-.6 0z" fill-rule="evenodd" transform="matrix(1.043 0 0 1.043 30.66 348.3)"/>
  47   </g>
  48   <path d="m139.6 132.2s11.4 20.9 49.1 25.7c27.5 1.8 50.9-16.7 50.9-16.7l-9 15.5s-24.5 34.7-26.3 57.5c0 0-16.8 92.8-12.6 119.8 0 0 7.1 10.2 19.7 9.6 21.6-3 18.6-13.8 18.6-13.8s.6-44.3 0-49.1 8.4-86.8 8.4-86.8l25.7-44.4 7.2-32.3-91.6-20.37-57.5-3.59 6 35.96z" fill="#ddb38a" fill-rule="evenodd" stroke-width=".9999"/>
  49   <path d="m129.5 137.6c-15.7-37.2-40.26-72.2-24.6-116.65 34.6 6.8 28.8 20.39 46.6 28.24 41.8 16.73 71.6 27.19 142.8 66.41-1.1 20.4-4.7 38.2-27.8 42.9-32.9 75.3-24 119.2-37.6 171.5-7.9 6.3-17.3 8.9-33.5-4.1 3.7-46.1 2.1-131.8 56.5-189.4-7.3 2.1-4.2-11-18.3 0-31.4 25.1-74.8 11.5-93.1-16.2-2.6-3.6-6.3 18.3-11 17.3z" fill="#736357" fill-rule="evenodd"/>
  50   <g stroke-linecap="round" stroke-linejoin="round">
  51     <path d="m91.34 478.6s-136.51 11.5-53.87 119.2" fill="none" stroke="$primary" stroke-width="11.9244"/>
  52     <path d="m64.14 587.4c10.46 13 3.14 20.9-9.41 31.3-13.08 10-19.88 15.7-30.34 2.7-9.94-12.6-6.27-20.4 6.8-30.9 12.55-9.9 23.01-15.7 32.95-3.1z" fill="#e6c8aa" stroke-width="2"/>
  53     <path d="m123.2 610.4s-34.48 11.5-24.02 91.5l-33.47 4.2" fill="none" stroke="$primary" stroke-width="11.9244"/>
  54     <path d="m244.1 486.4s136.5 11.5 53.8 119.8" fill="none" stroke="$primary" stroke-width="11.9244"/>
  55     <path d="m270.7 595.7c-9.9 12.6-2.6 20.4 10 30.9 13 10.4 19.8 15.7 29.8 3.1 10.4-13.1 6.2-20.9-6.3-30.8-13.1-10.5-23-16.3-33.5-3.2z" fill="#e6c8aa" stroke-width="2"/>
  56     <path d="m199.6 604.1s34.5 11.5 24.1 91.5l30.8 10.5" fill="none" stroke="$primary" stroke-width="11.9244"/>
  57   </g>
  58   <path d="m8.178 700.3c-5.753-7.8 35.042-700.274 35.042-700.274l253.68 99.894 37.1 605.68z" fill="none"/>
  59   <path d="m115.4 404.8c46.5 67.5 22.5 115.1 49.2 165.8 8.3-63.8 28.7-108.2 60.6-161.6z" fill="#e6c8aa" fill-rule="evenodd"/>
  60 </svg>
  61 SVG
  62 # }}}
  63 
  64 rsvg-convert $f.svg > $f.png ||
  65 convert -background none $f.svg $f.png
  66 
  67 convert -size $r xc:$background -depth 8 \
  68 \( -background none $f.png -resize x$s -sharpen 1 \) \
  69 -gravity southeast -geometry +60+30 -composite $f.png && theme -b $_