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