gpm: Special Commands
2.1 Special Commands
====================
Version 1.10 adds the capability to execute _special_ commands on
certain circumstances. Special commands default to rebooting and
halting the system, but the user can specify his/her personal choice.
The capability to invoke commands using the mouse is a handy one for
programmers, because it allows to issue a clean shutdown when the
keyboard is locked and no network is available to restore the system to
a sane state.
Special commands are toggled by triple-clicking the left and right
button - an unlikely event during normal mouse usage. The easiest way
to triple-click is pressing one of the buttons and triple-click the
other one. When special processing is toggled, a message appears on the
console (and the speaker beeps twice, if you have a speaker); if the
user releases all the buttons and presses one of them again within three
seconds, then the special command corresponding to the button is
executed.
The default special commands are:
LEFT BUTTON
Reboot the system by signalling the init process
MIDDLE BUTTON (IF ANY)
Execute '/sbin/shutdown \-h now'
RIGHT BUTTON
Execute '/sbin/shutdown \-r now'
The '\-S' command line switch enables special command processing and
allows to change the three special commands. To accept the default
commands use '\-S ""' (i.e., specify an empty argument). To specify
your own commands, use a colon-separated list to specify commands
associated to the left, middle and right button. If any of the commands
is empty, it is interpreted as 'send a signal to the init process'.
This particular operation is supported, in addition to executing
external commands, because sometimes bad bugs put the system to the
impossibility to fork; in these rare case the programmer should be able
to shutdown the system anyways, and killing init from a running process
is the only way to do it.
As an example, '\-S ":telinit 1:/sbin/halt"', associates killing init
to the left button, going single user to the middle one, and halting the
system to the right button.
System administrators should obviously be careful about special
commands, as gpm runs with superuser permissions. Special commands are
best suited for computers whose mouse can be physically accessed only by
trusted people.