Results 1 to 10 of 10

Thread: Extra keyboard keys PET

  1. #1

    Extra keyboard keys PET

    Is there someone in-the-know who could make a PET on how to get those extra keyboard buttons working? I have one that adjusts the volume (Up and down) How can I get those working? I also have play/pause, stop, mute, next track a previous track buttons. Can I get them to work with Xmms?

  2. #2
    Guest

    Re:Extra keyboard keys PET

    i believe this can be done with the xmodmap command
    i used it to modify the numbering map of my mouse for my side buttons PET, but it can be used to modify the map of the keyboard as well so it might be possible that u can assign short-cuts to those special keys that way.

  3. #3
    Junior Member
    Join Date
    May 2001
    Posts
    53

    Re:Extra keyboard keys PET

    Yeah, I used xmodmap also for my old Compaq keyboard. That thing has like 15 extra buttons on it. And I use them all. Who needs a mouse anyway?

    If no one else does it, I'll see if I can slap something together for this over the next few days.

  4. #4

    Re:Extra keyboard keys PET

    it would also be nice if you include how to set the right locales, things like
    localedef or export LC_ALL - iirc

  5. #5
    Junior Member
    Join Date
    May 2001
    Posts
    53

    Re:Extra keyboard keys PET

    The locales thing will have to wait for someone else, as I'm not too familiar with it myself. If work slows down some today, I might be able to do the other part by close of business today, otherwise it will have to wait for the weekend. When it gets written, I'll post it here for review/comments before I submit it.

  6. #6

    Re:Extra keyboard keys PET

    Maybe I could write just a locale PET to set up your localisation(sp?) correctly
    ..

  7. #7
    Junior Member
    Join Date
    May 2001
    Posts
    53

    Re:Extra keyboard keys PET

    Okay, better late than never. Here's my PET on setting up the extra keyboard keys. Let me know if there's any corrections you want to see before it goes in. If someone writes up a quick shortcuts part for KDE or another window manager, that would be cool. It's a bit longer than I intended and it rambles on some, but then so do I.
    ********************
    Extra Keyboard keys PET

    Have one of those fancy "Internet Keyboards", the ones with all those
    extra buttons across the top? I do. My old Compaq came with one, and
    foolish me assumed that after the switch to Linux, they would become
    useless to me. However, a few months ago I bought a new laptop that had
    some buttons across the top that I wanted to use, so I was forced to
    figure out how it all works. I must now admit that my grasp on the whole
    keymapping deal is a little shaky in parts, but I can get the keys
    working. I'll show you how to do it the easy way.

    For this you will need xev, the X Event Viewer, which is usually
    installed with Xf86, if not a quick search on google will probably help
    you find it.

    Ready now? Okay, let's go.

    If it's not running already, start X to get the graphical display.

    Now, in a terminal window, type "xev" without the quotes. A small window
    should pop up on your display with the title Event Tester.

    Now push some buttons and watch the text in the terminal window you
    launched xev from. Fun, isn't it?

    Example output:

    KeyPress event, serial 27, synthetic NO, window 0x2e00001,
    root 0x78, subw 0x0, time 2698322409, (471,229), root485,283),
    state 0x0, keycode 53 (keysym 0x78, x), same_screen YES,
    XLookupString gives 1 characters: "x"

    Push the multimedia buttons you want to use, and make note of the
    keycode that appears in the terminal window when you push each one (53
    from my example above, the letter "x&quot.

  8. #8
    Junior Member
    Join Date
    May 2001
    Posts
    53

    Re:Extra keyboard keys PET

    Okay, now that we're armed with the appropriate keycodes for all of our
    special buttons, we'll move right along to making them work.

    Here we use a program named xmodmap to change our keyboard mapping to
    include the non-standard buttons. This is where things get interesting.
    Each distribution, it seems, has configured xmodmap to look different
    places for its configuration files. Since I'm a LFS kind of guy, I built
    it my way. I'll explain that first, then try to help you others. Stick
    with me.

    First we write a very simple shell script to call xmodmap and make our
    modifications to the keymap. The switch to do this in xmodmap is -e,
    followed by the keycode and what you wanted to equate it to. Man xmodmap
    will show you all the other neat stuff you can do with it.

    Example: xmodmap -e "keycode 129 = F13"
    This will map the keycode 129 (the play button on my laptop) to register as
    F13. Function keys above 12 are generally safe, unless you actually have
    them on your keyboard. I know some people who start at 24, just to be
    safe, but I haven't had any problems (famous last words) with F13 on up.

    My xmodmap script then looks like this:
    xmodmap -e "keycode 129 = F13" \
    -e "keycode 130 = F14" \
    -e "keycode 131 = F15" \
    -e "keycode 132 = F16"

    I named this file, originally enough, Xmodmap, and stuffed it in my
    $HOME/bin directory, but you can put it whereever you want. Do a
    "chmod +x Xmodmap" or whatever you named it to make it executable.
    Now would also be a good time to check if it works. Enter the directory
    where you have it stored, and type "./Xmodmap". Now,
    run xev again and press all the buttons you tried to map in the script.
    They should now show the keyname (F whatever) in the keysym field, right
    after the keycode field.

    Now, we need to make this execute everytime X starts. I added a line in
    my .xinitrc that points to the script, like this:
    # Begin .xinitrc file
    /home/kuma/bin/Xmodmap &
    gnome-session
    # End .xinitrc file

    This works nicely for me. Now those of you who have distros may have to
    find a file called .Xmodmap, usually in your home directory if I'm not
    mistaken and add the "keycode ??? = F??" in there. Other distros have a
    whole Xmodmap script already, so read up on your distro's documentation
    to find where to make mods. A good place to start looking is the
    linux-dell-laptops group at Yahoo. That's where I got started on all of
    this. Do search for xmodmap and your distro name, and you'll probably
    get some hits. Or just post to the list. They are super friendly and
    will likely help you whether you run linux on a dell laptop or not.

    Okay, now that that is over, I can hear you asking "Well the play button
    is now registered as F13. What good does that do me? It still doesn't
    play Xmms when I want it to." Glad you asked. This part is different in
    all window managers, but I'll talk about gnome/sawfish since that
    is what I used this on. You should be able to figure it out how for
    your WM after seeing it done there.

    In Gnome/Sawfish, open up the Gnome Control Center and scroll
    all the way down into the Sawfish window manager settings. Click on
    shortcuts. Select add, then grab. Push the key you are going to use,
    we'll keep using play as an example. Now in the box marked "Key" it
    should say F13 (or whatever you mapped it to). Scroll down the Command
    list until you see "Run shell command". When you select this, you'll see
    a new box labeled "Command". Type the command you want executed when you
    push the button. I put "xmms -t". You could also use the -p option for
    xmms, but -t is the play/pause option, and -p is just play. Man xmms for
    the others. Click Ok, then repeat for all the keys you want to map. You
    can have keys open mozilla, open xterms, etc. A nice program you may
    want to look into is called xmmsctrl. It allows you to use option in
    xmms that there aren't command line switches for, like openning the
    playlist.

    If you want to write up how to set the shortcuts in your window manager
    of choice, let me know and I'll put them here for all the world to see,
    proper credit given, of course.

    Done. Wasn't that easy? And now you'll wonder how you ever lived without
    those buttons.

    Some good places to look for more information:
    http://groups.yahoo.com/linux-dell-laptops
    http://www.rm-r.net/~meff/i8200 - Good info in general. I "borrowed"
    most of his configs when setting up my laptop.

  9. #9

    Re:Extra keyboard keys PET

    For Blackbox what I did is follow your instructions but I used bbkeys and bbconf to configure f13 or what ever to start my app. Thanks KumaSan now I am able to use my windows keys.. I got one set for netscape, gaim, and aterm.

  10. #10
    Junior Member
    Join Date
    May 2001
    Posts
    53

    Re:Extra keyboard keys PET

    Glad it was useful. I finally got around to submitting it so it can be found on the PET page, in the X-windows category.

Similar Threads

  1. Anyone have extra notebook HDD bigger than 10 G?
    By Compunuts in forum General Chat
    Replies: 0
    Last Post: 06-08-2006, 10:11 PM
  2. Adding extra CDs to cache of SuSE 9.1 Pro
    By synjyn in forum Linux - General Topics
    Replies: 0
    Last Post: 06-14-2004, 03:36 AM
  3. Anybody got an extra modem?
    By paradox in forum General Chat
    Replies: 5
    Last Post: 09-21-2002, 03:57 AM
  4. Get the extra mouse buttons to work + Num lock at
    By otheos in forum Linux - Software, Applications & Programming
    Replies: 4
    Last Post: 11-20-2001, 08:01 PM

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
  •