Custom notifications
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Custom notifications
I would like to create a notification that displays a block of text or opens a text file at boot-up on specific dates. I looked at All Applications > Notifications but I cannot see how to use it. Any suggestions. please?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Custom notifications
How much bash experience do you have?
I can help you set up a really neat little thing, but I need to know how much of the code I need to write, or if I can just give you some quick ideas.
I can help you set up a really neat little thing, but I need to know how much of the code I need to write, or if I can just give you some quick ideas.
Re: Custom notifications
Try this code, as a sample of what could be done.
Copy this code and paste it into a text document. Save it on your desktop as "SpecialNotice".
Open a terminal and enter this:
Since today is 2020-09-26, double click it and run it in a terminal. Look up at the upper right of your screen.
Is this something that you could use? Can you edit the file to change the date and message? Please let me know how much help you need, and I'll be happy to assist.
Copy this code and paste it into a text document. Save it on your desktop as "SpecialNotice".
Code: Select all
#!/bin/bash
# Determine today's date in the format YYYY-mm-dd
mydate=$( date +%F )
if [[ $mydate == 2020-09-26 ]]; then
# notify-send - a program to send desktop notifications
# -u can be low, normal or critical (critical must be manually cleared)
# -i icons from /usr/share/icons
notify-send -u critical -i /usr/share/icons/gnome/16x16/emotes/face-smile.png "summary goes here" "the body goes here"
fi
# end of file
Code: Select all
chmod 755 ~/Desktop/SpecialNotice
Is this something that you could use? Can you edit the file to change the date and message? Please let me know how much help you need, and I'll be happy to assist.
Re: Custom notifications
If you like the SpecialNotice bash script, you can add it to your Startup Applications.
Open up Startup Applications, click the '+' at the bottom to Add, select Custom Command. Put in a name, perhaps "Special Notice", and then click Browse... to find and select your version of the SpecialNotice script. I'd recommend a startup delay of maybe 30 to 60 seconds. Save it. I recommend clicking on the 'Test' icon at the bottom right (it looks like gears). If everything is okay, exit Startup Applications, and you're done!
There are some other options. You might be interested in KAlarm with the ability set up alarms at special times and dates.
Open up Startup Applications, click the '+' at the bottom to Add, select Custom Command. Put in a name, perhaps "Special Notice", and then click Browse... to find and select your version of the SpecialNotice script. I'd recommend a startup delay of maybe 30 to 60 seconds. Save it. I recommend clicking on the 'Test' icon at the bottom right (it looks like gears). If everything is okay, exit Startup Applications, and you're done!
There are some other options. You might be interested in KAlarm with the ability set up alarms at special times and dates.
Re: Custom notifications
There are other options, too. For example you could change the script to use zenity...
Edit: BTW, zenity offers a number of different dialogs and options. Take a look at
Code: Select all
#!/bin/bash
# Determine today's date in the format YYYY-mm-dd
mydate=$( date +%F )
if [[ $mydate == 2020-09-28 ]]; then
# zenity is a program that will display GTK+ dialogs
# see man zenity for options
zenity --info --width=500 --timeout=60 --title="Title goes here" --text="Put the main body of your info here"
fi
if [[ $mydate == 2020-09-27 ]]; then
# notify-send - a program to send desktop notifications
# -u can be low, normal or critical (critical must be manually cleared)
# -i icons from /usr/share/icons
notify-send -u critical -i /usr/share/icons/gnome/16x16/emotes/face-smile.png "Title goes here" "Put the main body of your info here"
fi
# end of file
man zenity
for details!
Last edited by Welcome on Sun Sep 27, 2020 1:15 pm, edited 1 time in total.
Re: Custom notifications
To create a notification that displays a block of text or opens a text file at boot-up on specific dates, try this...
Code: Select all
#!/bin/bash
# Determine today's date in the format YYYY-mm-dd
mydate=$( date +%F )
if [[ $mydate == 2020-09-27 ]]; then
# xed is a text editor
xed ~/Desktop/SpecialNotice
fi
if [[ $mydate == 2020-09-28 ]]; then
# zenity is a program that will display GTK+ dialogs
zenity --info --width=500 --timeout=60 --title="Title goes here" --text="Put the main body of your info here"
fi
if [[ $mydate == 2020-09-29 ]]; then
# notify-send - a program to send desktop notifications
# -u can be low, normal or critical (critical must be manually cleared)
# -i icons from /usr/share/icons
notify-send -u critical -i /usr/share/icons/gnome/16x16/emotes/face-smile.png "Title goes here" "Put the main body of your info here"
fi
# end of file
Re: Custom notifications
Thanks, I think that points me in the right direction. I'm still learning the basics of Linux (takes a while at my age!). Hadn't spotted there's an application called Startup Applications.
Thanks again.
Thanks again.
Re: Custom notifications
Which version of Linux Mint are you using? If it's Linux Mint 20 Cinnamon, you can find Startup Applications on the menu under Preferences. Or, a quicker way to find it is to click on the start button, and then start typing 'start' in the search box. That's what I normally do. I've found that this search box is a lot easier if you know the name of the application.
Re: Custom notifications
Very nice approach. I wanted a simple alert and tried 'kalarm'. What I got was a slew of extra options which I did not want. To make matters worse, the extra 'stuff' slowed down my system. So, I purged the 'akonadi' stuff and got my system performance back to normal.
I came across this posting while searching the forums. Thank you. I'll combine the zenity idea with a crontab entry to get the selectivity I need for popping the notification on the screen. Example: every Monday through Friday at 1 pm, pop a reminder on the screen.
I came across this posting while searching the forums. Thank you. I'll combine the zenity idea with a crontab entry to get the selectivity I need for popping the notification on the screen. Example: every Monday through Friday at 1 pm, pop a reminder on the screen.
Welcome wrote: ⤴Sun Sep 27, 2020 7:32 am There are other options, too. For example you could change the script to use zenity...
Edit: BTW, zenity offers a number of different dialogs and options. Take a look atCode: Select all
#!/bin/bash # Determine today's date in the format YYYY-mm-dd mydate=$( date +%F ) if [[ $mydate == 2020-09-28 ]]; then # zenity is a program that will display GTK+ dialogs # see man zenity for options zenity --info --width=500 --timeout=60 --title="Title goes here" --text="Put the main body of your info here" fi if [[ $mydate == 2020-09-27 ]]; then # notify-send - a program to send desktop notifications # -u can be low, normal or critical (critical must be manually cleared) # -i icons from /usr/share/icons notify-send -u critical -i /usr/share/icons/gnome/16x16/emotes/face-smile.png "Title goes here" "Put the main body of your info here" fi # end of file
man zenity
for details!
Linux Mint 21.1 Cinnamon
Re: Custom notifications
An alternative to zenity is yad, not installed by default. It offers more options than zenity.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Re: Custom notifications
Thank you for the information. I'll have a look at 'yad'
Linux Mint 21.1 Cinnamon