37 lines
1.0 KiB
Bash
Executable File
37 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# Erase previous notif and display new one in background process for a certain amount of seconds
|
|
# Special char: ^ to add a new line
|
|
# Set seconds to 0 to display indefinitely (until the next notif_set)
|
|
|
|
NOTIFICATION_DISPLAY=/sys/class/graphics/fb0/notification
|
|
|
|
display_usage() {
|
|
echo -e "Usage:\n$(basename ${0}) nb_seconds_display message_to_display\n"
|
|
}
|
|
|
|
# If less than two arguments supplied, display usage
|
|
if [ ${#} -le 1 ]; then
|
|
echo "Erase previous notif and display new one in background process for a certain amount of time"
|
|
echo "Special char: ^ to add a new line"
|
|
echo "Set seconds to 0 to display indefinitely (until the next $(basename ${0}))"
|
|
display_usage
|
|
exit 1
|
|
fi
|
|
|
|
# Get number of seconds to display notif
|
|
nb_secs=${1}
|
|
if ! [ ! "${nb_secs}" -ne "${nb_secs}" ]; then
|
|
echo "error: ${nb_secs} is not a number" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Kill previous notif_disp process
|
|
pkill notif_disp 2> /dev/null
|
|
|
|
## Clear previous notif
|
|
#printf "clear" > ${NOTIFICATION_DISPLAY}
|
|
|
|
# Print new notif
|
|
notif_disp "$@" &
|
|
exit 0
|