initial commit
This commit is contained in:
Executable
+90
@@ -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
|
||||
Reference in New Issue
Block a user