rev |
line source |
llevrel@18814
|
1 #!/bin/sh
|
llevrel@18814
|
2 icon=--window-icon=/usr/share/pixmaps/xsnow.png
|
llevrel@18814
|
3 # egrep -v '[A-Z]|gray|[0-9]$' /usr/share/X11/rgb.txt |cut -f 3 |tr '\n' '!'
|
llevrel@18814
|
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'
|
llevrel@18814
|
5 settings=$(LC_NUMERIC=C yad --form --columns=2 --title="xsnow settings" $icon \
|
llevrel@18814
|
6 --field="Number of snowflakes":NUM \
|
llevrel@18814
|
7 --field="Snow color":CB --field="Set background color":CHK \
|
llevrel@18814
|
8 --field="Background color":CB --field="Christmas trees color":CB \
|
llevrel@18814
|
9 --field="Santa Claus's size":NUM --field="Sleigh speed (-1 = default)":NUM \
|
llevrel@18814
|
10 --field="Sleigh refresh factor 1/":NUM --field="Snow update delay (ms)":NUM \
|
llevrel@18814
|
11 --field="Smooth snow movement":CHK --field="Snow whirling speed (max)":NUM \
|
llevrel@18814
|
12 --field="Snow drifting speed (max)":NUM \
|
llevrel@18814
|
13 --field="Snow falling speed (max)":NUM \
|
llevrel@18814
|
14 --field="Windy periods":CHK --field="Windy periods interval (s)":NUM \
|
llevrel@18814
|
15 --field="Maximal snow depth on windows":NUM \
|
llevrel@18814
|
16 --field="Maximal snow depth on screen bottom":NUM \
|
llevrel@18814
|
17 --field="Vertical offset of snow layers":NUM \
|
llevrel@18814
|
18 --field="Christmas trees":CHK --field="Santa Claus":CHK --field="Rudolf":CHK \
|
llevrel@18814
|
19 --field="Snow layers on windows":CHK \
|
llevrel@18814
|
20 --field="Snow layer on screen bottom":CHK \
|
llevrel@18814
|
21 --field="Check this if snow layering doesn't work":CHK \
|
llevrel@18814
|
22 --field="Duration (min) (0 = unlimited)":NUM \
|
llevrel@18814
|
23 -- '100!1..1000' "$colors" 'true' SkyBlue3\!"$colors" \
|
llevrel@19005
|
24 chartreuse\!"${colors/chartreuse!/}" '2!0..2' '-1!-1..inf' '3!1..inf' \
|
llevrel@19005
|
25 50 true '3!1..inf' 2 10 true 30 15 50 0 true true true true true false 0)
|
llevrel@18814
|
26 [ $? -eq 0 ] || exit 1
|
llevrel@18814
|
27 pid1=$(pgrep -fl 'spacefm --desktop'|cut -f1 -d' ')
|
llevrel@18814
|
28 pid2=$(pgrep -fl 'pcmanfm --desktop'|cut -f1 -d' ')
|
llevrel@19005
|
29 [ -n "$pid1" -o -n "$pid2" ] && { yad --title=Warning $icon \
|
llevrel@18814
|
30 --text="Your file manager windows will be closed, and your desktop icons \
|
llevrel@19005
|
31 temporarily removed. Continue?" || exit 2 ;}
|
llevrel@18814
|
32 [ -n "$pid1" ] && kill $pid1
|
llevrel@18814
|
33 [ -n "$pid2" ] && kill $pid2
|
llevrel@18814
|
34 # add dummy var to gobble last |
|
llevrel@18814
|
35 IFS='|' read sf sc back bc tc ssiz ssp suf delay smooth wf xs ys wind wtimer \
|
llevrel@18814
|
36 winsd scrsd off trees santa rud winsn scrsn popupsn duration dummy<<EOT
|
llevrel@18814
|
37 $settings
|
llevrel@18814
|
38 EOT
|
pascal@20892
|
39 [ $back = FALSE ] && back=''
|
llevrel@18814
|
40 flags=''
|
pascal@20892
|
41 [ $smooth = FALSE ] && flags=$flags" -unsmooth"
|
pascal@20892
|
42 [ $wind = FALSE ] && flags=$flags" -nowind"
|
pascal@20892
|
43 [ $trees = FALSE ] && flags=$flags" -notrees"
|
pascal@20892
|
44 [ $santa = FALSE ] && flags=$flags" -nosanta"
|
pascal@20892
|
45 [ $rud = FALSE ] && flags=$flags" -norudolf"
|
pascal@20892
|
46 if [ $winsn = FALSE -a $scrsn = FALSE ]; then flags=$flags" -nokeepsnow"
|
pascal@20892
|
47 elif [ $winsn = FALSE ]; then flags=$flags" -nokeepsnowonwindows"
|
pascal@20892
|
48 elif [ $scrsn = FALSE ]; then flags=$flags" -nokeepsnowonscreen"
|
llevrel@18814
|
49 fi
|
pascal@20892
|
50 [ $popupsn = TRUE ] && flags=$flags" -nonopopup"
|
llevrel@18814
|
51 xsnow -snowflakes ${sf%.*} -sc "$sc" ${back:+-solidbg -bg "$bc"} -tc "$tc" \
|
llevrel@18814
|
52 -santa ${ssiz%.*} -santaspeed ${ssp%.*} -santaupdatefactor ${suf%.*} \
|
llevrel@18814
|
53 -delay ${delay%.*} -whirl ${wf%.*} -xspeed ${xs%.*} -yspeed ${ys%.*} \
|
llevrel@18814
|
54 -windtimer ${wtimer%.*} -wsnowdepth ${winsd%.*} -ssnowdepth ${scrsd%.*} \
|
llevrel@18814
|
55 -offset ${off%.*} $flags >/dev/null 2>&1 &
|
llevrel@18814
|
56 yad --button=gtk-stop --title='Stop xsnow' $icon \
|
llevrel@18814
|
57 --timeout=$((60*${duration%.*}))
|
llevrel@18814
|
58 pkill -x xsnow
|
llevrel@18814
|
59 alias pcmanfm='pcmanfm --desktop 2>/dev/null &'
|
llevrel@18814
|
60 alias spacefm='spacefm --desktop 2>/dev/null &'
|
llevrel@18814
|
61 # restart filemanager(s)
|
llevrel@18814
|
62 if [ -n "$pid1" ]; then
|
llevrel@18814
|
63 if [ -n "$pid2" ]; then
|
llevrel@18814
|
64 # in case both were running
|
llevrel@18814
|
65 if [ $pid1 -lt $pid2 ]; then
|
llevrel@18814
|
66 spacefm
|
llevrel@18814
|
67 pcmanfm
|
llevrel@18814
|
68 else
|
llevrel@18814
|
69 pcmanfm
|
llevrel@18814
|
70 spacefm
|
llevrel@18814
|
71 fi
|
llevrel@18814
|
72 else
|
llevrel@18814
|
73 spacefm
|
llevrel@18814
|
74 fi
|
llevrel@18814
|
75 elif [ -n "$pid2" ]; then
|
llevrel@18814
|
76 pcmanfm
|
llevrel@18814
|
77 fi
|