Problem using grep command due to keyboard layout

Recently I got a hp multilingual keyboard very similar to a hp laptop keyboard.
and hit a wall for not figuring how can I use the vertical line key (don’t know the term for this key)
The key I am trying to figure out is in this example



ps ax **|** grep cron


it is the key in red.
I can use the key if I configure the keyboard to use the Canadian french Dvorak
but it will change most of the keyboard layout. Is there any magic key combination to use for that said key to come out
w/out changing the entire layout. Any help will be much appreciated, I have not customize a keyboard layout in my entire life.

Many thanks in advance,
conram

edit for additional info:
openSUSE 12.1 with KDE4.9 and XFCE4.10

You could map that symbol to a key of your choice with xmodmap but it won’t survive the next setxkbmap. It would be the easiest though.

Use xev to find the keycode.

$ xev
Press a key (in this example F12): 
KeyPress event, serial 38, synthetic NO, window 0x2a00001,
    root 0x25e, subw 0x0, time 50952254, (89,60), root:(1191,80),
    state 0x0, keycode 96 (keysym 0xffc9, F12), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x2a00001,
    root 0x25e, subw 0x0, time 50952398, (89,60), root:(1191,80),
    state 0x0, keycode 96 (keysym 0xffc9, F12), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

Map the key with xmodmap:

$ xmodmap -e "keycode 96 = **bar**"
  • 96 (F12) is just an example.

Many thanks, got it working.
If this fix will not survive as you said, I am not worried as long as I can remember the command you thought me.
Not many times I will be using this key.

Thanks,
conram

I found a simple way by adding the xfce-keyboard layout panel plugin in the xfce panel.
It’s more easier to switch between US to Canadian and vice versa for using the bar key.lol!

On the french canadian keyboard (don’t know about Dvorak):

setxkbmap -rules xorg -model evdev -layout "ca" -variant "fr"

the vertical bar is at the same place as the tilde (~) on the US keyboard.

Yes, it is. thanks for your helping hand, sounds dumb but how do I implement the command in the code you gave me.

Thanks again,
conram

No worries, I got it now. Thanks a lot, I am glad you`re in the forum and saw my last post.

This would work too:

setxkbmap -layout ca -variant fr

and back to the us layout:

setxkbmap -layout us

You don’t actually need the quotes, and it’s a good thing when you don’t know where they are. Your plugin probably just executes these commands. You will notice that as soon as you use setxkbmap (even if you don’t change the layout) , any key binding previously defined with xmodmap gets removed.

Hi,
Thanks again for this additional infos.
conram