PLEASE NOTE: This article is for earlier versions of Ubuntu running on Gnome 2.x, so you will not be able to add this to the panel in Unity (the default desktop environment) or Gnome Shell, both of which are based on Gnome 3. You can, however, make desktop launchers, or find other ways to execute the eject command. If using Gnome “Classic” or KDE, you can still add eject and close buttons to your panel.
While the eject command obviously ejects the disc tray, many are stumped when it comes to the opposite: a command to close the disc tray. It is quite simply eject -t, but you can get the equivalent and much more if you install the package cdtool. It is a collection of command-line tools for your disc drive, and the one you are after is cdclose. You can then make a launcher for your panel (for either eject -t or cdclose) to add next to your eject button.
For those interested in some extra tools for their disc drive, all the commands you get in the cdtool metapackage are:
cdctrl cdloop cdadd cdown cdtool2cddb
cdplay cdpause cdstop cdclose cdeject
cdir cdinfo cdreset cdvolume cdshuffle
To find out a bit of info on usage on each, just enter the command in a terminal, followed by a space and -h (for Help). To close the disc tray, all you need is the cdclose command.
To install, either open Synaptic and mark cdtool for installation, or paste the following into a terminal:
sudo apt-get install cdtool
Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!