commit 9485e8a2a8b7d6e2adfc3e9a29b43e0c0fa88e95 Author: venus Date: Fri Oct 16 16:21:51 2026 -0500 initial commit diff --git a/DP-2 b/DP-2 new file mode 100644 index 0000000..37820ee Binary files /dev/null and b/DP-2 differ diff --git a/clouds-alpha.png b/clouds-alpha.png new file mode 100644 index 0000000..48172fc Binary files /dev/null and b/clouds-alpha.png differ diff --git a/compile.sh b/compile.sh new file mode 100755 index 0000000..0bfe298 --- /dev/null +++ b/compile.sh @@ -0,0 +1,90 @@ +#!/usr/bin/env bash + +WORK_DIR="$HOME/.config/scripts/live-earth-wallpaper" +OUTPUT_IMG_DIR="$WORK_DIR/images" +CLOUD_SRC_IMG="$OUTPUT_IMG_DIR/clouds-alpha.jpg" +OUTPUT_IMG_ULTRAWIDE="$OUTPUT_IMG_DIR/DP-2-render.png" +OUTPUT_IMG_EDP="$OUTPUT_IMG_DIR/eDP-1-render.png" +OUTPUT_IMG_ULTRAWIDE_NATIVE="$OUTPUT_IMG_DIR/blue-ULTRAWIDE-native.png" +# OUTPUT_IMG_STARFNATIVE="$OUTPUT_IMG_DIR/stars-native.png" +STARS_FILE="/usr/share/xplanet/stars/BSC" +STATIONS_TLE="$WORK_DIR/stations.tle" +STATIONS_FINAL="$WORK_DIR/stations" +ULTRAWIDE_RES_NATIVE="3840x1080" +ULTRAWIDE_RES_FINAL="10240x2880" + +source functions.sh +cd "$WORK_DIR" || exit 1 + +# TODO make this sometihng like fetchCloudFile or something and have it return a path (functionally) +downloadClouds "$CLOUD_SRC_IMG" || exit # Download latest clouds image or exit with error + +# downloadStations # Download latest stations data + +cacheImages "eDP-1" "$OUTPUT_IMG_DIR" # Check for existing images and cache them if they exist +cacheImages "DP-2" "$OUTPUT_IMG_DIR" # Check for existing images and cache them if they exist +# TODO handle errors here + + + + +# Render Planets Centered on Tuscaloosa +# TODO udpate with current long and lat + +# xplanet -num_times 1 -output "$OUTPUT_IMG_ULTRAWIDE" -geometry "3840x1080" -config xplanet.conf -longitude -87.56 -latitude 33.21 +PROJECTIONS=( + azimuthal + mollweid + peters + polyconic +) +RENDER_FLAGS=( + -num_times 1 + -config xplanet.conf + -longitude -87.56 + -latitude 33.21 + -radius 40 + -range 2 + # -projection "${PROJECTIONS[1]}" + -starfreq 0.005 + -starmap BSC + -base_magnitude 12 + # -separation moon:45 + # -body moon + # -glare 30 +) + +# TODO: make the rest of this functional and handle errors better, maybe even make it a function that takes the monitor name and resolution as args +echo Rendering wallpapers... +monitors="$(connectedMonitors)" +if [[ "$monitors" == *"DP-2"* ]]; then + echo "Ultrawide monitor detected" + # Render the ultrawide wallpaper at native resolution and then supersample it to a higher resolution for better quality while maintaining relative starmap + xplanet "${RENDER_FLAGS[@]}" \ + -output "$OUTPUT_IMG_ULTRAWIDE_NATIVE" \ + -geometry "$ULTRAWIDE_RES_NATIVE" \ + -base_magnitude 12 \ + && echo render ultrawide native resolution wallpaper successful || exit 1 #echo Error: failed to render ultrawide wallpaper at native resolution + + xplanet "${RENDER_FLAGS[@]}" \ + -output "$OUTPUT_IMG_ULTRAWIDE" \ + -geometry "$ULTRAWIDE_RES_FINAL" \ + -background "$OUTPUT_IMG_ULTRAWIDE_NATIVE" \ + && echo render ultrawide wallpaper superize successful || exit 1 # echo Error: failed to render ultrawide wallpaper at super resolution + + noctalia msg wallpaper-set DP-2 "$OUTPUT_IMG_ULTRAWIDE" 1>/dev/null && echo ultrawide wallpaper set successfully || echo Warning: not connected to monitor DP-2, wallpaper will not be set. +fi +if [[ "$monitors" == *"eDP-1"* ]]; then # TODO: technicall no if statement needed here, should be functional tho + echo "Builtin monitor detected" + # Render Builtin Wallpaper + xplanet "${RENDER_FLAGS[@]}" \ + -output "$OUTPUT_IMG_EDP" \ + -geometry "2560x1600" \ + && echo render builtin wallpaper successful || exit 1 # echo Error: failed to render builtin wallpaper + + noctalia msg wallpaper-set eDP-1 "$OUTPUT_IMG_EDP" 1>/dev/null && echo builtin wallpaper set successfully || echo Warning: not connected to monitor eDP-1, wallpaper will not be set. +fi + +# Remove tmp cached files if noctalia was able to set the new wallpapers successfully, otherwise keep the tmp files +# errorCheck=$? +# [[ "$errorCheck" -eq 0 ]] && cleanup diff --git a/eDP-1 b/eDP-1 new file mode 100644 index 0000000..f24fbdd Binary files /dev/null and b/eDP-1 differ diff --git a/flat-globe.png b/flat-globe.png new file mode 100644 index 0000000..913ec1e Binary files /dev/null and b/flat-globe.png differ diff --git a/full-res-source/clouds-alpha.jpg b/full-res-source/clouds-alpha.jpg new file mode 100644 index 0000000..8d38069 Binary files /dev/null and b/full-res-source/clouds-alpha.jpg differ diff --git a/full-res-source/clouds-alpha.jpg.etag b/full-res-source/clouds-alpha.jpg.etag new file mode 100644 index 0000000..5087c84 --- /dev/null +++ b/full-res-source/clouds-alpha.jpg.etag @@ -0,0 +1 @@ +"3754b588a6126e9725838eb1480539d4" diff --git a/full-res-source/clouds-alpha.png b/full-res-source/clouds-alpha.png new file mode 100644 index 0000000..c50daef --- /dev/null +++ b/full-res-source/clouds-alpha.png @@ -0,0 +1,190 @@ + + + + Live Cloud Maps - Free, near-realtime cloud maps of the whole Earth + + + + + + + + + + + + + + + +
+
+

Live cloud maps

+

This service provides free, near real-time, high resolution cloud maps of the whole Earth.

+

You can use them for 3D modelling, 2D graphics or any other purpose, without payment.

+

Images are updated every three hours, using EUMETSAT data. + The background of this page shows the latest image. + The top of this page shows the latest image. +

+ + + Learn more and get the images + + + Buy Me a Coffee at ko-fi.com +
+
+ + \ No newline at end of file diff --git a/full-res-source/earth-night.png b/full-res-source/earth-night.png new file mode 100644 index 0000000..3ce59dd Binary files /dev/null and b/full-res-source/earth-night.png differ diff --git a/full-res-source/earth.png b/full-res-source/earth.png new file mode 100644 index 0000000..9584289 Binary files /dev/null and b/full-res-source/earth.png differ diff --git a/full-res-source/earthspec.png b/full-res-source/earthspec.png new file mode 100644 index 0000000..39e205d Binary files /dev/null and b/full-res-source/earthspec.png differ diff --git a/full-res-source/moon.png b/full-res-source/moon.png new file mode 100644 index 0000000..de2f89b Binary files /dev/null and b/full-res-source/moon.png differ diff --git a/functions.sh b/functions.sh new file mode 100644 index 0000000..5f123a2 --- /dev/null +++ b/functions.sh @@ -0,0 +1,119 @@ +#!/usr/bin/env bash + +function downloadClouds() { #Download latest clouds image from matteason.co.uk if newer than the local copy exists + echo downloading latest cloud image if newer... + local sourceImage="${1:?Error output file not provided (arg 1)}" + local httpStatus curlStatus + local etagFile="${sourceImage}.etag" + + if [ ! -d "${sourceImage%/*}" ]; then # If the source directory does not exist, return an error code + echo Could not find source image directory for clouds image + return 1 + fi + # TODO return sample image if the source image does not exist, or if the download fails + # if [ ! -e "$sourceImage" ]; then # If the image path does not exist, return an error code + # echo Cloud source image path does not exist + # return 1 + # fi + + # Download the image saving the http status code and curl status code for error checking + httpStatus=$(curl -s --show-error -R \ + --write-out "%{http_code}" \ + --etag-compare "$etagFile" \ + --etag-save "$etagFile" \ + -o "$sourceImage" \ + "https://clouds.matteason.co.uk/images/8192x4096/clouds.jpg" ) + curlStatus="$?" + + if (( curlStatus != 0 )); then # return an error code if curl failed to download the image + echo "Cloud image request failed, curl exit status: $curlStatus" >&2 + return "$curlStatus" + fi + + case "$httpStatus" in # Report the status of the download based on the HTTP status code returned by curl + 200) echo "Cloud image successfully downloaded"; return 0 ;; + 304) echo "Cloud image already up to date"; return 0 ;; + "") echo "Cloud image successfully downloaded or already up to date"; return 0 ;; + *) echo "Error: failed to download clouds image, HTTP status: $httpStatus" >&2; return 1 ;; + esac +} + +function downloadStations() { # Download latest stations data from celestrak.org and format it to only include the names of the stations + echo downloading latest stations data... + curl -s --show-error -L -o "$STATIONS_TLE" "https://celestrak.org/NORAD/elements/gp.php?GROUP=stations&FORMAT=tle" && echo stations data downloaded successfully || echo Error: failed to download stations data + sed -i 's/\r//' "$STATIONS_TLE" #Strip carriage returns from file if they exist + # sed -n '1~3p' "$STATIONS_TLE" > "$STATIONS_FINAL" && echo stations data formatted successfully || echo Error: failed to format stations data + # sed -n '1~3p' stations.tle | sed 's/[[:space:]]*$//' > stations + sed -n '1~3p' stations.tle > stations + +} + +function connectedMonitors() { # returns list of connected monitors + monitors=$(hyprctl monitors -j | jq ".[].name") + echo "${monitors//$'\n'/ }" +} + + +function cacheImages() { # Validate that the images exist, cache them if they do, return a path to the temp image + # TODO make functional + local monitor="${1:?Error monitor name not provided (arg 1)}" + local imageDir="${2:?Error image directory not provided (arg 2)}" + local imagePath="$imageDir/$monitor-render.png" + if [ -e "$imagePath" ]; then # If the Image exists, move it to a temp file and set it as the wallpaper + echo image exists for "$monitor", caching old walpaper... + mv "$imagePath" "$imagePath.tmp" + noctalia msg wallpaper-set "$monitor" "$imagePath.tmp" 1>/dev/null && echo "$monitor walpaper cached" || echo "Warning: not connected to monitor $monitor, wallpaper will not be set." + # TODO return here + elif [ -e "$imagePath.tmp" ]; then # If temp exists but not the original, move temp back to original + # TODO report work + mv "$imagePath.tmp" "$monitor" + noctalia msg wallpaper-set "$monitor" "$imagePath.tmp" 1>/dev/null && echo "$monitor walpaper cached" || echo "Warning: not connected to monitor $monitor, wallpaper will not be set." + # TODO return here + else + echo Error: no previous image exists, using sample image instead + noctalia msg wallpaper-set eDP-1 "$imagePath/sample-render.png" 1>/dev/null || return 1 + # TODO return 1 instead of exiting, and handle the error in the calling function + fi + # TODO handle this case +} + +function old_cacheImages() { # Validate that the images exist and cache them if they do, otherwise use a sample image + # Noctalia must see an image path update in order to change the active wallpaper + # So set a tmp file with the current image, upodate to that tmp file, and then switch back once the image is rendered. + # TODO: only render monitors that currectly exist. + if [ -e "$OUTPUT_IMG_ULTRAWIDE" ]; then # Check for ultrawide image + echo ultrawide image exists, caching old walpaper... + mv "$OUTPUT_IMG_ULTRAWIDE" "$OUTPUT_IMG_ULTRAWIDE.tmp" + noctalia msg wallpaper-set DP-2 "$OUTPUT_IMG_ULTRAWIDE.tmp" 1>/dev/null && echo ultrawide walpaper cached || echo Warning: not connected to monitor DP-2, wallpaper will not be set. + elif [ -e "$OUTPUT_IMG_ULTRAWIDE.tmp" ]; then # If temp exists but not the original, move temp back to original + mv "$OUTPUT_IMG_ULTRAWIDE.tmp" "$OUTPUT_IMG_ULTRAWIDE" + else + echo Error: no builtin image exists, using sample image instead + noctalia msg wallpaper-set eDP-1 "test.png" 1>/dev/null || exit 1 + fi + + if [ -e "$OUTPUT_IMG_EDP" ]; then # Check for builtin image + echo builtin image exists, caching old walpaper... + mv "$OUTPUT_IMG_EDP" "$OUTPUT_IMG_EDP.tmp" + noctalia msg wallpaper-set eDP-1 "$OUTPUT_IMG_EDP.tmp" 1>/dev/null || exit 1 + elif [ -e "$OUTPUT_IMG_EDP.tmp" ]; then # If temp exists but not the original, move temp back to original + mv "$OUTPUT_IMG_EDP.tmp" "$OUTPUT_IMG_EDP" + else # Use a smample image if no original or temp exists + echo Error: no builtin image exists, using sample image instead + noctalia msg wallpaper-set eDP-1 "test.png" 1>/dev/null || exit 1 + fi +} + +function renderWallpaper() { + NATIVE_RES="$1" + MONITOR_NAME="$2" + XPLANET_ARGS=$3 + OUTPUT_RES="$" + + +} + +function cleanup() { # Cleanup temp files if no errors occurred + rm "$OUTPUT_IMG_ULTRAWIDE.tmp" + rm "$OUTPUT_IMG_EDP.tmp" +} diff --git a/images/DP-2-render.png b/images/DP-2-render.png new file mode 100644 index 0000000..c3b78d7 Binary files /dev/null and b/images/DP-2-render.png differ diff --git a/images/DP-2-render.png.tmp b/images/DP-2-render.png.tmp new file mode 100644 index 0000000..62fe741 Binary files /dev/null and b/images/DP-2-render.png.tmp differ diff --git a/images/blue-ULTRAWIDE-native.png b/images/blue-ULTRAWIDE-native.png new file mode 100644 index 0000000..7f7b7cc Binary files /dev/null and b/images/blue-ULTRAWIDE-native.png differ diff --git a/images/clouds-alpha.jpg b/images/clouds-alpha.jpg new file mode 100644 index 0000000..74bbe5b Binary files /dev/null and b/images/clouds-alpha.jpg differ diff --git a/images/clouds-alpha.jpg.etag b/images/clouds-alpha.jpg.etag new file mode 100644 index 0000000..32ed090 --- /dev/null +++ b/images/clouds-alpha.jpg.etag @@ -0,0 +1 @@ +"62cff0f01c8d144e941dcdc63a84253d" diff --git a/images/clouds-alpha.jpg.etag.sample b/images/clouds-alpha.jpg.etag.sample new file mode 100644 index 0000000..5087c84 --- /dev/null +++ b/images/clouds-alpha.jpg.etag.sample @@ -0,0 +1 @@ +"3754b588a6126e9725838eb1480539d4" diff --git a/images/clouds-alpha.jpg.sample b/images/clouds-alpha.jpg.sample new file mode 100644 index 0000000..8d38069 Binary files /dev/null and b/images/clouds-alpha.jpg.sample differ diff --git a/images/eDP-1-render.png b/images/eDP-1-render.png new file mode 100644 index 0000000..75ba8b0 Binary files /dev/null and b/images/eDP-1-render.png differ diff --git a/images/eDP-1-render.png.tmp b/images/eDP-1-render.png.tmp new file mode 100644 index 0000000..cc81e5b Binary files /dev/null and b/images/eDP-1-render.png.tmp differ diff --git a/images/moon.tif b/images/moon.tif new file mode 100644 index 0000000..e743063 Binary files /dev/null and b/images/moon.tif differ diff --git a/images/sample-render.png b/images/sample-render.png new file mode 100644 index 0000000..c3e7e79 Binary files /dev/null and b/images/sample-render.png differ diff --git a/renders/blue-ULTRAWIDE-native.png b/renders/blue-ULTRAWIDE-native.png new file mode 100644 index 0000000..50528f7 Binary files /dev/null and b/renders/blue-ULTRAWIDE-native.png differ diff --git a/renders/blue-ULTRAWIDE.png b/renders/blue-ULTRAWIDE.png new file mode 100644 index 0000000..14e84c0 Binary files /dev/null and b/renders/blue-ULTRAWIDE.png differ diff --git a/renders/blue-marble-EDP.png b/renders/blue-marble-EDP.png new file mode 100644 index 0000000..c3e7e79 Binary files /dev/null and b/renders/blue-marble-EDP.png differ diff --git a/renders/stars.png b/renders/stars.png new file mode 100644 index 0000000..aedda35 Binary files /dev/null and b/renders/stars.png differ diff --git a/sample-images/NASA-NIGHT-worldmap-2016.jpg b/sample-images/NASA-NIGHT-worldmap-2016.jpg new file mode 100644 index 0000000..eed7cfa Binary files /dev/null and b/sample-images/NASA-NIGHT-worldmap-2016.jpg differ diff --git a/sample-images/NASA-worldmap-october.jpg b/sample-images/NASA-worldmap-october.jpg new file mode 100644 index 0000000..b62569e Binary files /dev/null and b/sample-images/NASA-worldmap-october.jpg differ diff --git a/sample-images/cloudmap.png b/sample-images/cloudmap.png new file mode 100644 index 0000000..a4e678a Binary files /dev/null and b/sample-images/cloudmap.png differ diff --git a/sample-images/day.jpg b/sample-images/day.jpg new file mode 100644 index 0000000..d1b2600 Binary files /dev/null and b/sample-images/day.jpg differ diff --git a/sample-images/night.jpg b/sample-images/night.jpg new file mode 100644 index 0000000..c30cc94 Binary files /dev/null and b/sample-images/night.jpg differ diff --git a/sample-images/xplanet_poc.png b/sample-images/xplanet_poc.png new file mode 100644 index 0000000..c0c610b Binary files /dev/null and b/sample-images/xplanet_poc.png differ diff --git a/stations b/stations new file mode 100644 index 0000000..ddd59df --- /dev/null +++ b/stations @@ -0,0 +1,18 @@ +ISS (ZARYA) +POISK +CSS (TIANHE) +ISS (NAUKA) +FREGAT DEB +CSS (WENTIAN) +CSS (MENGTIAN) +HRC MONOBLOCK CAMERA +SZ-21 MODULE +DUPLEX +KNACKSAT-2 +GXIBA-1 +UITMSAT-2 +LEOPARD +HMU-SAT2 +PROGRESS-MS 34 +TIANZHOU-10 +SHENZHOU-23 (SZ-23) diff --git a/stations.tle b/stations.tle new file mode 100644 index 0000000..ed57fd7 --- /dev/null +++ b/stations.tle @@ -0,0 +1,54 @@ +ISS (ZARYA) +1 25544U 98067A 26286.43465595 .00005946 00000+0 11657-3 0 9991 +2 25544 51.6321 74.9235 0006732 257.7935 102.2300 15.48850287590084 +POISK +1 36086U 09060A 26286.43465595 .00005946 00000+0 11657-3 0 9999 +2 36086 51.6321 74.9235 0006732 257.7935 102.2300 15.48850287586352 +CSS (TIANHE) +1 48274U 21035A 26286.58038026 .00022176 00000+0 26300-3 0 9993 +2 48274 41.4695 322.9239 0000414 91.3605 268.7281 15.60678231311658 +ISS (NAUKA) +1 49044U 21066A 26286.43465595 .00005946 00000+0 11657-3 0 9997 +2 49044 51.6321 74.9235 0006732 257.7935 102.2300 15.48850287586394 +FREGAT DEB +1 49271U 11037PF 26285.63781208 .00012645 00000+0 17527-1 0 9993 +2 49271 51.6488 7.7998 0942190 186.1418 172.7167 12.45203430239662 +CSS (WENTIAN) +1 53239U 22085A 26286.58038026 .00022176 00000+0 26300-3 0 9996 +2 53239 41.4695 322.9239 0000414 91.3605 268.7281 15.60678231288232 +CSS (MENGTIAN) +1 54216U 22143A 26286.58038026 .00022176 00000+0 26300-3 0 9997 +2 54216 41.4695 322.9239 0000414 91.3605 268.7281 15.60678231308040 +HRC MONOBLOCK CAMERA +1 66052U 98067XS 26286.46245025 .03459387 12169-4 69110-3 0 9993 +2 66052 51.6040 19.0232 0008645 329.1073 30.9439 16.30553028 56790 +SZ-21 MODULE +1 66515U 25246C 26286.06481423 .00091945 10310-4 30828-3 0 9995 +2 66515 41.4690 286.8938 0010791 158.2745 201.8564 15.89534023 52411 +DUPLEX +1 66906U 98067XT 26286.59495366 .00071912 00000+0 52250-3 0 9994 +2 66906 51.6245 47.4027 0004595 291.5860 68.4648 15.72692002 49227 +KNACKSAT-2 +1 67683U 98067YA 26286.55464863 .00099059 00000+0 70833-3 0 9990 +2 67683 51.6259 53.9169 0009078 295.5456 64.4604 15.72896894 38827 +GXIBA-1 +1 67685U 98067YC 26286.64267861 .00152200 00000+0 84092-3 0 9991 +2 67685 51.6208 49.9457 0010530 300.0478 59.9477 15.78570177 38881 +UITMSAT-2 +1 67686U 98067YD 26286.58140857 .00799493 32685-3 12049-2 0 9991 +2 67686 51.6139 41.1435 0011791 320.9324 39.0835 16.03906447 38997 +LEOPARD +1 67687U 98067YE 26286.61761830 .00445036 00000+0 16163-2 0 9990 +2 67687 51.6208 49.8055 0011405 309.3308 50.6684 15.86729551 38803 +HMU-SAT2 +1 67688U 98067YF 26286.59839112 .00278409 00000+0 97593-3 0 9992 +2 67688 51.6234 45.8802 0009171 302.4185 57.5932 15.87879434 38857 +PROGRESS-MS 34 +1 68837U 26093A 26286.43465595 .00005946 00000+0 11657-3 0 9993 +2 68837 51.6321 74.9235 0006732 257.7935 102.2300 15.48850287587329 +TIANZHOU-10 +1 69049U 26102A 26286.58038026 .00022176 00000+0 26300-3 0 9996 +2 69049 41.4695 322.9239 0000414 91.3605 268.7281 15.60678231310986 +SHENZHOU-23 (SZ-23) +1 69180U 26113A 26286.58038026 .00022176 00000+0 26300-3 0 9994 +2 69180 41.4695 322.9239 0000414 91.3605 268.7281 15.60678231307865 diff --git a/test-render.sh b/test-render.sh new file mode 100755 index 0000000..76cb7de --- /dev/null +++ b/test-render.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# A testbed script for experimenting with rendering the live-earth-wallpaper. +# xplanet -num_times 1 -output "test-render.png" -geometry 2560x1600 -config xplanet.conf -origin moon -target earth +# xplanet -num_times 1 -output "test-render.png" -geometry 2560x1600 -config xplanet.conf -projection rectangular -origin moon -target earth +xplanet -num_times 1 -output "test-render.png" -geometry 2560x1600 -config xplanet.conf -projection rectangular -longitude -87.56 -latitude 33.21 + diff --git a/test.png b/test.png new file mode 100644 index 0000000..65d833c Binary files /dev/null and b/test.png differ diff --git a/xplanet.conf b/xplanet.conf new file mode 100644 index 0000000..eb2e3b0 --- /dev/null +++ b/xplanet.conf @@ -0,0 +1,15 @@ +# ~/.config/scripts/live-earth-wallpaper/xplanet.conf +[earth] +"Earth" +color={255,255,255} +map=./full-res-source/earth.png +night_map=./full-res-source/earth-night.png +cloud_map=./full-res-source/clouds-alpha.jpg +specular_map=./full-res-source/earthspec.png +cloud_gamma=0.7 +cloud_threshold=20 +twilight=12 +# satellite_file=stations +[moon] +image=./full-res-source/moon.png +magnify=15