https://bugs.kde.org/show_bug.cgi?id=408563

themroc <rauchwe...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rauchwe...@gmail.com

--- Comment #17 from themroc <rauchwe...@gmail.com> ---
I use this bash script in the startup to automatically change Breeze Light/Dark
and the wallpaper.
It determines the sunrise and sunset for the site via the heliocron program:

#!/bin/bash

if ping -q -c 1 -W 1 8.8.8.8 >/dev/null; then
  longitude=$(curl ipinfo.io | jq -c ".loc" | tr -d '"' | awk -F',' '{print
$1}')
  latitude=$(curl ipinfo.io | jq -c ".loc" | tr -d '"' | awk -F',' '{print
$2}')
  if [ ! -f "/home/user/.location" ]; then
    echo "$longitude $latitude" > /home/user/.location
  else
    read -r longialt latialt < /home/user/.location
    if [ 1 != $(awk -v a="$latialt" -v b="$latitude" 'BEGIN{print(a==b)}') ] ||
[ 1 != $(awk -v a="$longialt" -v b="$longitude" 'BEGIN{print(a==b)}') ]; then
      cat /home/user/.location > /home/user/.locationalt
      echo "$longitude $latitude" > /home/user/.location
    fi
  fi
elif [ -f "/home/user/.location" ]; then
  read -r longitude latitude < /home/user/.location
else
  longitude=<defautlo>
  latitude=<defaultla>
fi

daystart=$(heliocron -l $longitude -o $latitude report | grep Sunrise | grep -o
'[0-9][0-9]:[0-9][0-9]:[0-9][0-9]')
daystop=$(heliocron -l $longitude -o $latitude report | grep Sunset | grep -o
'[0-9][0-9]:[0-9][0-9]:[0-9][0-9]')
currenttime=$(date +%H:%M:%S)
nextday=$(date --date="next day" +%F)
# thisday=$(date +%F)

if [[ "$currenttime" > "$daystart" ]] && [[ "$currenttime" < "$daystop" ]];
then
     lookandfeeltool -a org.kde.breeze.desktop
     plasma-apply-wallpaperimage
/home/user/Bilder/Background/Taucher1920x1080.jpg
     heliocron -l $longitude -o $latitude wait -e sunset && lookandfeeltool -a
org.kde.breezedark.desktop && plasma-apply-wallpaperimage
/home/user/Bilder/Background/DarkestHour1920x1080.jpg
     sleep 2m
     heliocron -d $nextday -l $longitude -o $latitude wait -e sunrise &&
lookandfeeltool -a org.kde.breeze.desktop && plasma-apply-wallpaperimage
/home/user/Bilder/Background/Taucher1920x1080.jpg
else
     lookandfeeltool -a org.kde.breezedark.desktop
     plasma-apply-wallpaperimage
/home/user/Bilder/Background/DarkestHour1920x1080.jpg
     if [[ "$currenttime" > "$daystop" ]]; then
        heliocron -d $nextday -l $longitude -o $latitude wait -e sunrise &&
lookandfeeltool -a org.kde.breeze.desktop && plasma-apply-wallpaperimage
/home/user/Bilder/Background/Taucher1920x1080.jpg
        sleep 2m
        heliocron -l $longitude -o $latitude wait -e sunset && lookandfeeltool
-a org.kde.breezedark.desktop && plasma-apply-wallpaperimage
/home/user/Bilder/Background/DarkestHour1920x1080.jpg
    else
        heliocron -l $longitude -o $latitude wait -e sunrise && lookandfeeltool
-a org.kde.breeze.desktop && plasma-apply-wallpaperimage
/home/user/Bilder/Background/Taucher1920x1080.jpg
        sleep 2m
        heliocron -l $longitude -o $latitude wait -e sunset && lookandfeeltool
-a org.kde.breezedark.desktop && plasma-apply-wallpaperimage
/home/user/Bilder/Background/DarkestHour1920x1080.jpg
    fi
fi

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to