notif_set 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. # Erase previous notif and display new one in background process for a certain amount of seconds
  3. # Special char: ^ to add a new line
  4. # Set seconds to 0 to display indefinitely (until the next notif_set)
  5. NOTIFICATION_DISPLAY=/sys/class/graphics/fb0/notification
  6. display_usage() {
  7. echo -e "Usage:\n$(basename ${0}) nb_seconds_display message_to_display\n"
  8. }
  9. # If less than two arguments supplied, display usage
  10. if [ ${#} -le 1 ]; then
  11. echo "Erase previous notif and display new one in background process for a certain amount of time"
  12. echo "Special char: ^ to add a new line"
  13. echo "Set seconds to 0 to display indefinitely (until the next $(basename ${0}))"
  14. display_usage
  15. exit 1
  16. fi
  17. # Get number of seconds to display notif
  18. nb_secs=${1}
  19. if ! [ ! "${nb_secs}" -ne "${nb_secs}" ]; then
  20. echo "error: ${nb_secs} is not a number" >&2
  21. exit 1
  22. fi
  23. # Kill previous notif_disp process
  24. pkill notif_disp 2> /dev/null
  25. ## Clear previous notif
  26. #printf "clear" > ${NOTIFICATION_DISPLAY}
  27. # Print new notif
  28. notif_disp "$@" &
  29. exit 0