LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 01-20-2008, 11:04 AM   #1
cuk
Member
 
Registered: Jun 2004
Distribution: slackware 10.2.
Posts: 39

Rep: Reputation: 15
keyboard extra keys - xmodmap


Hello,
I configured the extra keys on my keyboard in ~/.Xmodmap. After putting xmodmap ~/.Xmodmap in my .xsession they work. But if I change the keyboard layout they stop working until I re-enter the command xmodmap .Xmodmap. I use kde, slackware 12. Any ideas how to keep the keycodes? Thanks in advance.
 
Old 01-20-2008, 11:54 AM   #2
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
I just always leave my kaymaps in /etc/X11/Xmodmap file.

Brian
 
Old 01-20-2008, 12:53 PM   #3
cuk
Member
 
Registered: Jun 2004
Distribution: slackware 10.2.
Posts: 39

Original Poster
Rep: Reputation: 15
Thanks, but it did not help. The file didn't exist, so I copied .Xmodmap into /etc/X11/Xmodmap but to no avail. And I found out that .xsession entry is not working either, I have to manually enter xmodmap .Xmodmap in a terminal each time.
 
Old 01-20-2008, 03:33 PM   #4
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
Not sure what to do to fix the issue.

Brian
 
Old 01-20-2008, 04:01 PM   #5
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,211

Rep: Reputation: 292Reputation: 292Reputation: 292
The only thing I can think of instead of using the tray icon or shortcut, make your shortcut in kde menu like:

setxkbmap -model pc104 -layout gb && xmodmap .Xmodmap

There is a command line in options but it's not editable.
 
Old 01-20-2008, 07:16 PM   #6
cuk
Member
 
Registered: Jun 2004
Distribution: slackware 10.2.
Posts: 39

Original Poster
Rep: Reputation: 15
Yes, this setxkbmap command which you cannot edit in kcontrol is really provoking, especially if you can see that it is wrong, which was the case with qwerty czech on kde ??- slack 10.2. Qwerty czech is fixed by now but the the whole thing is annoying and unnecessary. Why put the command there if you can't edit it?
 
Old 01-26-2008, 01:03 PM   #7
drumz
Member
 
Registered: Apr 2005
Location: Scottsdale, AZ, USA
Distribution: Slackware
Posts: 188

Rep: Reputation: 33
I had this problem too. First of all, read the kxkb help file; it's really informative, especially the page titled "xkb Files and Layouts." If you can find a keyboard map in /etc/X11/xkb/symbos/inet, then choose that layout in the Keyboard Model section of the Keyboard Layout screen. All of my special keys (Inspiron 1520) were listed in the "inspiron" layout, so I chose "Laptop/Notebook Dell Inspiron 6xxx/8xxx" in the Keyboard Layout screen. If you can't one matching your keyboard, you'll have to add a layout as described in the help file.

One other thing I read in the help file is kxkb uses the xkb extension instead of xmodmap, which is why it was clobbering your configurations set up there.
 
Old 01-26-2008, 01:32 PM   #8
drumz
Member
 
Registered: Apr 2005
Location: Scottsdale, AZ, USA
Distribution: Slackware
Posts: 188

Rep: Reputation: 33
Ok, I spoke too soon. I had to do one extra step.

I had to modify the follwing file:
/etc/X11/xkb/symbols/inet
Code:
// Laptop/notebook Dell Inspiron 8xxx
partial alphanumeric_keys
xkb_symbols "inspiron" {
//    key <I02>   {       [ XF86AudioStop         ]       };
//    key <I04>   {       [ XF86AudioNext         ]       };
    key <I10>   {       [ XF86AudioPrev         ]       };
    key <I19>   {       [ XF86AudioNext         ]       };
    key <I20>   {       [ XF86AudioMute         ]       };
    key <I21>   {       [ XF86Eject             ]       };
    key <I22>   {       [ XF86AudioPlay, XF86AudioPause ] };
    key <I24>   {       [ XF86AudioStop         ]       };
    key <I2E>   {       [ XF86AudioLowerVolume  ]       };
    key <I30>   {       [ XF86AudioRaiseVolume  ]       };
//    key <NFER>  {       [ XF86AudioPrev         ]       };
//    key <XFER>  {       [ XF86AudioPlay, XF86AudioPause ] };
};
You can't have repeats of the same action, so I commented out 1 of each duplicate, applied the changes in Keyboard Layout, and used xev to verify the keys were working correctly. Now I can switch layouts, and my multimedia keys still work.
 
Old 04-06-2008, 05:41 PM   #9
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Hiya people

I have been very busy, working shiftwork, but am still here!
Currently with 2 video cards now, 4GB of ram, 3 monitors running finally, and now: this cheap, but kinda cool, but VERY frustrating wireless keyboard.
Kernel is 2.6.24.4. Slack 11.

And to get right to it, here's the issue (which I have posted here because this thread is the perfect place):

I too now have a (relatively cheap) GE wireless keyboard with a bunch of useless buttons on the top.
I have spent much of the day trying to figure out in which file on Slack 11 to put the necessary stuff into, to get these stupid keys to do something.
Accordingly, I have gone through COUNTLESS threads here on LQ, as well as Google, plus the Ubuntu Forums, and have downloaded the XF86 Protocol PDF document, and it basically is full of technical mumbojumbo that didn't help..

All of the keys I wish to program ARE recognized, and they can be read using XEV. Here's an example:
Code:
KeyPress event, serial 31, synthetic NO, window 0x1e00001,
    root 0x1f8, subw 0x0, time 34510569, (92,107), root:(96,137),
    state 0x0, keycode 229 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 31, synthetic NO, window 0x1e00001,
    root 0x1f8, subw 0x0, time 34510632, (92,107), root:(96,137),
    state 0x0, keycode 229 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:
The above is what I get from XEV when I press the INTERNET SEARCH button.

Now, what do I do with that info?

Here's what I made for an Xmodmap file (and also a .Xmodmap file):
Code:
keycode 162 = wk_play_pause
keycode 144 = wk_rewind
keycode 153 = wk_fast_fwd
keycode 164 = wk_stop
keycode 176 = wk_volume_up
keycode 160 = wk_mute
keycode 174 = wk_volume_down
keycode 234 = wk_browser_back
keycode 233 = wk_browser_fwd
keycode 232 = wk_browser_stop
keycode 231 = wk_browser_reload
keycode 229 = wk_browser_search
keycode 230 = wk_browser_bookmarks
keycode 178 = wk_browser_home
keycode 236 = wk_browser_email
keycode 223 = wk_sleep_logout
! these are acting weird ###
! keycode 115 = wk_lock_session
! keycode 115 = wk_konqueror_home
! keycode 115 = wk_calculator
! ##############################
By following an apparently great tutorial on the Ubuntu users forum, I created these 'macros' and saved the file in many places to make sure it would get picked up.
Thing is, WHERE do I now tell the X server what these 'macro thingies' mean? What action to take when encountering these keys??
Also, no matter what I put in any file anywhere, the XEV output remains the same; ie There is no symbol (NoSymbol) associated with any of the special keys.

Now, RE the above post: The things in <> are what?? Like for example:
key <I2E> { [ XF86AudioLowerVolume ] };
So what is <I2E> and where did it come from? Obviously it looks like a hex code, but from where did it come?
Using kcalc I converted many of my decimal codes from XEV into HEX, and they do not match or even remotely come close to any of the preconfigured keyboards in ../X11R6/lib/xkb/whatever-that-file-is-called..

Here's what I did in KeySymsDB:
Code:
 ! Sashas wireless keyboard upper row keys
wk_play_pause		:11000001
wk_rewind		:11000002
wk_fast_fwd		:11000003
wk_stop			:11000004
wk_volume_up		:11000005
wk_mute			:11000006
wk_volume_down		:11000007
wk_browser_back		:11000008
wk_browser_fwd		:11000009
wk_browser_stop		:1100000A
wk_browser_reload	:1100000B
wk_browser_search	:1100000C
wk_browser_bookmarks	:1100000D
wk_browser_home		:1100000E
wk_browser_email	:1100000F
wk_lock_session		:11000010
wk_konqueror_home	:11000011
wk_calculator		:11000012
wk_sleep_logout		:11000013
So I made/defined my keycodes & gave them a unique (albeit meaningless) 11000001 number..
Now what?

I am totally perplexed at this point.. Is it just Slackware, or maybe KDE, or does every Linux have LOADS & LOADS of similar-looking files intended to define keymaps?

Any input is as always GREATLY appreciated!!! I give up for today-- back to work tomorrow so early to bed tonight.

Cheers everyone

Sasha
 
Old 04-06-2008, 06:17 PM   #10
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,252

Rep: Reputation: 630Reputation: 630Reputation: 630Reputation: 630Reputation: 630Reputation: 630
The <I2E> etc. stuff comes from /etc/X11/xkb/keycodes/xfree86 -- it maps codes like these to keycodes from your keyboard. Check to see if the keys you are trying to assign have these keycodes already defined there -- if not, add it yourself I guess. However, if you are using KDE or another major DE like XFCE (or even IceWM, I think) you can just map actions to them using their own utilities. For example, in KDE you can go to "Regional & Accessibility">"Keyboard Shortcuts" in the Control Center and set up everything there.
 
Old 04-08-2008, 09:10 AM   #11
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
T3slider:

Thank you for that suggestion. I did try that, and it tried to work but it seemed rather limited in its functionality, particularly where concerns non-XF86 standard applications. For example, if I press the MAILBOX key, the built in action might open some kind of email tool like KMail or something. I would want it to open my webmail url in a firefox tab..

Let me explain further:

The most helpful tutorial I had used while messing with all this was HERE.
The fellow there was using FVWM as a desktop/WM and so his key configs for getting weird keys to do things were to be done in the file /usr/X11R6/lib/X11/fvwm2/system.fvwmrc2 (so named on my system) which when I look at that file on MY system it contains stuff like:

Quote:
# Now some keyboard shortcuts.

# Arrow Keys
# press arrow + control anywhere, and scroll by 1 page
Key Left A C Scroll -100 0
Key Right A C Scroll +100 +0
Key Up A C Scroll +0 -100
Key Down A C Scroll +0 +100

# press arrow + meta key, and scroll by 1/10 of a page
Key Left A M Scroll -10 +0
Key Right A M Scroll +10 +0
Key Up A M Scroll +0 -10
Key Down A M Scroll +0 +10

# press shift arrow + control anywhere, and move the pointer by 1% of a page
Key Left A SC CursorMove -1 0
Key Right A SC CursorMove +1 +0
Key Up A SC CursorMove +0 -1
Key Down A SC CursorMove +0 +1

# press shift arrow + meta key, and move the pointer by 1/10 of a page
Key Left A SM CursorMove -10 +0
Key Right A SM CursorMove +10 +0
Key Up A SM CursorMove +0 -10
Key Down A SM CursorMove +0 +10

# Keyboard accelerators
Key F1 A M Popup "Utilities"
Key F1 A M Popup "Utilities"
Key F2 A M Popup "Window Ops"
Key F3 A M Module "WindowList" FvwmWinList
Key F4 A M Iconify
Key F5 A M Move
Key F6 A M Resize
Key F7 A M CirculateUp
Key F8 A M CirculateDown
which as you can see makes doing this stuff simple.
He identified his keys using XEV, then added functionality by making 'names' or 'Symbols' for the keys in XkeysymDB (which I also did)
Adding a multimedia key to make (for example) firefox start might read something like:
Quote:
Key WK_firefox_start A A exec `/bin/firefox-bin`
where "WK_firefox_start" is a keysym I invented and mapped to the key 229 given by XEV (for the browser button on my kbd), the "A" means "context: anywhere", the next "A" may or may not need to be something because I'm not using a CTRL/ALT/META/SHIFT key, and lastly is the action to perform.

Reasons I would like to know how to create this functionality independently of KDE (or its configuration tool) are 1) maybe I would like special keys to work outside KDE, or 2) what if I switch desktops? Like use something besides KDE.. I would be one step ahead by doing this in an X context, rather that just a KDE context.
Finally, as this IS slackware I am using, I would like to know how I can do this without the KDE tool, whether it (the tool) works or not.
Assuming the KDE keyboard config tool DOES work (but not to my liking) then presumably the settings and mappings created with it are saved *somewhere* comparable to that fvwm config file mentioned above; so where might that be?? What file gets edited by KDE? Even if it is useful "in-KDE-only" at least I could see how the key mapping gets done.

Thanks again!
Sasha
 
Old 04-08-2008, 04:00 PM   #12
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,252

Rep: Reputation: 630Reputation: 630Reputation: 630Reputation: 630Reputation: 630Reputation: 630
OK, I've come with some help after some brief googling. First of all, as for the simplicity of the keyboard shortcuts that you can set, I just made some scripts and assigned them to run (ie I added them to an unused portion of the menu and then I was allowed to launch those actions on a keyboard shortcut). However, I've found a great page here: http://dev-loki.blogspot.com/2006/04...h-xmodmap.html that explains basically everything you will ever need to know. It outlines KDE-specific stuff to launch ANY action without resorting to my hackish method. If you want a WM/DE-independent solution, it suggests xbindkeys (you would have to install this), located here: http://hocwp.free.fr/xbindkeys/xbindkeys.html (However, even if you use xbindkeys, you should still read the first link since it has information on how to set your keys up and such).

Good luck -- if you have any other problems with that solution (I know, it requires installing something) just say so.
 
Old 04-08-2008, 05:19 PM   #13
Carpo
Member
 
Registered: Aug 2003
Location: Somewhere
Distribution: Gentoo (for now)
Posts: 364

Rep: Reputation: 30
will look it over in the morn - thanks
 
Old 04-08-2008, 08:11 PM   #14
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
T3slider--

THANKS for pointing me/us to 'xbindkeys' as it looks like the solution, at least to my own situation.

As an aside, using XEV I have discovered that this keyboard I bought (GE SKU 98055 model# wk0804 for very cheap-- that's why I got it) is truly a 'Windoze-destined' product. As an example, the LOGOUT button on it actually doesn't produce a scan code number; it instead emits a macro of the keys WINKEY+UP+UP+RETURN which if you press those keys on a windoze machine will select 'Logout' from the START menu :P lol..
Luckily there are only 3 keys like that on here. However, just by reading the docs for xbindkeys' I get the impression that xbindkeys might be able to deal with that too

I'll update again when I try it out.
Thx again!
Sasha
 
Old 04-08-2008, 10:33 PM   #15
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,252

Rep: Reputation: 630Reputation: 630Reputation: 630Reputation: 630Reputation: 630Reputation: 630
GrapefruiTgirl, I've got two that do nothing as well -- but I wasn't aware that xbindkeys could deal with this. I may have to look into it myself. It looks like there's a SlackBuild at slackbuilds.org too.

[edit]If your goofy logout key emits that particular macro (which is admittedly very humourous), I wonder what would happen if your mouse cursor was positioned where the start menu pops up...would it accidentally select the wrong item? [/edit]

Last edited by T3slider; 04-08-2008 at 10:36 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Keyboard - Extra Keys / Custom Binding illiadum Linux - Hardware 2 07-31-2007 05:23 AM
Setting keys on keyboard using xmodmap aoberoi Ubuntu 7 06-18-2006 01:50 AM
extra keyboard keys stopped working kaega2 Linux - Software 3 04-16-2005 10:57 PM
Logitech Keyboard with some extra keys bobbyjoe Linux - Newbie 1 01-14-2005 10:01 AM
Binding extra keyboard keys ironz Linux - Newbie 4 07-02-2003 04:27 AM


All times are GMT -5. The time now is 11:13 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration