-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathearthWallpaper
executable file
·75 lines (75 loc) · 2.97 KB
/
earthWallpaper
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
cd $(dirname $(readlink -f "$0"))
# 配置地球大小,默认主屏高的70%
zoom=70
# 使用哪个卫星的图片,目前 himawari8[向日葵8号], fy4a[风云4号], goes16, goes17
using="himawari8"
source config
# 定义和读取值
tempfile=/tmp/tempEarth.jpg
backgroundfile=/tmp/tempEarth2.jpg
targetfile=/tmp/earth.jpg
screen=`xrandr|grep 'connected primary'|awk '{print $4}'|awk -F '+' '{print $1}'`
height=`echo $screen|awk -F 'x' '{print $2}'`
earthHeight=`echo "sclae=0; $height*$zoom/100" | bc`
isDeepin20=`cat /etc/os-release|grep 'Deepin 20'|wc -l`
primaryScreen=`xrandr|grep 'connected primary'|awk '{print $1}'`
# 定义操作
himawari8(){
urldate=`date +%Y/%m/%d/%H -d '-1 hours' -u`
curl "https://himawari8-dl.nict.go.jp/himawari8/img/D531106/1d/550/${urldate}0000_0_0.png" > ${tempfile}.png
convert -resize "88888x$earthHeight" ${tempfile}.png $tempfile
rm -f ${tempfile}.png
convert -size $screen xc:none $backgroundfile
composite -gravity center $tempfile $backgroundfile $targetfile
rm -f $tempfile $backgroundfile
}
goes(){
curl https://cdn.star.nesdis.noaa.gov/$1/ABI/FD/GEOCOLOR/1808x1808.jpg > $tempfile
convert -crop 1808x1776+0+0 $tempfile $tempfile
convert -size 200x200 xc:none $backgroundfile
composite -gravity southwest $backgroundfile $tempfile $tempfile
convert -resize "88888x$earthHeight" $tempfile $tempfile
convert -size $screen xc:none $backgroundfile
composite -gravity center $tempfile $backgroundfile $targetfile
rm -f $tempfile $backgroundfile
}
fy4a(){
urldate=`date +%Y%m%d`
curl "http://img.nsmc.org.cn/PORTAL/FY4/IMG/FY4A/AGRI/IMG/DISK/MTCC/NOM/FY4A-_AGRI--_N_DISK_1047E_L1C_MTCC_MULT_NOM_${urldate}040000_${urldate}041459_1000M_V0001.JPG" > $tempfile
convert -size 2410x860 xc:none $backgroundfile
composite -gravity northwest $backgroundfile $tempfile $tempfile
convert -size 900x900 xc:none $backgroundfile
composite -gravity southeast $backgroundfile $tempfile $tempfile
convert -resize "88888x$earthHeight" $tempfile $tempfile
convert -size $screen xc:none $backgroundfile
composite -gravity center $tempfile $backgroundfile $targetfile
rm -f $tempfile $backgroundfile
}
getImg(){
if [[ "x$using" == "xhimawari8" ]]; then
echo himawari8
himawari8
elif [[ "x$using" == "xfy4a" ]]; then
echo fy4a
fy4a
elif [[ "x$using" == "xgoes16" ]]; then
echo goes16
goes "GOES16"
else
echo goes17
goes "GOES17"
fi
}
# 设置桌面背景
GIO_EXTRA_MODULES="/usr/lib/x86_64-linux-gnu/gio/modules/"
export GIO_EXTRA_MODULES
getImg
gsettings set org.gnome.desktop.background picture-uri file://$targetfile
if [[ "x$isDeepin20" == "x1" ]]; then
dbus-send --dest=com.deepin.daemon.Appearance /com/deepin/daemon/Appearance --print-reply com.deepin.daemon.Appearance.SetMonitorBackground string:"$primaryScreen" string:"file://$targetfile"
fi
while [[ "x$using" == "xhimawari8" ]];do
sleep 3600
getImg
done