wok-6.x view xsnow/stuff/xsnow.sh @ rev 18814
Add GUI to xsnow and xpenguins
author | Lucas Levrel <llevrel@yahoo.fr> |
---|---|
date | Thu Jan 14 22:11:10 2016 +0100 (2016-01-14) |
parents | |
children | 36d70656dfc2 |
line source
1 #!/bin/sh
2 icon=--window-icon=/usr/share/pixmaps/xsnow.png
3 # egrep -v '[A-Z]|gray|[0-9]$' /usr/share/X11/rgb.txt |cut -f 3 |tr '\n' '!'
4 colors='snow!ghost white!white smoke!gainsboro!floral white!old lace!linen!antique white!papaya whip!blanched almond!bisque!peach puff!navajo white!moccasin!cornsilk!ivory!lemon chiffon!seashell!honeydew!mint cream!azure!alice blue!lavender!lavender blush!misty rose!white!black!dark slate grey!dim grey!slate grey!light slate grey!grey!light grey!midnight blue!navy!navy blue!cornflower blue!dark slate blue!slate blue!medium slate blue!light slate blue!medium blue!royal blue!blue!dodger blue!deep sky blue!sky blue!light sky blue!steel blue!light steel blue!light blue!powder blue!pale turquoise!dark turquoise!medium turquoise!turquoise!cyan!light cyan!cadet blue!medium aquamarine!aquamarine!dark green!dark olive green!dark sea green!sea green!medium sea green!light sea green!pale green!spring green!lawn green!green!chartreuse!medium spring green!green yellow!lime green!yellow green!forest green!olive drab!dark khaki!khaki!pale goldenrod!light goldenrod yellow!light yellow!yellow!gold!light goldenrod!goldenrod!dark goldenrod!rosy brown!indian red!saddle brown!sienna!peru!burlywood!beige!wheat!sandy brown!tan!chocolate!firebrick!brown!dark salmon!salmon!light salmon!orange!dark orange!coral!light coral!tomato!orange red!red!hot pink!deep pink!pink!light pink!pale violet red!maroon!medium violet red!violet red!magenta!violet!plum!orchid!medium orchid!dark orchid!dark violet!blue violet!purple!medium purple!thistle!dark grey!dark blue!dark cyan!dark magenta!dark red!light green'
5 settings=$(LC_NUMERIC=C yad --form --columns=2 --title="xsnow settings" $icon \
6 --field="Number of snowflakes":NUM \
7 --field="Snow color":CB --field="Set background color":CHK \
8 --field="Background color":CB --field="Christmas trees color":CB \
9 --field="Santa Claus's size":NUM --field="Sleigh speed (-1 = default)":NUM \
10 --field="Sleigh refresh factor 1/":NUM --field="Snow update delay (ms)":NUM \
11 --field="Smooth snow movement":CHK --field="Snow whirling speed (max)":NUM \
12 --field="Snow drifting speed (max)":NUM \
13 --field="Snow falling speed (max)":NUM \
14 --field="Windy periods":CHK --field="Windy periods interval (s)":NUM \
15 --field="Maximal snow depth on windows":NUM \
16 --field="Maximal snow depth on screen bottom":NUM \
17 --field="Vertical offset of snow layers":NUM \
18 --field="Christmas trees":CHK --field="Santa Claus":CHK --field="Rudolf":CHK \
19 --field="Snow layers on windows":CHK \
20 --field="Snow layer on screen bottom":CHK \
21 --field="Check this if snow layering doesn't work":CHK \
22 --field="Duration (min) (0 = unlimited)":NUM \
23 -- '100!1..1000' "$colors" 'true' SkyBlue3\!"$colors" \
24 chartreuse\!"${colors/chartreuse/}" '2!0..2' '-1!-1..inf' '3!1..inf' \
25 50 true 3 2 '10!1..inf' true 30 15 50 0 true true true true true false 0)
26 [ $? -eq 0 ] || exit 1
27 pid1=$(pgrep -fl 'spacefm --desktop'|cut -f1 -d' ')
28 pid2=$(pgrep -fl 'pcmanfm --desktop'|cut -f1 -d' ')
29 [ -n "$pid1" -o -n "$pid2" ] && yad --title=Warning $icon \
30 --text="Your file manager windows will be closed, and your desktop icons \
31 temporarily removed. Continue?"
32 [ $? -eq 0 ] || exit 2
33 [ -n "$pid1" ] && kill $pid1
34 [ -n "$pid2" ] && kill $pid2
35 # add dummy var to gobble last |
36 IFS='|' read sf sc back bc tc ssiz ssp suf delay smooth wf xs ys wind wtimer \
37 winsd scrsd off trees santa rud winsn scrsn popupsn duration dummy<<EOT
38 $settings
39 EOT
40 [ $back == FALSE ] && back=''
41 flags=''
42 [ $smooth == FALSE ] && flags=$flags" -unsmooth"
43 [ $wind == FALSE ] && flags=$flags" -nowind"
44 [ $trees == FALSE ] && flags=$flags" -notrees"
45 [ $santa == FALSE ] && flags=$flags" -nosanta"
46 [ $rud == FALSE ] && flags=$flags" -norudolf"
47 if [ $winsn == FALSE -a $scrsn == FALSE ]; then flags=$flags" -nokeepsnow"
48 elif [ $winsn == FALSE ]; then flags=$flags" -nokeepsnowonwindows"
49 elif [ $scrsn == FALSE ]; then flags=$flags" -nokeepsnowonscreen"
50 fi
51 [ $popupsn == TRUE ] && flags=$flags" -nonopopup"
52 xsnow -snowflakes ${sf%.*} -sc "$sc" ${back:+-solidbg -bg "$bc"} -tc "$tc" \
53 -santa ${ssiz%.*} -santaspeed ${ssp%.*} -santaupdatefactor ${suf%.*} \
54 -delay ${delay%.*} -whirl ${wf%.*} -xspeed ${xs%.*} -yspeed ${ys%.*} \
55 -windtimer ${wtimer%.*} -wsnowdepth ${winsd%.*} -ssnowdepth ${scrsd%.*} \
56 -offset ${off%.*} $flags >/dev/null 2>&1 &
57 yad --button=gtk-stop --title='Stop xsnow' $icon \
58 --timeout=$((60*${duration%.*}))
59 pkill -x xsnow
60 alias pcmanfm='pcmanfm --desktop 2>/dev/null &'
61 alias spacefm='spacefm --desktop 2>/dev/null &'
62 # restart filemanager(s)
63 if [ -n "$pid1" ]; then
64 if [ -n "$pid2" ]; then
65 # in case both were running
66 if [ $pid1 -lt $pid2 ]; then
67 spacefm
68 pcmanfm
69 else
70 pcmanfm
71 spacefm
72 fi
73 else
74 spacefm
75 fi
76 elif [ -n "$pid2" ]; then
77 pcmanfm
78 fi