CADmenu is a shell script that displays a menu of actions in response to Control-Alt-Delete. You can choose to shutdown or reboot the machine, enter single user mode, or cancel and return to whatever you were doing. It's straightforward to add your own options to the menu. I think this is more user-friendly than the way that many Linux systems currently handle shutdown and reboot. Here's a screenshot:
CADmenu has been developed on Debian GNU/Linux, but should be portable to other Linux systems. You can see the code here. The code is licensed under the terms of the GNU General Public License. Maybe distributions would like to do something like this by default? (Maybe some do.)
It works as follows when you are using a text terminal:
If you're using X things are a bit more complex:
The menu is drawn using the dialog program, which is installed on Debian systems by default (it's used for the debconf dialogs). On other distributions you may need to install it first; let me know if you have any advice for particular distributions that I can include here.
Nothing else used by CADmenu is unusual.
First, download the code using subversion. If you don't have a subversion client yet, install that first.
$ svn co http://svn.chezphil.org/cadmenu/trunk cadmenu $ cd cadmenu
Now compile the sendcad program:
$ make sendcad
As root, install cadmenu and sendcad in /usr/local/bin:
$ su # make install
Now you need to edit /etc/inittab to include the following. Comment-out any previous "ca" line.
# What to do when CTRL-ALT-DEL is pressed. ca:12345:ctrlaltdel:openvt -s -w -- /usr/local/bin/cadmenu
This instructs init to run cadmenu in a new virtual console. You need to tell init to re-read /etc/inittab by sending it SIGHUP:
# kill -HUP 1
You can now check that pressing ctrl-alt-del from a text console brings up the menu. If you choose cancel it should return you to the text console, but it would be wise to prepare for the worst and save any files first.
Finally you need to set up X. Further suggestions about how to do this would be appreciated. There are many different programs that can be used to bind keys to actions in X. Here are instructions for two, bbkeys and xbindkeys:
If you use bbkeys, put this in your .bbkeysrc:
[execute] (Control-Mod1-Delete) {/usr/local/bin/sendcad}
If you use xbindkeys, put this in your .xbindkeys:
"sendcad" control+mod1+delete
CADmenu is written by Phil Endecott. I'm also responsible for Anyterm, a terminal emulator on a web page, and Decimail, an email database.
If you have any suggestions for improvements or other comments you are weclome to contact me; an email link is here.