move and adapt wallpaper changer

This commit is contained in:
Lucas Vivo committed 2026-10-16 20:14:31 +02:00
1 parent 35c2104852
commit be012e334b
1 file changed
+30 -15
@@ -2,24 +2,29 @@
## For laptop lid trigger: Write following in /etc/acpi/events/lm_lid
# event=button/lid.*
# action=/data/DatenLucas/Dokumente/Dokumente/Projekte/Server/scripts/quiethost/wallpaperChanger.sh -l -c
#set -Eeuo pipefail
HOST="$(hostname)"
IMG_FOLDER="Desktop1920x1080/"
if [ "${HOST}" == "serverhost" ]; then
LOG_DIR="/torrent/WallpaperChanger/.LOG/"
LOG_DIR="/torrent/WallpaperChanger/logs/"
IMG_DIR="/torrent/WallpaperChanger/"
Wallpaper_Dir="${IMG_DIR}Win10Wallpaper"
PrivKey="file:/home/lucas/Documents/Dokumente/Projekte/Server/quiethost/IMG_privateKey.pem"
elif [ "${HOST}" == "quiethost" ]; then
LOG_DIR="/home/lucas/.LOG/"
LOG_DIR="/home/lucas/logs/"
IMG_DIR="/data/Nextcloud/Stuff/Wallpaper/"
Wallpaper_Dir="${LOG_DIR}Wallpaper"
PrivKey="file:/data/Nextcloud/Documents/Dokumente/Projekte/Server/quiethost/IMG_privateKey.pem"
elif [ "${HOST}" == "vivohost" ]; then
LOG_DIR="/home/lucas/.LOG/"
LOG_DIR="/home/lucas/logs/"
IMG_DIR="/home/lucas/Nextcloud/Wallpaper/"
Wallpaper_Dir="${LOG_DIR}Wallpaper"
IMG_FOLDER="Desktop1920x1080/"
PrivKey="file:/home/lucas/Nextcloud/Dokumente/Projekte/Server/quiethost/IMG_privateKey.pem"
fi
mkdir -p $LOG_DIR
X_FOLDER="corrupt"
DAEMON=false
LOG=false
@@ -97,11 +102,16 @@ change_image(){
ConvertSTR=""
time_stamp=$(date +'%d%m%y_%H%M%S')
if [[ "${HOST}" == "quiethost" ]] || [[ "${HOST}" == "vivohost" ]]; then
Wallpaper_Str="${LOG_DIR}Wallpaper/Wallpaper_${time_stamp}"
mkdir -p "${LOG_DIR}Wallpaper"
Wallpaper_Str="${LOG_DIR}Wallpaper/Wallpaper_${time_stamp}"
else
mkdir -p "${LOG_DIR}Win10Wallpaper"
Wallpaper_Str="${IMG_DIR}Win10Wallpaper/Wallpaper_${time_stamp}"
fi
Wallpaper_TriLite_Str="${IMG_DIR}TriLiteWallpaper/Wallpaper_${time_stamp}"
if [[ ${COPY_TR} -eq 1 ]] && [[ "${HOST}" != "quiethost" ]]; then
mkdir -p "${LOG_DIR}TriLiteWallpaper"
Wallpaper_TriLite_Str="${IMG_DIR}TriLiteWallpaper/Wallpaper_${time_stamp}"
fi
imageWidthFinal=0
echo Mon: ${MONITOR_num}
@@ -125,7 +135,8 @@ change_image(){
if [ ${IMG_count} -eq 0 ];then
echo "No image found for ${SEARCH_STR}"
if [ "${SEARCH_STR}" == "" ];then
exit 1
echo "Search string empty"
exit 1
else
SEARCH=""
continue
@@ -205,7 +216,10 @@ change_image(){
## Aspect Ratio Part
imageAR=$(getAspectRatio ${IMG})
printf "Mon: %d: $(echo ${IMG} | rev | cut -f1 -d'/' | rev) ImAR: %s - MonAR: %s - ScrAR: %s\n" "${j}" "${imageAR}" "${screen_Aspect_Ratio[$j]}" "${screenAR}"
if [[ "$IMG" == "" ]]; then exit; fi
if [[ "$IMG" == "" ]]; then
echo "Image empty"
exit;
fi
BIGIMG=false
AR_tolerance="0.26"
Wallpaper_Name="${Wallpaper_Str}_${j}.png"
@@ -729,7 +743,8 @@ sync_image() {
fi
}
get_config() {
while [[ ${1:0:1} == - ]]; do
while [[ $# -gt 0 && ${1:0:1} == "-" ]]; do
echo "Param: $1"
[[ $1 == -clear ]] && {
CLEAR_ALL=true;
@@ -739,7 +754,7 @@ while [[ ${1:0:1} == - ]]; do
[[ $1 == -t ]] && {
if [ $# -lt 2 ]; then
usage
exit
exit 1
fi
minutes=$2;
DAEMON=true;
@@ -751,7 +766,7 @@ while [[ ${1:0:1} == - ]]; do
[[ $1 == -screen ]] && {
if [ $# -lt 2 ]; then
usage
exit
exit 1
fi
SIZE=$2;
shift 2;
@@ -760,7 +775,7 @@ while [[ ${1:0:1} == - ]]; do
[[ $1 == -mon ]] && {
if [ $# -lt 2 ]; then
usage
exit
exit 1
fi
MONITOR_num_ext=$2;
shift 2;
@@ -769,7 +784,7 @@ while [[ ${1:0:1} == - ]]; do
[[ $1 == -p ]] && {
if [ $# -lt 2 ]; then
usage
exit
exit 1
fi
CUSTOM_DIR=true;
IMG_DIR=$2;
@@ -870,7 +885,7 @@ while [[ ${1:0:1} == - ]]; do
};
[[ $1 == -dec_all ]] && {
decode_all
exit
exit 0
};
[[ $1 == -printNT ]] && {
printNamingTable
@@ -903,7 +918,7 @@ while [[ ${1:0:1} == - ]]; do
continue;
}
echo "Parameter $1 discarded"
exit
exit 1
shift 1;
done
}
@@ -986,7 +1001,7 @@ echo "User: $(whoami)"
if ${DAEMON}; then
if [ "`echo $minutes | egrep ^[[:digit:]]+$`" = "" ];then
echo "$minutes is not an Integer"
exit
exit 1
else
echo "Interval: $minutes min"
fi