Remapping keys that generate multiple scan codes












33














I have a ThinkPad W540. On its keyboard there are four multimedia keys above the numpad. Two of those keys generate keycodes (and, apparently, scancodes) that correspond to combination of keys, Win_L + L and Win_L + E. In other words, for the key that generates Win_L + L,
showkey --scancodes returns this:



0xe0 0x5b 0x26 0xa6 0xe0 0xdb


The setkeycodes command requires either single byte unescaped or escaped two-byte sequences to denote scan codes, and showkey gives me way more than that, so I can't quite re-map that key to one of the free keycodes in my system with a straightforward setkeycodes <scancode> <keycode>.



I would really appreciate any hints how I can remap that key to something else that doesn't simply duplicate one of the existing key combinations on my keyboard.










share|improve this question




















  • 1




    You might want to have a look at this: Shortcut keys that are independent to keyboard layout
    – terdon
    Feb 6 '14 at 21:04






  • 1




    I think this may be tricky: at least on older Thinkpads, this sort of mapping is done by the on-board controller, not the OS.
    – mirabilos
    Feb 27 '14 at 21:34






  • 1




    I have a Microsoft All-in-One Media Keyboard which has the same problem, were you able to find a solution?
    – osolmaz
    Apr 20 '15 at 22:35






  • 5




    I did something similar on a Thinkpad t61 a while ago by mapping the keys using /etc/acpi/events which is in the acpid package and just defining an action when those function keys were pressed.
    – cesar
    Jan 15 '16 at 20:29








  • 2




    Do you have Win_L setup as a modifier in X-windows? It's default for me.
    – mcr
    Jul 12 '16 at 15:01
















33














I have a ThinkPad W540. On its keyboard there are four multimedia keys above the numpad. Two of those keys generate keycodes (and, apparently, scancodes) that correspond to combination of keys, Win_L + L and Win_L + E. In other words, for the key that generates Win_L + L,
showkey --scancodes returns this:



0xe0 0x5b 0x26 0xa6 0xe0 0xdb


The setkeycodes command requires either single byte unescaped or escaped two-byte sequences to denote scan codes, and showkey gives me way more than that, so I can't quite re-map that key to one of the free keycodes in my system with a straightforward setkeycodes <scancode> <keycode>.



I would really appreciate any hints how I can remap that key to something else that doesn't simply duplicate one of the existing key combinations on my keyboard.










share|improve this question




















  • 1




    You might want to have a look at this: Shortcut keys that are independent to keyboard layout
    – terdon
    Feb 6 '14 at 21:04






  • 1




    I think this may be tricky: at least on older Thinkpads, this sort of mapping is done by the on-board controller, not the OS.
    – mirabilos
    Feb 27 '14 at 21:34






  • 1




    I have a Microsoft All-in-One Media Keyboard which has the same problem, were you able to find a solution?
    – osolmaz
    Apr 20 '15 at 22:35






  • 5




    I did something similar on a Thinkpad t61 a while ago by mapping the keys using /etc/acpi/events which is in the acpid package and just defining an action when those function keys were pressed.
    – cesar
    Jan 15 '16 at 20:29








  • 2




    Do you have Win_L setup as a modifier in X-windows? It's default for me.
    – mcr
    Jul 12 '16 at 15:01














33












33








33


9





I have a ThinkPad W540. On its keyboard there are four multimedia keys above the numpad. Two of those keys generate keycodes (and, apparently, scancodes) that correspond to combination of keys, Win_L + L and Win_L + E. In other words, for the key that generates Win_L + L,
showkey --scancodes returns this:



0xe0 0x5b 0x26 0xa6 0xe0 0xdb


The setkeycodes command requires either single byte unescaped or escaped two-byte sequences to denote scan codes, and showkey gives me way more than that, so I can't quite re-map that key to one of the free keycodes in my system with a straightforward setkeycodes <scancode> <keycode>.



I would really appreciate any hints how I can remap that key to something else that doesn't simply duplicate one of the existing key combinations on my keyboard.










share|improve this question















I have a ThinkPad W540. On its keyboard there are four multimedia keys above the numpad. Two of those keys generate keycodes (and, apparently, scancodes) that correspond to combination of keys, Win_L + L and Win_L + E. In other words, for the key that generates Win_L + L,
showkey --scancodes returns this:



0xe0 0x5b 0x26 0xa6 0xe0 0xdb


The setkeycodes command requires either single byte unescaped or escaped two-byte sequences to denote scan codes, and showkey gives me way more than that, so I can't quite re-map that key to one of the free keycodes in my system with a straightforward setkeycodes <scancode> <keycode>.



I would really appreciate any hints how I can remap that key to something else that doesn't simply duplicate one of the existing key combinations on my keyboard.







keyboard-shortcuts keyboard-layout xkb thinkpad






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 16 '16 at 11:44









Volker Siegel

10.8k33259




10.8k33259










asked Feb 6 '14 at 20:54









moonwalkermoonwalker

16814




16814








  • 1




    You might want to have a look at this: Shortcut keys that are independent to keyboard layout
    – terdon
    Feb 6 '14 at 21:04






  • 1




    I think this may be tricky: at least on older Thinkpads, this sort of mapping is done by the on-board controller, not the OS.
    – mirabilos
    Feb 27 '14 at 21:34






  • 1




    I have a Microsoft All-in-One Media Keyboard which has the same problem, were you able to find a solution?
    – osolmaz
    Apr 20 '15 at 22:35






  • 5




    I did something similar on a Thinkpad t61 a while ago by mapping the keys using /etc/acpi/events which is in the acpid package and just defining an action when those function keys were pressed.
    – cesar
    Jan 15 '16 at 20:29








  • 2




    Do you have Win_L setup as a modifier in X-windows? It's default for me.
    – mcr
    Jul 12 '16 at 15:01














  • 1




    You might want to have a look at this: Shortcut keys that are independent to keyboard layout
    – terdon
    Feb 6 '14 at 21:04






  • 1




    I think this may be tricky: at least on older Thinkpads, this sort of mapping is done by the on-board controller, not the OS.
    – mirabilos
    Feb 27 '14 at 21:34






  • 1




    I have a Microsoft All-in-One Media Keyboard which has the same problem, were you able to find a solution?
    – osolmaz
    Apr 20 '15 at 22:35






  • 5




    I did something similar on a Thinkpad t61 a while ago by mapping the keys using /etc/acpi/events which is in the acpid package and just defining an action when those function keys were pressed.
    – cesar
    Jan 15 '16 at 20:29








  • 2




    Do you have Win_L setup as a modifier in X-windows? It's default for me.
    – mcr
    Jul 12 '16 at 15:01








1




1




You might want to have a look at this: Shortcut keys that are independent to keyboard layout
– terdon
Feb 6 '14 at 21:04




You might want to have a look at this: Shortcut keys that are independent to keyboard layout
– terdon
Feb 6 '14 at 21:04




1




1




I think this may be tricky: at least on older Thinkpads, this sort of mapping is done by the on-board controller, not the OS.
– mirabilos
Feb 27 '14 at 21:34




I think this may be tricky: at least on older Thinkpads, this sort of mapping is done by the on-board controller, not the OS.
– mirabilos
Feb 27 '14 at 21:34




1




1




I have a Microsoft All-in-One Media Keyboard which has the same problem, were you able to find a solution?
– osolmaz
Apr 20 '15 at 22:35




I have a Microsoft All-in-One Media Keyboard which has the same problem, were you able to find a solution?
– osolmaz
Apr 20 '15 at 22:35




5




5




I did something similar on a Thinkpad t61 a while ago by mapping the keys using /etc/acpi/events which is in the acpid package and just defining an action when those function keys were pressed.
– cesar
Jan 15 '16 at 20:29






I did something similar on a Thinkpad t61 a while ago by mapping the keys using /etc/acpi/events which is in the acpid package and just defining an action when those function keys were pressed.
– cesar
Jan 15 '16 at 20:29






2




2




Do you have Win_L setup as a modifier in X-windows? It's default for me.
– mcr
Jul 12 '16 at 15:01




Do you have Win_L setup as a modifier in X-windows? It's default for me.
– mcr
Jul 12 '16 at 15:01










2 Answers
2






active

oldest

votes


















1














You can do this in two steps:




  1. to catch key combinations

  2. to simulate typing different keys.


You can use xchainkeys for 1. and [xdotool][2] for 2.:



To create the simulated new key with xdotool, the option --clearmodifiers of key may be important to neutralize the original simulated modifier press:



xdotool key --clearmodifiers Shift+a


This should type a capital A as a test.



In the configuration of xchainkeys in ~/.config/xchainkeys/xchainkeys.conf, we can bind the command to a key combination:



W-l :exec xdotool key --clearmodifiers Shift+a


Now, the key combination Win and l (Win left or right do the same), as well as the key that generates Win_L + L, should create a capital A.



(There are many other programs available for both parts. For the first, one could use the hotkey configuration of a desktop environment, but I prefer to keep it independent of DEs.)






share|improve this answer



















  • 2




    The problem with this solution, if I'm not mistaken, would be the same as simply using said key combination to trigger an action - that action wouldn't be triggered by just that key, pressing the actual combination of keys that generates the same codes would also give the same result. In other words, it doesn't satisfy the "remap that key to something else that doesn't simply duplicate one of the existing key combinations" condition. But I appreciate the effort.
    – moonwalker
    Aug 23 '16 at 20:31








  • 3




    Yes, that it true - I was not sure what you meant by that sentence, now I understand. But it looks like your key produces the two key codes in hardware (that is, in the keyboards firmware) - so I see no war around, except you detect the timing of the artifivial key presses "modifier down", "other key", "modifier up". Hmm... maybe a solution involving soldering is more simple ;)
    – Volker Siegel
    Aug 26 '16 at 14:13








  • 1




    @moonwalker Can you try to remap Win_L instead of the other key, and check whether it remaps the other one's modifier too?
    – Volker Siegel
    Aug 26 '16 at 14:18






  • 1




    um, wouldn't I be losing combinations like Win_L+R, Win+Break, Win+L, Win+etc. in that case?
    – moonwalker
    Sep 29 '16 at 2:57






  • 1




    No, I don't think so. Win-L is Win-Shift-l But you could also map chains of key combinations to a command. Like Win-a and after that b. With out the Win-a, b behaves normal. That's by far the most useful feature of xchainkeys, and pretty unique, I think.
    – Volker Siegel
    Oct 1 '16 at 12:19



















-2














This is what I did on my Thinkpad Yoga in order to rebind the backslash/pipe key to the correct key. Because for some reason in every Linux Virtual Machine it interpreted the backslashpipe (|) key as the less than (<) key.



First execute the command: xev



Press the desired key to get the keycode for the key you want to rebind:



xev KeyPress event output



In this example the Keycode is 94 and the action is "less" but we want it to have the action of backslash and bar aka "pipe"



Remap the keycode 94 to the backslash and bar key aka "pipe":



xmodmap -e 'keycode 94 = backslash bar'


Now lets make this persistent:



xmodmap -pke | egrep "backslash|bar" | grep 94 > ~/.Xmodmap`


Returns the following to the file ~/.Xmodmap:



keycode  94 = backslash bar backslash bar


Then you must create the following file to finish making it persistent:



echo "xmodmap .Xmodmap" > ~/.xinitrc





share|improve this answer

















  • 1




    Backslash/pipe key generates a single scan code, the topic is about remapping keys that generate multiple scan codes.
    – moonwalker
    Aug 12 '17 at 2:41











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',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
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%2f113906%2fremapping-keys-that-generate-multiple-scan-codes%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














You can do this in two steps:




  1. to catch key combinations

  2. to simulate typing different keys.


You can use xchainkeys for 1. and [xdotool][2] for 2.:



To create the simulated new key with xdotool, the option --clearmodifiers of key may be important to neutralize the original simulated modifier press:



xdotool key --clearmodifiers Shift+a


This should type a capital A as a test.



In the configuration of xchainkeys in ~/.config/xchainkeys/xchainkeys.conf, we can bind the command to a key combination:



W-l :exec xdotool key --clearmodifiers Shift+a


Now, the key combination Win and l (Win left or right do the same), as well as the key that generates Win_L + L, should create a capital A.



(There are many other programs available for both parts. For the first, one could use the hotkey configuration of a desktop environment, but I prefer to keep it independent of DEs.)






share|improve this answer



















  • 2




    The problem with this solution, if I'm not mistaken, would be the same as simply using said key combination to trigger an action - that action wouldn't be triggered by just that key, pressing the actual combination of keys that generates the same codes would also give the same result. In other words, it doesn't satisfy the "remap that key to something else that doesn't simply duplicate one of the existing key combinations" condition. But I appreciate the effort.
    – moonwalker
    Aug 23 '16 at 20:31








  • 3




    Yes, that it true - I was not sure what you meant by that sentence, now I understand. But it looks like your key produces the two key codes in hardware (that is, in the keyboards firmware) - so I see no war around, except you detect the timing of the artifivial key presses "modifier down", "other key", "modifier up". Hmm... maybe a solution involving soldering is more simple ;)
    – Volker Siegel
    Aug 26 '16 at 14:13








  • 1




    @moonwalker Can you try to remap Win_L instead of the other key, and check whether it remaps the other one's modifier too?
    – Volker Siegel
    Aug 26 '16 at 14:18






  • 1




    um, wouldn't I be losing combinations like Win_L+R, Win+Break, Win+L, Win+etc. in that case?
    – moonwalker
    Sep 29 '16 at 2:57






  • 1




    No, I don't think so. Win-L is Win-Shift-l But you could also map chains of key combinations to a command. Like Win-a and after that b. With out the Win-a, b behaves normal. That's by far the most useful feature of xchainkeys, and pretty unique, I think.
    – Volker Siegel
    Oct 1 '16 at 12:19
















1














You can do this in two steps:




  1. to catch key combinations

  2. to simulate typing different keys.


You can use xchainkeys for 1. and [xdotool][2] for 2.:



To create the simulated new key with xdotool, the option --clearmodifiers of key may be important to neutralize the original simulated modifier press:



xdotool key --clearmodifiers Shift+a


This should type a capital A as a test.



In the configuration of xchainkeys in ~/.config/xchainkeys/xchainkeys.conf, we can bind the command to a key combination:



W-l :exec xdotool key --clearmodifiers Shift+a


Now, the key combination Win and l (Win left or right do the same), as well as the key that generates Win_L + L, should create a capital A.



(There are many other programs available for both parts. For the first, one could use the hotkey configuration of a desktop environment, but I prefer to keep it independent of DEs.)






share|improve this answer



















  • 2




    The problem with this solution, if I'm not mistaken, would be the same as simply using said key combination to trigger an action - that action wouldn't be triggered by just that key, pressing the actual combination of keys that generates the same codes would also give the same result. In other words, it doesn't satisfy the "remap that key to something else that doesn't simply duplicate one of the existing key combinations" condition. But I appreciate the effort.
    – moonwalker
    Aug 23 '16 at 20:31








  • 3




    Yes, that it true - I was not sure what you meant by that sentence, now I understand. But it looks like your key produces the two key codes in hardware (that is, in the keyboards firmware) - so I see no war around, except you detect the timing of the artifivial key presses "modifier down", "other key", "modifier up". Hmm... maybe a solution involving soldering is more simple ;)
    – Volker Siegel
    Aug 26 '16 at 14:13








  • 1




    @moonwalker Can you try to remap Win_L instead of the other key, and check whether it remaps the other one's modifier too?
    – Volker Siegel
    Aug 26 '16 at 14:18






  • 1




    um, wouldn't I be losing combinations like Win_L+R, Win+Break, Win+L, Win+etc. in that case?
    – moonwalker
    Sep 29 '16 at 2:57






  • 1




    No, I don't think so. Win-L is Win-Shift-l But you could also map chains of key combinations to a command. Like Win-a and after that b. With out the Win-a, b behaves normal. That's by far the most useful feature of xchainkeys, and pretty unique, I think.
    – Volker Siegel
    Oct 1 '16 at 12:19














1












1








1






You can do this in two steps:




  1. to catch key combinations

  2. to simulate typing different keys.


You can use xchainkeys for 1. and [xdotool][2] for 2.:



To create the simulated new key with xdotool, the option --clearmodifiers of key may be important to neutralize the original simulated modifier press:



xdotool key --clearmodifiers Shift+a


This should type a capital A as a test.



In the configuration of xchainkeys in ~/.config/xchainkeys/xchainkeys.conf, we can bind the command to a key combination:



W-l :exec xdotool key --clearmodifiers Shift+a


Now, the key combination Win and l (Win left or right do the same), as well as the key that generates Win_L + L, should create a capital A.



(There are many other programs available for both parts. For the first, one could use the hotkey configuration of a desktop environment, but I prefer to keep it independent of DEs.)






share|improve this answer














You can do this in two steps:




  1. to catch key combinations

  2. to simulate typing different keys.


You can use xchainkeys for 1. and [xdotool][2] for 2.:



To create the simulated new key with xdotool, the option --clearmodifiers of key may be important to neutralize the original simulated modifier press:



xdotool key --clearmodifiers Shift+a


This should type a capital A as a test.



In the configuration of xchainkeys in ~/.config/xchainkeys/xchainkeys.conf, we can bind the command to a key combination:



W-l :exec xdotool key --clearmodifiers Shift+a


Now, the key combination Win and l (Win left or right do the same), as well as the key that generates Win_L + L, should create a capital A.



(There are many other programs available for both parts. For the first, one could use the hotkey configuration of a desktop environment, but I prefer to keep it independent of DEs.)







share|improve this answer














share|improve this answer



share|improve this answer








edited Oct 26 '16 at 22:22









SamB

340113




340113










answered Aug 16 '16 at 11:38









Volker SiegelVolker Siegel

10.8k33259




10.8k33259








  • 2




    The problem with this solution, if I'm not mistaken, would be the same as simply using said key combination to trigger an action - that action wouldn't be triggered by just that key, pressing the actual combination of keys that generates the same codes would also give the same result. In other words, it doesn't satisfy the "remap that key to something else that doesn't simply duplicate one of the existing key combinations" condition. But I appreciate the effort.
    – moonwalker
    Aug 23 '16 at 20:31








  • 3




    Yes, that it true - I was not sure what you meant by that sentence, now I understand. But it looks like your key produces the two key codes in hardware (that is, in the keyboards firmware) - so I see no war around, except you detect the timing of the artifivial key presses "modifier down", "other key", "modifier up". Hmm... maybe a solution involving soldering is more simple ;)
    – Volker Siegel
    Aug 26 '16 at 14:13








  • 1




    @moonwalker Can you try to remap Win_L instead of the other key, and check whether it remaps the other one's modifier too?
    – Volker Siegel
    Aug 26 '16 at 14:18






  • 1




    um, wouldn't I be losing combinations like Win_L+R, Win+Break, Win+L, Win+etc. in that case?
    – moonwalker
    Sep 29 '16 at 2:57






  • 1




    No, I don't think so. Win-L is Win-Shift-l But you could also map chains of key combinations to a command. Like Win-a and after that b. With out the Win-a, b behaves normal. That's by far the most useful feature of xchainkeys, and pretty unique, I think.
    – Volker Siegel
    Oct 1 '16 at 12:19














  • 2




    The problem with this solution, if I'm not mistaken, would be the same as simply using said key combination to trigger an action - that action wouldn't be triggered by just that key, pressing the actual combination of keys that generates the same codes would also give the same result. In other words, it doesn't satisfy the "remap that key to something else that doesn't simply duplicate one of the existing key combinations" condition. But I appreciate the effort.
    – moonwalker
    Aug 23 '16 at 20:31








  • 3




    Yes, that it true - I was not sure what you meant by that sentence, now I understand. But it looks like your key produces the two key codes in hardware (that is, in the keyboards firmware) - so I see no war around, except you detect the timing of the artifivial key presses "modifier down", "other key", "modifier up". Hmm... maybe a solution involving soldering is more simple ;)
    – Volker Siegel
    Aug 26 '16 at 14:13








  • 1




    @moonwalker Can you try to remap Win_L instead of the other key, and check whether it remaps the other one's modifier too?
    – Volker Siegel
    Aug 26 '16 at 14:18






  • 1




    um, wouldn't I be losing combinations like Win_L+R, Win+Break, Win+L, Win+etc. in that case?
    – moonwalker
    Sep 29 '16 at 2:57






  • 1




    No, I don't think so. Win-L is Win-Shift-l But you could also map chains of key combinations to a command. Like Win-a and after that b. With out the Win-a, b behaves normal. That's by far the most useful feature of xchainkeys, and pretty unique, I think.
    – Volker Siegel
    Oct 1 '16 at 12:19








2




2




The problem with this solution, if I'm not mistaken, would be the same as simply using said key combination to trigger an action - that action wouldn't be triggered by just that key, pressing the actual combination of keys that generates the same codes would also give the same result. In other words, it doesn't satisfy the "remap that key to something else that doesn't simply duplicate one of the existing key combinations" condition. But I appreciate the effort.
– moonwalker
Aug 23 '16 at 20:31






The problem with this solution, if I'm not mistaken, would be the same as simply using said key combination to trigger an action - that action wouldn't be triggered by just that key, pressing the actual combination of keys that generates the same codes would also give the same result. In other words, it doesn't satisfy the "remap that key to something else that doesn't simply duplicate one of the existing key combinations" condition. But I appreciate the effort.
– moonwalker
Aug 23 '16 at 20:31






3




3




Yes, that it true - I was not sure what you meant by that sentence, now I understand. But it looks like your key produces the two key codes in hardware (that is, in the keyboards firmware) - so I see no war around, except you detect the timing of the artifivial key presses "modifier down", "other key", "modifier up". Hmm... maybe a solution involving soldering is more simple ;)
– Volker Siegel
Aug 26 '16 at 14:13






Yes, that it true - I was not sure what you meant by that sentence, now I understand. But it looks like your key produces the two key codes in hardware (that is, in the keyboards firmware) - so I see no war around, except you detect the timing of the artifivial key presses "modifier down", "other key", "modifier up". Hmm... maybe a solution involving soldering is more simple ;)
– Volker Siegel
Aug 26 '16 at 14:13






1




1




@moonwalker Can you try to remap Win_L instead of the other key, and check whether it remaps the other one's modifier too?
– Volker Siegel
Aug 26 '16 at 14:18




@moonwalker Can you try to remap Win_L instead of the other key, and check whether it remaps the other one's modifier too?
– Volker Siegel
Aug 26 '16 at 14:18




1




1




um, wouldn't I be losing combinations like Win_L+R, Win+Break, Win+L, Win+etc. in that case?
– moonwalker
Sep 29 '16 at 2:57




um, wouldn't I be losing combinations like Win_L+R, Win+Break, Win+L, Win+etc. in that case?
– moonwalker
Sep 29 '16 at 2:57




1




1




No, I don't think so. Win-L is Win-Shift-l But you could also map chains of key combinations to a command. Like Win-a and after that b. With out the Win-a, b behaves normal. That's by far the most useful feature of xchainkeys, and pretty unique, I think.
– Volker Siegel
Oct 1 '16 at 12:19




No, I don't think so. Win-L is Win-Shift-l But you could also map chains of key combinations to a command. Like Win-a and after that b. With out the Win-a, b behaves normal. That's by far the most useful feature of xchainkeys, and pretty unique, I think.
– Volker Siegel
Oct 1 '16 at 12:19













-2














This is what I did on my Thinkpad Yoga in order to rebind the backslash/pipe key to the correct key. Because for some reason in every Linux Virtual Machine it interpreted the backslashpipe (|) key as the less than (<) key.



First execute the command: xev



Press the desired key to get the keycode for the key you want to rebind:



xev KeyPress event output



In this example the Keycode is 94 and the action is "less" but we want it to have the action of backslash and bar aka "pipe"



Remap the keycode 94 to the backslash and bar key aka "pipe":



xmodmap -e 'keycode 94 = backslash bar'


Now lets make this persistent:



xmodmap -pke | egrep "backslash|bar" | grep 94 > ~/.Xmodmap`


Returns the following to the file ~/.Xmodmap:



keycode  94 = backslash bar backslash bar


Then you must create the following file to finish making it persistent:



echo "xmodmap .Xmodmap" > ~/.xinitrc





share|improve this answer

















  • 1




    Backslash/pipe key generates a single scan code, the topic is about remapping keys that generate multiple scan codes.
    – moonwalker
    Aug 12 '17 at 2:41
















-2














This is what I did on my Thinkpad Yoga in order to rebind the backslash/pipe key to the correct key. Because for some reason in every Linux Virtual Machine it interpreted the backslashpipe (|) key as the less than (<) key.



First execute the command: xev



Press the desired key to get the keycode for the key you want to rebind:



xev KeyPress event output



In this example the Keycode is 94 and the action is "less" but we want it to have the action of backslash and bar aka "pipe"



Remap the keycode 94 to the backslash and bar key aka "pipe":



xmodmap -e 'keycode 94 = backslash bar'


Now lets make this persistent:



xmodmap -pke | egrep "backslash|bar" | grep 94 > ~/.Xmodmap`


Returns the following to the file ~/.Xmodmap:



keycode  94 = backslash bar backslash bar


Then you must create the following file to finish making it persistent:



echo "xmodmap .Xmodmap" > ~/.xinitrc





share|improve this answer

















  • 1




    Backslash/pipe key generates a single scan code, the topic is about remapping keys that generate multiple scan codes.
    – moonwalker
    Aug 12 '17 at 2:41














-2












-2








-2






This is what I did on my Thinkpad Yoga in order to rebind the backslash/pipe key to the correct key. Because for some reason in every Linux Virtual Machine it interpreted the backslashpipe (|) key as the less than (<) key.



First execute the command: xev



Press the desired key to get the keycode for the key you want to rebind:



xev KeyPress event output



In this example the Keycode is 94 and the action is "less" but we want it to have the action of backslash and bar aka "pipe"



Remap the keycode 94 to the backslash and bar key aka "pipe":



xmodmap -e 'keycode 94 = backslash bar'


Now lets make this persistent:



xmodmap -pke | egrep "backslash|bar" | grep 94 > ~/.Xmodmap`


Returns the following to the file ~/.Xmodmap:



keycode  94 = backslash bar backslash bar


Then you must create the following file to finish making it persistent:



echo "xmodmap .Xmodmap" > ~/.xinitrc





share|improve this answer












This is what I did on my Thinkpad Yoga in order to rebind the backslash/pipe key to the correct key. Because for some reason in every Linux Virtual Machine it interpreted the backslashpipe (|) key as the less than (<) key.



First execute the command: xev



Press the desired key to get the keycode for the key you want to rebind:



xev KeyPress event output



In this example the Keycode is 94 and the action is "less" but we want it to have the action of backslash and bar aka "pipe"



Remap the keycode 94 to the backslash and bar key aka "pipe":



xmodmap -e 'keycode 94 = backslash bar'


Now lets make this persistent:



xmodmap -pke | egrep "backslash|bar" | grep 94 > ~/.Xmodmap`


Returns the following to the file ~/.Xmodmap:



keycode  94 = backslash bar backslash bar


Then you must create the following file to finish making it persistent:



echo "xmodmap .Xmodmap" > ~/.xinitrc






share|improve this answer












share|improve this answer



share|improve this answer










answered Jul 21 '17 at 16:26









KentgravKentgrav

8317




8317








  • 1




    Backslash/pipe key generates a single scan code, the topic is about remapping keys that generate multiple scan codes.
    – moonwalker
    Aug 12 '17 at 2:41














  • 1




    Backslash/pipe key generates a single scan code, the topic is about remapping keys that generate multiple scan codes.
    – moonwalker
    Aug 12 '17 at 2:41








1




1




Backslash/pipe key generates a single scan code, the topic is about remapping keys that generate multiple scan codes.
– moonwalker
Aug 12 '17 at 2:41




Backslash/pipe key generates a single scan code, the topic is about remapping keys that generate multiple scan codes.
– moonwalker
Aug 12 '17 at 2:41


















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f113906%2fremapping-keys-that-generate-multiple-scan-codes%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

is 'sed' thread safe

How to make a Squid Proxy server?