There are some nice sticky-note applications for Linux, and they're good places to write down reminders, like Ring Fred or Pick up a litre of milk.
Unfortunately, sticky-notes are no help to me at all. I'm often forgetful, and I'm more than likely to shut down my computer without checking to see if I've written a note to myself. To get around this problem, I wrote a couple of very simple scripts, each launched by an icon on my Xfce panel.
Clicking on the first, or 'reminder' icon brings up the dialog box shown in the first screenshot. Here I write a short reminder like Email merc @ FSM (second screenshot), then click OK.
The second icon is the logout icon on the panel. At least, it looks like the logout icon. If I click it and I haven't written a reminder, the usual Xfce logout dialog appears, and I can shut down my computer.
However, if I've written a reminder earlier in the session, then clicking on the logout icon brings up the dialog box shown in the third screenshot. The Xfce logout dialog appears if and only if I click OK on this reminder.
#How it works
The first icon launches this script:
#!/bin/bash
msg=$(zenity --width=350 --entry --title="Shutdown message" --text="Enter the reminder" --entry-text "To do:")
echo $msg > /home/bob/scripts/reminder.txt
exit 0
What this does is send the output of the Zenity dialog (what I enter in the box) to a newly created file reminder.txt in the scripts folder in my home directory.
The 'logout' icon launches the second script:
#!/bin/bash
if [ -e /home/bob/scripts/reminder.txt ]; then
zenity --width=250 --info --text="Remember to:\n$(cat /home/bob/scripts/reminder.txt)" && rm /home/bob/scripts/reminder.txt && xfce4-session-logout
else
xfce4-session-logout
fi
This script looks first to see in there's a reminder.txt file in the scripts folder. If there is, the Zenity reminder box pops up. When I click OK in this box, reminder.txt gets deleted and the logout dialog is summoned. If no reminder.txt exists, the script takes me straight to the logout dialog.
#Try this at home
As usual, getting the scripts into your system is easy. Just copy/paste each one into a text editor, and save each file with a suitable name. Mine are called logout_reminder.sh and logout_with_reminder.sh and they live in /home/bob/scripts. Make each script executable. If you're using either Thunar or Nautilus as your file manager, an easy way to do this is to right-click on the script's filename, choose Properties, then Permissions, then tick Program (Thunar) or Execute (Nautilus) to allow executing as a program.
There are different ways to add a launcher to your panel or desktop, depending on your desktop environment. In all cases what you want to launch is a command, and the command is (in my case) '/home/bob/scripts/logout_reminder.sh'.
The second script uses xfce4-session-logout
because Xfce is my desktop environment. The logout dialog command will be different with other DE's. Gnome users can try gnome-session-save --shutdown-dialog
in a terminal to see what happens.
Also as usual, there are other ways to do this 'don't-shutdown-without-reminding' trick, but these scripts work fine for me, and they're a lot more reliable than my memory!