mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-10 19:23:03 +03:00
27 lines
596 B
Bash
Executable file
27 lines
596 B
Bash
Executable file
#!/bin/bash
|
|
# [[file:../../Desktop.org::*sun][sun:1]]
|
|
declare -A LAT_DATA=(
|
|
["TMN"]="57.15N"
|
|
["SPB"]="59.9375N"
|
|
)
|
|
declare -A LON_DATA=(
|
|
["TMN"]="65.533333E"
|
|
["SPB"]="30.308611E"
|
|
)
|
|
if [ -z "$LOC" ]; then
|
|
echo "LOC?"
|
|
exit -1
|
|
fi
|
|
LAT=${LAT_DATA[$LOC]}
|
|
LON=${LON_DATA[$LOC]}
|
|
|
|
time=$(sunwait poll daylight rise ${LAT} $LON)
|
|
|
|
if [[ ${time} == 'DAY' ]]; then
|
|
sunset=$(sunwait list daylight set ${LAT} ${LON})
|
|
echo "%{u#ffcb6b}%{+u} $sunset %{u-}"
|
|
else
|
|
sunrise=$(sunwait list daylight rise ${LAT} ${LON})
|
|
echo "%{u#f07178}%{+u} $sunrise %{u-}"
|
|
fi
|
|
# sun:1 ends here
|