Create a Shortcut and Hotkey to Eject Your CD/DVD Drive in Linux [HowTo]

The How-To Geek weblog recently made a post on creating desktop and keyboard shortcuts to eject your CD/DVD drive. Wow! this is so coool... I mean, I have been using Linux for a couple of years now. I have been using keyboard and desktop shortcuts to eject (and close) CD/DVD tray in my Ubuntu/Fedora box long back and never once realized that this was a hot blogable topic that could hit the front of lifehacker.
Me dump. Me idiot. Well, since How-To Geek doesn't appear to know about a stuff called "Linux", here goes my How-To on doing the same on Linux... Better late than never.

HowToGeek uses a piece of software from NirSoft to do the above said magic. Linux users might be a bit disappointed here, because they don't have to install another software to do this magic. ;)

Create a Shortcut to Eject the CD/DVD Drive

  1. Right click anywhere on the desktop and select "Create Launcher..."

  2. Enter the name as "Eject DVD" and command as "eject /dev/scd0"

  3. Do you mind if I don't spoon feed you on getting a CD/DVD icon for your shortcut?

Create a Shortcut to Close the CD/DVD Drive

Same as above, except that the command is eject -t /dev/scd0

Assign a Hotkey to the Shortcut

Well, (unlike in Windows) you don't have to create a shortcut to have a Hot Key in Linux.
  1. Hit Alt + F2. In the run dialog enter "gconf-editor" and hit enter.
  2. Go to "apps" -> "metacity" -> "global_keybindings"
  3. Double click on e.g. "run_command_1"
  4. Type in <Control><Alt>c
  5. Go to "apps" -> "metacity" -> "keybinding_commands"
  6. Double click on e.g. "command_1"
  7. Type in "eject /dev/scd0"

This creates a hot key - Control + Alt + c to eject your CD/DVD drive. Similarly create another hot key with run_command_2 = <Control><Alt>v and command_2 = eject -t /dev/scd0 which will eject your CD drive using Control + Alt + v.

Happy Ejecting.