How to swap a modifier key with a character key on X?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I'm trying to swap my left Windows-key with the <>|-key. This worked very well on the vterm using a keymap file that does just that. However, I cannot get this to work on X (tried on KDE as well as Mate - both exhibit the same behavior)



Whether I use xmodmap or an xkb symbol config doing that, the result is the same: the <>|-key stops working and the left Windows-key keeps being that key but additionally also emits a < when pressed.



With xev I determined that my <>|-key has the code 94 and my left Windows-key has 133, so I've tried this:



xmodmap -e "keycode 133 = less greater bar NoSymbol U0149 brokenbar U266A NoSymbol"
xmodmap -e "keycode 94 = Super_L"


The xkb symbol config I've tried looks like this and has the same effect as described above:



partial alphanumeric_keys
xkb_symbols "defoo"
include "de(basic)"
name[Group1] = "German (foo)";
key <LWIN> [ less, greater, bar, NoSymbol, U0149, brokenbar, U266A, NoSymbol ] ;
key <LSGT> [ Super_L ] ;
;


Now what? I really need to swap those keys.



Edit: I'm on Ubuntu 18.04



Edit: Tried fiddling with the modifier keys as well. xmodmap -pm says my Super keys are assigned to mod4, so:



xmodmap -e "clear mod4"


However, this had no effect, i.e. the Windows-key acted exactly as before.










share|improve this question























  • You also need to an appropriate remove and add of the modifier map seen by xmodmap -pm
    – meuh
    Aug 8 at 6:05










  • @meuh: just tried that - had no effect whatsoever :(
    – luxifer
    Aug 8 at 6:15














up vote
0
down vote

favorite












I'm trying to swap my left Windows-key with the <>|-key. This worked very well on the vterm using a keymap file that does just that. However, I cannot get this to work on X (tried on KDE as well as Mate - both exhibit the same behavior)



Whether I use xmodmap or an xkb symbol config doing that, the result is the same: the <>|-key stops working and the left Windows-key keeps being that key but additionally also emits a < when pressed.



With xev I determined that my <>|-key has the code 94 and my left Windows-key has 133, so I've tried this:



xmodmap -e "keycode 133 = less greater bar NoSymbol U0149 brokenbar U266A NoSymbol"
xmodmap -e "keycode 94 = Super_L"


The xkb symbol config I've tried looks like this and has the same effect as described above:



partial alphanumeric_keys
xkb_symbols "defoo"
include "de(basic)"
name[Group1] = "German (foo)";
key <LWIN> [ less, greater, bar, NoSymbol, U0149, brokenbar, U266A, NoSymbol ] ;
key <LSGT> [ Super_L ] ;
;


Now what? I really need to swap those keys.



Edit: I'm on Ubuntu 18.04



Edit: Tried fiddling with the modifier keys as well. xmodmap -pm says my Super keys are assigned to mod4, so:



xmodmap -e "clear mod4"


However, this had no effect, i.e. the Windows-key acted exactly as before.










share|improve this question























  • You also need to an appropriate remove and add of the modifier map seen by xmodmap -pm
    – meuh
    Aug 8 at 6:05










  • @meuh: just tried that - had no effect whatsoever :(
    – luxifer
    Aug 8 at 6:15












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm trying to swap my left Windows-key with the <>|-key. This worked very well on the vterm using a keymap file that does just that. However, I cannot get this to work on X (tried on KDE as well as Mate - both exhibit the same behavior)



Whether I use xmodmap or an xkb symbol config doing that, the result is the same: the <>|-key stops working and the left Windows-key keeps being that key but additionally also emits a < when pressed.



With xev I determined that my <>|-key has the code 94 and my left Windows-key has 133, so I've tried this:



xmodmap -e "keycode 133 = less greater bar NoSymbol U0149 brokenbar U266A NoSymbol"
xmodmap -e "keycode 94 = Super_L"


The xkb symbol config I've tried looks like this and has the same effect as described above:



partial alphanumeric_keys
xkb_symbols "defoo"
include "de(basic)"
name[Group1] = "German (foo)";
key <LWIN> [ less, greater, bar, NoSymbol, U0149, brokenbar, U266A, NoSymbol ] ;
key <LSGT> [ Super_L ] ;
;


Now what? I really need to swap those keys.



Edit: I'm on Ubuntu 18.04



Edit: Tried fiddling with the modifier keys as well. xmodmap -pm says my Super keys are assigned to mod4, so:



xmodmap -e "clear mod4"


However, this had no effect, i.e. the Windows-key acted exactly as before.










share|improve this question















I'm trying to swap my left Windows-key with the <>|-key. This worked very well on the vterm using a keymap file that does just that. However, I cannot get this to work on X (tried on KDE as well as Mate - both exhibit the same behavior)



Whether I use xmodmap or an xkb symbol config doing that, the result is the same: the <>|-key stops working and the left Windows-key keeps being that key but additionally also emits a < when pressed.



With xev I determined that my <>|-key has the code 94 and my left Windows-key has 133, so I've tried this:



xmodmap -e "keycode 133 = less greater bar NoSymbol U0149 brokenbar U266A NoSymbol"
xmodmap -e "keycode 94 = Super_L"


The xkb symbol config I've tried looks like this and has the same effect as described above:



partial alphanumeric_keys
xkb_symbols "defoo"
include "de(basic)"
name[Group1] = "German (foo)";
key <LWIN> [ less, greater, bar, NoSymbol, U0149, brokenbar, U266A, NoSymbol ] ;
key <LSGT> [ Super_L ] ;
;


Now what? I really need to swap those keys.



Edit: I'm on Ubuntu 18.04



Edit: Tried fiddling with the modifier keys as well. xmodmap -pm says my Super keys are assigned to mod4, so:



xmodmap -e "clear mod4"


However, this had no effect, i.e. the Windows-key acted exactly as before.







keyboard-layout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 8 at 6:17

























asked Aug 8 at 5:55









luxifer

43117




43117











  • You also need to an appropriate remove and add of the modifier map seen by xmodmap -pm
    – meuh
    Aug 8 at 6:05










  • @meuh: just tried that - had no effect whatsoever :(
    – luxifer
    Aug 8 at 6:15
















  • You also need to an appropriate remove and add of the modifier map seen by xmodmap -pm
    – meuh
    Aug 8 at 6:05










  • @meuh: just tried that - had no effect whatsoever :(
    – luxifer
    Aug 8 at 6:15















You also need to an appropriate remove and add of the modifier map seen by xmodmap -pm
– meuh
Aug 8 at 6:05




You also need to an appropriate remove and add of the modifier map seen by xmodmap -pm
– meuh
Aug 8 at 6:05












@meuh: just tried that - had no effect whatsoever :(
– luxifer
Aug 8 at 6:15




@meuh: just tried that - had no effect whatsoever :(
– luxifer
Aug 8 at 6:15










1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










As much as I wanted to avoid this, I eventually swapped the keys in the keycodes file for evdev, which has the desired effect.



Pro:



  • Works transparently with any layout and application as it changes the event codes for the keys

Con:



  • Applies to all evdev Keyboards

  • Change applied to system file (might break later)

Diff:



$ diff /usr/share/X11/xkb/keycodes/evdev,.bak
8c8
< <LWIN> = 94;
---
> <LSGT> = 94;
74c74
< <LSGT> = 133;
---
> <LWIN> = 133;





share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f461206%2fhow-to-swap-a-modifier-key-with-a-character-key-on-x%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    As much as I wanted to avoid this, I eventually swapped the keys in the keycodes file for evdev, which has the desired effect.



    Pro:



    • Works transparently with any layout and application as it changes the event codes for the keys

    Con:



    • Applies to all evdev Keyboards

    • Change applied to system file (might break later)

    Diff:



    $ diff /usr/share/X11/xkb/keycodes/evdev,.bak
    8c8
    < <LWIN> = 94;
    ---
    > <LSGT> = 94;
    74c74
    < <LSGT> = 133;
    ---
    > <LWIN> = 133;





    share|improve this answer
























      up vote
      0
      down vote



      accepted










      As much as I wanted to avoid this, I eventually swapped the keys in the keycodes file for evdev, which has the desired effect.



      Pro:



      • Works transparently with any layout and application as it changes the event codes for the keys

      Con:



      • Applies to all evdev Keyboards

      • Change applied to system file (might break later)

      Diff:



      $ diff /usr/share/X11/xkb/keycodes/evdev,.bak
      8c8
      < <LWIN> = 94;
      ---
      > <LSGT> = 94;
      74c74
      < <LSGT> = 133;
      ---
      > <LWIN> = 133;





      share|improve this answer






















        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        As much as I wanted to avoid this, I eventually swapped the keys in the keycodes file for evdev, which has the desired effect.



        Pro:



        • Works transparently with any layout and application as it changes the event codes for the keys

        Con:



        • Applies to all evdev Keyboards

        • Change applied to system file (might break later)

        Diff:



        $ diff /usr/share/X11/xkb/keycodes/evdev,.bak
        8c8
        < <LWIN> = 94;
        ---
        > <LSGT> = 94;
        74c74
        < <LSGT> = 133;
        ---
        > <LWIN> = 133;





        share|improve this answer












        As much as I wanted to avoid this, I eventually swapped the keys in the keycodes file for evdev, which has the desired effect.



        Pro:



        • Works transparently with any layout and application as it changes the event codes for the keys

        Con:



        • Applies to all evdev Keyboards

        • Change applied to system file (might break later)

        Diff:



        $ diff /usr/share/X11/xkb/keycodes/evdev,.bak
        8c8
        < <LWIN> = 94;
        ---
        > <LSGT> = 94;
        74c74
        < <LSGT> = 133;
        ---
        > <LWIN> = 133;






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 8 at 10:13









        luxifer

        43117




        43117



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f461206%2fhow-to-swap-a-modifier-key-with-a-character-key-on-x%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Christian Cage

            How to properly install USB display driver for Fresco Logic FL2000DX on Ubuntu?