Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Eject toggle key

  1. #1
    Join Date
    Aug 2005
    Location
    Scotland, United Kingdom.
    Beans
    19
    Distro
    Ubuntu Breezy 5.10

    Lightbulb HOWTO: Creating an eject toggle key

    (Taken from: http://gav.brokentrain.net/blog/)

    While I've always found the eject keyboard shortcut useful in gnome, one thing that has annoyed me is the inability to toggle between two states. (i.e. close it if its open, and vice versa.)

    Fortunately, since eject 2.1.0 this ability as been added as a new -T option. (See changelog here.)

    The following basic steps are needed to replace your old 'eject' with the new one:-
    • Uninstall the old version of eject
      sudo apt-get remove eject
    • Install the package provided here (Note: this is required, because despite 2.1.3's release on the above site the package seems to be unfortunately broken - which I've fixed by replacing a few missing files.)
      sudo dpkg -i eject-2.1.3_i386.deb
    • Success!
      Can be launched as usual using the eject -T flag which will now toggle your cdrom between states.


    Further steps (adding to keyboard shortcut.)

    This was a bit more tricky, since I found no way to edit gnomes “System -> Preferences -> Keyboard Shortcuts” list and had to be done via Configuration Edtior (gconf) in "Applications -> System Tools."

    It's divided into two main steps as follows:-

    Step 1

    • Decide on the key you want to bind.
      This might sound obvious, but on my Apple keyboard I wanted the specific to far right key labeled 'eject' to do this. This key is a multimedia one and had to be mapped specifically in order for this to work. (If you're just using an ordinary key, skip to step 2.)
    • Determine the multimedia keycode for this using 'xev'.
      Launch the command 'xev' in a terminal and hit the key a few times noting the 'keycode' parameter when the string is output to console. e.g:
      KeyRelease event, serial 29, synthetic NO, window 0x3200001,
      root 0x76, subw 0x0, time 5996809, (190,33), root:(200,130),
      state 0x0, keycode 204 (keysym 0xffc6, F9), same_screen YES,
      XLookupString gives 0 bytes:
    • Create an ~/.xmodmap or /etc/xmodmap mapping this key.
      Open a text editor and insert the line:
      keycode 204 = XF86VendorHome
      (where 204 is your key as above.)
    • Restart X. (Ctrl-alt-backspace.)


    Step 2

    • Open “Applications -> System Tools -> Configuration Edtior”.
    • Expand the “/apps/metacity/keybinding_commands/” section.
    • For the key name “command_1” insert the value “eject -T”
    • Switch to the “/apps/metacity/global_keybindings/” section.
    • For the key name “run_command_1” place the desired keyboard key sequence, (or the xmodmap mapping if you are using some special multimedia key and did the above.) i.e. 'XF86VendorHome'


    Success!

    All going well, the key you have set should now be toggling your cdrom.
    Last edited by shadow; January 9th, 2006 at 10:19 PM.

  2. #2
    Join Date
    Sep 2005
    Location
    MD
    Beans
    19

    Re: Eject toggle key

    Hey, no replies? I don't have an eject key on my keyboard, but I'm sure I'd be loving this if I did.

    I still curse myself everytime I reach under my desk and press eject, only to remember I need to eject it on my desktop!

  3. #3
    Join Date
    Aug 2005
    Location
    Scotland, United Kingdom.
    Beans
    19
    Distro
    Ubuntu Breezy 5.10

    Re: Eject toggle key

    Quote Originally Posted by Saiboogu
    Hey, no replies? I don't have an eject key on my keyboard, but I'm sure I'd be loving this if I did.

    I still curse myself everytime I reach under my desk and press eject, only to remember I need to eject it on my desktop!
    Hahaha, thing is you don't really need an eject keyboard as such - anything will do.

    ie Ctrl + e or something.

  4. #4
    Join Date
    Aug 2005
    Location
    /Australia/Albany/~/.
    Beans
    387
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Eject toggle key

    I set my comp up with Ctrl + Alt + e and it works great.
    Thanx
    Matt
    GUTSY!!!
    Matthewv on irc.freenode.net:6667

  5. #5
    tanari is offline Gee! These Aren't Roasted!
    Join Date
    Oct 2004
    Beans
    159
    Distro
    Ubuntu

    Re: Eject toggle key

    This was of the main features I wanted
    I put it to F12

  6. #6
    Join Date
    Jun 2005
    Location
    Pacific NorthWest
    Beans
    2,782
    Distro
    Ubuntu Development Release

    Question Re: Eject toggle key

    I just want to do this with my Apple keyboard & Apple G4---Do you know if there is a PPC eject with the same version #????
    "Let's nobody be dead today----Looks very bad on my report" One of my favourite lines from AVATAR
    Linux User#395230
    Ubuntu User# 13498

  7. #7
    Join Date
    Aug 2005
    Location
    Scotland, United Kingdom.
    Beans
    19
    Distro
    Ubuntu Breezy 5.10

    Re: Eject toggle key

    Quote Originally Posted by autocrosser
    I just want to do this with my Apple keyboard & Apple G4---Do you know if there is a PPC eject with the same version #????
    Hmm, I'm not entirely sure. The source is available over at http://ca.geocities.com/jefftranter@...com/eject.html you could always try compiling it. Note of warning though, there are a few missing files when you try to compile it and configure will fail.

    The way round this was to find another previous source (e.g. http://www.pobox.com/~tranter/eject-2.1.0.tar.gz) and copy the missing ones from that.

    Good luck if you try it though, but I'm not certain about this os X stuff or whatever.

    Edit: As the changelog says above, 2.1.0 was where the main option '-T' was added, and from here: http://www.redhat.com/archives/fedor.../msg00110.html I see some mention of a 'eject-2.1.1-0.fc4.1.ppc.rpm' for Fedora, so presumably 2.1.1 can be built successfully anyway.
    Last edited by shadow; November 23rd, 2005 at 10:56 PM.

  8. #8
    Join Date
    Dec 2004
    Location
    Slovenia
    Beans
    684
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: Eject toggle key

    Hm when cdrom is open eject -T doesn't work. It works with closed cdrom.

    BTW eject -t works. Wierd
    Im still in OpenSource age but I hope that through the years I will reach for the Free nirvana that is waiting me out there.
    Visit Ubuntu.si forums | My great blog Christoossov pasijon - Slovene version | Passion of the Christooss - English version

  9. #9
    Join Date
    Jun 2005
    Location
    Pacific NorthWest
    Beans
    2,782
    Distro
    Ubuntu Development Release

    Post Re: Eject toggle key

    Thanks for the info--BTW--I'm using Ubuntu PPC with a Dual1.25G--Just want to be able to do in Linux what I can do in OSX---The <Eject> opens & closes the Main DVD--<Option><Eject> opens the Slave DVD-ROM

    Just used Alien to install the RPM--will post my results

    11/24--Set-up as per the instructions--replaced the i386.rpm with eject-2.1.1-0.fc4.1.ppc.rpm--alien installed just fine--have the same (I guess) keyboard (Clear with Black keys)--keycode 204--<Eject> now opens & closes my main DVD--I just need to find a way to do my DVD-ROM (slave) now---
    Last edited by autocrosser; November 25th, 2005 at 07:31 AM.
    "Let's nobody be dead today----Looks very bad on my report" One of my favourite lines from AVATAR
    Linux User#395230
    Ubuntu User# 13498

  10. #10
    Join Date
    Aug 2005
    Location
    Scotland, United Kingdom.
    Beans
    19
    Distro
    Ubuntu Breezy 5.10

    Re: Eject toggle key

    Quote Originally Posted by autocrosser
    11/24--Set-up as per the instructions--replaced the i386.rpm with eject-2.1.1-0.fc4.1.ppc.rpm--alien installed just fine--have the same (I guess) keyboard (Clear with Black keys)--keycode 204--<Eject> now opens & closes my main DVD--I just need to find a way to do my DVD-ROM (slave) now---
    Hmm, as far as I know you can give eject a second parameter of the device you're trying to eject. ie I can eject my dvdrom: eject -T /dev/hdc and say, my ipod with eject /dev/sda2.

    Find out the device name of your slave and try passing the name to eject.

    eg eject -T /dev/hdd (maybe?) I'm not sure cause never had two cdroms

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •