From 47f0648e6e1a6ea034fccf7744b8dd837df4d87e Mon Sep 17 00:00:00 2001
From: Sébastien Dailly <sebastien@dailly.me>
Date: Wed, 3 Aug 2022 13:49:35 +0200
Subject: Update the wallpaper background script

---
 bspwm/scripts/bspwm/wallpaper.sh | 54 +++++++++-------------------------------
 1 file changed, 12 insertions(+), 42 deletions(-)

diff --git a/bspwm/scripts/bspwm/wallpaper.sh b/bspwm/scripts/bspwm/wallpaper.sh
index ab2ab14..d2133fe 100755
--- a/bspwm/scripts/bspwm/wallpaper.sh
+++ b/bspwm/scripts/bspwm/wallpaper.sh
@@ -1,46 +1,16 @@
 #!/bin/sh
-#image=$(find ~/wallpaper/wallpaper/wallpapers -type f \( -name '*.jpg' -o -name '*.png' \) -print0 | shuf -n1 -z | xargs -0)
-image=$1
 
-#height=$(identify -format '%[fx:h/1.11]' ${image})
-#convert -crop %100x10+0+${height} ${image} out.jpg
-#color=$(.virtualenvs/pywal/bin/colorz -n 1 --no-preview out.jpg | cut -d' ' -f1)
-#rm out.jpg
-#echo $color
-#neg=$(python ~/scripts/i3/negate_color.py "${color}")
+# Traverse the chromatic circle in 5 hours
+cutoff=18000
+background="#eceff4"
 
-#.virtualenvs/pywal/bin/wal -n -i "${image}" --saturate .8 -a 90
-#hsetroot \
-#    -fill "${image}" \
-#    -add "#ffffffff" \
-#    -addd "#77777700" 5 \
-#    -addd "#ffffff00" 10 \
-#    -addd "#ffffff00" 90 \
-#    -gradient 0
+# L’angle tourne toute les secondes
+angle=$(echo "$(date +%s) % 360" | bc)
+dominant=$(python3 -c "import colorsys ; import datetime ; now = datetime.datetime.now() ; min = datetime.datetime.min ; sec = (now - min).seconds % $cutoff ; print(''.join('%02x' % int(i*255) for i in colorsys.hsv_to_rgb(sec/$cutoff, 0.35, 1)))")
+background=$(python3 -c "import colorsys ; import datetime ; now = datetime.datetime.now() ; min = datetime.datetime.min ; sec = (now - min).seconds % $cutoff ; print(''.join('%02x' % int(i*255) for i in colorsys.hsv_to_rgb(sec/2000, 0.2, 1)))")
+#background='ff0000'
 
-#if [ -z "${VNCDESKTOP}" ]; then 
-#  hsetroot \
-#    -fill "${image}" \
-#    -add "#ffffff77" \
-#    -addd "#ffffff77" 2 \
-#    -addd "#ffffff00" 0 \
-#    -addd "#ffffff00" 90 \
-#    -gradient 0
-#else 
-    #dominant=$(hexdump -n 3 -e '"%06X" 1 "\n"' /dev/urandom)
-
-    # Traverse the chromatic circle in 5 hours
-    cutoff=18000
-    background="#eceff4"
-
-    dominant=$(python3 -c "import colorsys ; import datetime ; now = datetime.datetime.now() ; min = datetime.datetime.min ; sec = (now - min).seconds % $cutoff ; print(''.join('%02x' % int(i*255) for i in colorsys.hsv_to_rgb(sec/$cutoff, 0.35, 1)))")
-    hsetroot \
-    -solid "#${dominant}"  \
-    -add  "${background}" \
-    -addd  "${background}" 5 \
-    -addd "#ffffff77" 40 \
-    -addd "#ffffff77" 90 \
-    -addd "#F0F0F0FF" 40 \
-    -addd "#F0F0F0" 5 \
-    -gradient 0
-#fi
+hsetroot \
+-add "#${dominant}"  \
+-add  "#${background}" \
+-gradient ${angle}
-- 
cgit v1.2.3