Results 1 to 9 of 9

Thread: Problem using grep command due to keyboard layout

  1. #1

    Default 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
    Code:
    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
    People who do not break things first will never learn to create anything

  2. #2

    Default Re: Problem using grep command due to keyboard layout

    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.

    Code:
    $ 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:

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

  3. #3

    Default Re: Problem using grep command due to keyboard layout

    Quote Originally Posted by please_try_again View Post
    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.

    Code:
    $ 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:


    Code:
    $ 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
    People who do not break things first will never learn to create anything

  4. #4

    Default Re: Problem using grep command due to keyboard layout

    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.
    People who do not break things first will never learn to create anything

  5. #5

    Default Re: Problem using grep command due to keyboard layout

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

    Code:
    setxkbmap -rules xorg -model evdev -layout "ca" -variant "fr"
    the vertical bar is at the same place as the tilde (~) on the US keyboard.

  6. #6

    Default Re: Problem using grep command due to keyboard layout

    Quote Originally Posted by please_try_again View Post
    On the french canadian keyboard (don't know about Dvorak):

    Code:
    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
    People who do not break things first will never learn to create anything

  7. #7

    Default Re: Problem using grep command due to keyboard layout

    Quote Originally Posted by conram View Post
    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.
    People who do not break things first will never learn to create anything

  8. #8

    Default Re: Problem using grep command due to keyboard layout

    This would work too:

    Code:
    setxkbmap -layout ca -variant fr
    and back to the us layout:

    Code:
    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.

  9. #9

    Default Re: Problem using grep command due to keyboard layout

    Quote Originally Posted by please_try_again View Post
    This would work too:

    Code:
    setxkbmap -layout ca -variant fr
    and back to the us layout:



    Code:
    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
    People who do not break things first will never learn to create anything

Posting Permissions

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