wok view xsnow/stuff/xsnow.sh @ rev 23304

updated perl-convert-asn1 (0.22 -> 0.27)
author Hans-G?nter Theisgen
date Sun Mar 29 17:14:16 2020 +0100 (2020-03-29)
parents 36d70656dfc2
children
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!1..inf' 2 10 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?" || exit 2 ;}
32 [ -n "$pid1" ] && kill $pid1
33 [ -n "$pid2" ] && kill $pid2
34 # add dummy var to gobble last |
35 IFS='|' read sf sc back bc tc ssiz ssp suf delay smooth wf xs ys wind wtimer \
36 winsd scrsd off trees santa rud winsn scrsn popupsn duration dummy<<EOT
37 $settings
38 EOT
39 [ $back = FALSE ] && back=''
40 flags=''
41 [ $smooth = FALSE ] && flags=$flags" -unsmooth"
42 [ $wind = FALSE ] && flags=$flags" -nowind"
43 [ $trees = FALSE ] && flags=$flags" -notrees"
44 [ $santa = FALSE ] && flags=$flags" -nosanta"
45 [ $rud = FALSE ] && flags=$flags" -norudolf"
46 if [ $winsn = FALSE -a $scrsn = FALSE ]; then flags=$flags" -nokeepsnow"
47 elif [ $winsn = FALSE ]; then flags=$flags" -nokeepsnowonwindows"
48 elif [ $scrsn = FALSE ]; then flags=$flags" -nokeepsnowonscreen"
49 fi
50 [ $popupsn = TRUE ] && flags=$flags" -nonopopup"
51 xsnow -snowflakes ${sf%.*} -sc "$sc" ${back:+-solidbg -bg "$bc"} -tc "$tc" \
52 -santa ${ssiz%.*} -santaspeed ${ssp%.*} -santaupdatefactor ${suf%.*} \
53 -delay ${delay%.*} -whirl ${wf%.*} -xspeed ${xs%.*} -yspeed ${ys%.*} \
54 -windtimer ${wtimer%.*} -wsnowdepth ${winsd%.*} -ssnowdepth ${scrsd%.*} \
55 -offset ${off%.*} $flags >/dev/null 2>&1 &
56 yad --button=gtk-stop --title='Stop xsnow' $icon \
57 --timeout=$((60*${duration%.*}))
58 pkill -x xsnow
59 alias pcmanfm='pcmanfm --desktop 2>/dev/null &'
60 alias spacefm='spacefm --desktop 2>/dev/null &'
61 # restart filemanager(s)
62 if [ -n "$pid1" ]; then
63 if [ -n "$pid2" ]; then
64 # in case both were running
65 if [ $pid1 -lt $pid2 ]; then
66 spacefm
67 pcmanfm
68 else
69 pcmanfm
70 spacefm
71 fi
72 else
73 spacefm
74 fi
75 elif [ -n "$pid2" ]; then
76 pcmanfm
77 fi