Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1009 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. #!/bin/sh
  2. if [ "$1" = "-f" ]; then
  3. cached=""
  4. else
  5. cached=$(cat "$XDG_RUNTIME_DIR"/day_cache)
  6. fi
  7. hour=$(date +"%-H")
  8. morning=6
  9. afternoon=12
  10. night=19
  11. if [ "$hour" -le "$morning" ]; then
  12. if [ ! "$cached" = "night" ]; then
  13. feh --no-fehbg --bg-fill "$(find ~/.local/backgrounds/evening | sort -R | tail -1 )"
  14. echo "night" > "$XDG_RUNTIME_DIR/day_cache"
  15. fi
  16. elif [ "$night" -le "$hour" ]; then
  17. if [ ! "$cached" = "night" ]; then
  18. feh --no-fehbg --bg-fill "$(find ~/.local/backgrounds/evening | sort -R | tail -1 )"
  19. echo "night" > "$XDG_RUNTIME_DIR/day_cache"
  20. fi
  21. elif [ "$afternoon" -le "$hour" ]; then
  22. if [ ! "$cached" = "afternoon" ]; then
  23. feh --no-fehbg --bg-fill "$(find ~/.local/backgrounds/afternoon| sort -R | tail -1 )"
  24. echo "afternoon" > "$XDG_RUNTIME_DIR/day_cache"
  25. fi
  26. else
  27. if [ ! "$cached" = "morning" ]; then
  28. feh --no-fehbg --bg-fill "$(find ~/.local/backgrounds/morning | sort -R | tail -1 )"
  29. echo "morning" > "$XDG_RUNTIME_DIR/day_cache"
  30. fi
  31. fi