How to map a key to another on my keyboard?

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








up vote
7
down vote

favorite
6












My space-bar button is not working any more so i want to change the behavior of it to another key to simulate space button press, so how to map space button to the right alt/windows key ???










share|improve this question





















  • Thanks, but I can't even type "xmodmap -pm" because I can't make the space. Usually I use CTRL-V to paste a space but it doesn't work in DOS. Any workarounds?
    – user309703
    Jul 27 '14 at 16:31










  • 1st thing it's not called dos in Linux it's (terminal) 2nd thing it's (CTRL + SHIFT + V) to baste in terminal
    – Black Block
    Aug 17 '14 at 19:41














up vote
7
down vote

favorite
6












My space-bar button is not working any more so i want to change the behavior of it to another key to simulate space button press, so how to map space button to the right alt/windows key ???










share|improve this question





















  • Thanks, but I can't even type "xmodmap -pm" because I can't make the space. Usually I use CTRL-V to paste a space but it doesn't work in DOS. Any workarounds?
    – user309703
    Jul 27 '14 at 16:31










  • 1st thing it's not called dos in Linux it's (terminal) 2nd thing it's (CTRL + SHIFT + V) to baste in terminal
    – Black Block
    Aug 17 '14 at 19:41












up vote
7
down vote

favorite
6









up vote
7
down vote

favorite
6






6





My space-bar button is not working any more so i want to change the behavior of it to another key to simulate space button press, so how to map space button to the right alt/windows key ???










share|improve this question













My space-bar button is not working any more so i want to change the behavior of it to another key to simulate space button press, so how to map space button to the right alt/windows key ???







12.04 keyboard keyboard-layout






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 2 '12 at 15:37









Black Block

2,358163964




2,358163964











  • Thanks, but I can't even type "xmodmap -pm" because I can't make the space. Usually I use CTRL-V to paste a space but it doesn't work in DOS. Any workarounds?
    – user309703
    Jul 27 '14 at 16:31










  • 1st thing it's not called dos in Linux it's (terminal) 2nd thing it's (CTRL + SHIFT + V) to baste in terminal
    – Black Block
    Aug 17 '14 at 19:41
















  • Thanks, but I can't even type "xmodmap -pm" because I can't make the space. Usually I use CTRL-V to paste a space but it doesn't work in DOS. Any workarounds?
    – user309703
    Jul 27 '14 at 16:31










  • 1st thing it's not called dos in Linux it's (terminal) 2nd thing it's (CTRL + SHIFT + V) to baste in terminal
    – Black Block
    Aug 17 '14 at 19:41















Thanks, but I can't even type "xmodmap -pm" because I can't make the space. Usually I use CTRL-V to paste a space but it doesn't work in DOS. Any workarounds?
– user309703
Jul 27 '14 at 16:31




Thanks, but I can't even type "xmodmap -pm" because I can't make the space. Usually I use CTRL-V to paste a space but it doesn't work in DOS. Any workarounds?
– user309703
Jul 27 '14 at 16:31












1st thing it's not called dos in Linux it's (terminal) 2nd thing it's (CTRL + SHIFT + V) to baste in terminal
– Black Block
Aug 17 '14 at 19:41




1st thing it's not called dos in Linux it's (terminal) 2nd thing it's (CTRL + SHIFT + V) to baste in terminal
– Black Block
Aug 17 '14 at 19:41










1 Answer
1






active

oldest

votes

















up vote
9
down vote













To make major changes to your keyboard, including remapping characters and changing modifiers, you need to use the xmodmap utility - see man xmodmap. There are a couple ways to execute the changes:




  • either from the command line



    xmodmap -e "your commands"



  • or write the commands to a file like .xmodmaprc, then execute it in your login items or your .bashrc with



    xmodmap .xmodmaprc


    If you use the file ~/.xmodmap it will be executed automatically on login.



Alt and Super (the Windows key) are modifiers, and behave specially to the system. The keys will need to be unmapped from their modifier before you can remap anything else. The space bar is considered a regular key.



Unmapping the modifier



Open up a terminal window (Ctrl-Alt-T, if you're unfamiliar with it).



Run the command xmodmap -pm to get a list of the modifier keys on your system. In the output, the leftmost column is the list of modifiers available to the system. The other columns list the keys bound to these modifiers as pairs by keysym (keycode). For example, one line of my output is



mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)


The keycodes correspond to physical keys, and can (hypothetically) differ between keyboards. The keysym is the 'name' of a key. If the key is a printable character, the name corresponds to the character printed.



Now you have what you need to unmap a key from its corresponding modifier. I'm going to pretend we're working with Alt_R.



Run the xmodmap command (by one of the methods up at the top)



remove mod1 = Alt_R


Remap the space bar



Next we need to know what the spacebar is. Run xmodmap -pke in your terminal window. This will print out what every key on your keyboard is mapped to. Somewhere in that four or five screens-full is a reference to the space bar. We need its name in order to map a key to it.



Spoiler alert: the spacebar is named space



We still have a key named Alt_R, but it doesn't do anything. We can use its name to remap it to the spacebar. Run this xmodmap command:



keysym Alt_R = space


It might happen while you test these out that you've changed Alt_R's name already. Maybe you accidentally remapped it to the letter 'a'. You don't want to remap 'a' to something else, because you still need one of the keys with that name. If you end up in that situation, you can still refer to Alt_R by its keycode. Remember that on my keyboard this is 0x6c. It might be different for you. You can use this xmodmap command to change it:



keycode 0x6c = space


Good luck!






share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    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: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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%2faskubuntu.com%2fquestions%2f130144%2fhow-to-map-a-key-to-another-on-my-keyboard%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
    9
    down vote













    To make major changes to your keyboard, including remapping characters and changing modifiers, you need to use the xmodmap utility - see man xmodmap. There are a couple ways to execute the changes:




    • either from the command line



      xmodmap -e "your commands"



    • or write the commands to a file like .xmodmaprc, then execute it in your login items or your .bashrc with



      xmodmap .xmodmaprc


      If you use the file ~/.xmodmap it will be executed automatically on login.



    Alt and Super (the Windows key) are modifiers, and behave specially to the system. The keys will need to be unmapped from their modifier before you can remap anything else. The space bar is considered a regular key.



    Unmapping the modifier



    Open up a terminal window (Ctrl-Alt-T, if you're unfamiliar with it).



    Run the command xmodmap -pm to get a list of the modifier keys on your system. In the output, the leftmost column is the list of modifiers available to the system. The other columns list the keys bound to these modifiers as pairs by keysym (keycode). For example, one line of my output is



    mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)


    The keycodes correspond to physical keys, and can (hypothetically) differ between keyboards. The keysym is the 'name' of a key. If the key is a printable character, the name corresponds to the character printed.



    Now you have what you need to unmap a key from its corresponding modifier. I'm going to pretend we're working with Alt_R.



    Run the xmodmap command (by one of the methods up at the top)



    remove mod1 = Alt_R


    Remap the space bar



    Next we need to know what the spacebar is. Run xmodmap -pke in your terminal window. This will print out what every key on your keyboard is mapped to. Somewhere in that four or five screens-full is a reference to the space bar. We need its name in order to map a key to it.



    Spoiler alert: the spacebar is named space



    We still have a key named Alt_R, but it doesn't do anything. We can use its name to remap it to the spacebar. Run this xmodmap command:



    keysym Alt_R = space


    It might happen while you test these out that you've changed Alt_R's name already. Maybe you accidentally remapped it to the letter 'a'. You don't want to remap 'a' to something else, because you still need one of the keys with that name. If you end up in that situation, you can still refer to Alt_R by its keycode. Remember that on my keyboard this is 0x6c. It might be different for you. You can use this xmodmap command to change it:



    keycode 0x6c = space


    Good luck!






    share|improve this answer
























      up vote
      9
      down vote













      To make major changes to your keyboard, including remapping characters and changing modifiers, you need to use the xmodmap utility - see man xmodmap. There are a couple ways to execute the changes:




      • either from the command line



        xmodmap -e "your commands"



      • or write the commands to a file like .xmodmaprc, then execute it in your login items or your .bashrc with



        xmodmap .xmodmaprc


        If you use the file ~/.xmodmap it will be executed automatically on login.



      Alt and Super (the Windows key) are modifiers, and behave specially to the system. The keys will need to be unmapped from their modifier before you can remap anything else. The space bar is considered a regular key.



      Unmapping the modifier



      Open up a terminal window (Ctrl-Alt-T, if you're unfamiliar with it).



      Run the command xmodmap -pm to get a list of the modifier keys on your system. In the output, the leftmost column is the list of modifiers available to the system. The other columns list the keys bound to these modifiers as pairs by keysym (keycode). For example, one line of my output is



      mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)


      The keycodes correspond to physical keys, and can (hypothetically) differ between keyboards. The keysym is the 'name' of a key. If the key is a printable character, the name corresponds to the character printed.



      Now you have what you need to unmap a key from its corresponding modifier. I'm going to pretend we're working with Alt_R.



      Run the xmodmap command (by one of the methods up at the top)



      remove mod1 = Alt_R


      Remap the space bar



      Next we need to know what the spacebar is. Run xmodmap -pke in your terminal window. This will print out what every key on your keyboard is mapped to. Somewhere in that four or five screens-full is a reference to the space bar. We need its name in order to map a key to it.



      Spoiler alert: the spacebar is named space



      We still have a key named Alt_R, but it doesn't do anything. We can use its name to remap it to the spacebar. Run this xmodmap command:



      keysym Alt_R = space


      It might happen while you test these out that you've changed Alt_R's name already. Maybe you accidentally remapped it to the letter 'a'. You don't want to remap 'a' to something else, because you still need one of the keys with that name. If you end up in that situation, you can still refer to Alt_R by its keycode. Remember that on my keyboard this is 0x6c. It might be different for you. You can use this xmodmap command to change it:



      keycode 0x6c = space


      Good luck!






      share|improve this answer






















        up vote
        9
        down vote










        up vote
        9
        down vote









        To make major changes to your keyboard, including remapping characters and changing modifiers, you need to use the xmodmap utility - see man xmodmap. There are a couple ways to execute the changes:




        • either from the command line



          xmodmap -e "your commands"



        • or write the commands to a file like .xmodmaprc, then execute it in your login items or your .bashrc with



          xmodmap .xmodmaprc


          If you use the file ~/.xmodmap it will be executed automatically on login.



        Alt and Super (the Windows key) are modifiers, and behave specially to the system. The keys will need to be unmapped from their modifier before you can remap anything else. The space bar is considered a regular key.



        Unmapping the modifier



        Open up a terminal window (Ctrl-Alt-T, if you're unfamiliar with it).



        Run the command xmodmap -pm to get a list of the modifier keys on your system. In the output, the leftmost column is the list of modifiers available to the system. The other columns list the keys bound to these modifiers as pairs by keysym (keycode). For example, one line of my output is



        mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)


        The keycodes correspond to physical keys, and can (hypothetically) differ between keyboards. The keysym is the 'name' of a key. If the key is a printable character, the name corresponds to the character printed.



        Now you have what you need to unmap a key from its corresponding modifier. I'm going to pretend we're working with Alt_R.



        Run the xmodmap command (by one of the methods up at the top)



        remove mod1 = Alt_R


        Remap the space bar



        Next we need to know what the spacebar is. Run xmodmap -pke in your terminal window. This will print out what every key on your keyboard is mapped to. Somewhere in that four or five screens-full is a reference to the space bar. We need its name in order to map a key to it.



        Spoiler alert: the spacebar is named space



        We still have a key named Alt_R, but it doesn't do anything. We can use its name to remap it to the spacebar. Run this xmodmap command:



        keysym Alt_R = space


        It might happen while you test these out that you've changed Alt_R's name already. Maybe you accidentally remapped it to the letter 'a'. You don't want to remap 'a' to something else, because you still need one of the keys with that name. If you end up in that situation, you can still refer to Alt_R by its keycode. Remember that on my keyboard this is 0x6c. It might be different for you. You can use this xmodmap command to change it:



        keycode 0x6c = space


        Good luck!






        share|improve this answer












        To make major changes to your keyboard, including remapping characters and changing modifiers, you need to use the xmodmap utility - see man xmodmap. There are a couple ways to execute the changes:




        • either from the command line



          xmodmap -e "your commands"



        • or write the commands to a file like .xmodmaprc, then execute it in your login items or your .bashrc with



          xmodmap .xmodmaprc


          If you use the file ~/.xmodmap it will be executed automatically on login.



        Alt and Super (the Windows key) are modifiers, and behave specially to the system. The keys will need to be unmapped from their modifier before you can remap anything else. The space bar is considered a regular key.



        Unmapping the modifier



        Open up a terminal window (Ctrl-Alt-T, if you're unfamiliar with it).



        Run the command xmodmap -pm to get a list of the modifier keys on your system. In the output, the leftmost column is the list of modifiers available to the system. The other columns list the keys bound to these modifiers as pairs by keysym (keycode). For example, one line of my output is



        mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)


        The keycodes correspond to physical keys, and can (hypothetically) differ between keyboards. The keysym is the 'name' of a key. If the key is a printable character, the name corresponds to the character printed.



        Now you have what you need to unmap a key from its corresponding modifier. I'm going to pretend we're working with Alt_R.



        Run the xmodmap command (by one of the methods up at the top)



        remove mod1 = Alt_R


        Remap the space bar



        Next we need to know what the spacebar is. Run xmodmap -pke in your terminal window. This will print out what every key on your keyboard is mapped to. Somewhere in that four or five screens-full is a reference to the space bar. We need its name in order to map a key to it.



        Spoiler alert: the spacebar is named space



        We still have a key named Alt_R, but it doesn't do anything. We can use its name to remap it to the spacebar. Run this xmodmap command:



        keysym Alt_R = space


        It might happen while you test these out that you've changed Alt_R's name already. Maybe you accidentally remapped it to the letter 'a'. You don't want to remap 'a' to something else, because you still need one of the keys with that name. If you end up in that situation, you can still refer to Alt_R by its keycode. Remember that on my keyboard this is 0x6c. It might be different for you. You can use this xmodmap command to change it:



        keycode 0x6c = space


        Good luck!







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered May 16 '12 at 7:22









        pconley

        66137




        66137



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f130144%2fhow-to-map-a-key-to-another-on-my-keyboard%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            pylint3 and pip3 broken

            Missing snmpget and snmpwalk

            How to enroll fingerprints to Ubuntu 17.10 with VFS491