i3lock.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. ##CHECK IF I3LOCK IS RUNNING AND SUSPEND AFTER 5 MINS
  4. #while true; do
  5. # lock=$( ps aux | grep '[i3]lock')
  6. # if [ -n "$lock" ]; then
  7. # sleep 5m
  8. # systemctl suspend
  9. # fi
  10. # sleep 5
  11. #done
  12. location=${WALLPAPERS:-"${HOME}/Pictures"}
  13. find "$location" -type f -name "*.png" -print0 | shuf | head -zn1 | xargs --null -- i3lock -n -i
  14. # width=$(xwininfo -root | awk 'FNR == 8 {print $2}')
  15. # height=$(xwininfo -root | awk 'FNR == 9 {print $2}')
  16. # resolution="${width}x${height}"
  17. # # if ratio is 21:9, then let image be a locker wallpaper
  18. # ratio=$(( width / height ))
  19. # images=$(find "$location" -type f -name "*.png" -print0 | shuf)
  20. # for img in $images; do
  21. # # read width height < <(identify -format "%w %h" "${img}")
  22. # width=$(identify -format "%w" "$img")
  23. # height=$(identify -format "%h" "$img")
  24. # # ratio=$(( width / height ))
  25. # echo $width
  26. # echo $height
  27. # # if [[ $ratio -gt 2 ]]; then
  28. # # echo 0
  29. # # else
  30. # # echo 1
  31. # # fi
  32. # # echo "$img"
  33. # done
  34. # # fdfind -t f -e png -1 -0 --absolute-path --full-path "$location" | xargs --null -I {} i3lock -n -i {}
  35. # # find "$location" -type f -name "*.png" -print0 | shuf | head -zn1 | xargs --null -- i3lock -n -i
  36. # # can use imagemagick for this
  37. # # https://legacy.imagemagick.org/Usage/blur/