XKB: Shift or control + numpad = down without shift

Clash Royale CLAN TAG#URR8PPP
I'd like to map my keyboard so that (when the Numlock is On), the numpad key 2 named KP_2 procudes a 2, but when I press Shift or Control I want this same key to produce a Down event, exactly like the down key.
So I created a new type like that contains the following added lines:
modifiers= Shift+Control+NumLock+LevelThree;
map[Shift+NumLock]= Level1;
preserve[Shift+NumLock]= None;
...
map[Control+NumLock]= Level1;
preserve[Control+NumLock]= None;
So the whole type becomes:
type "FOUR_LEVEL_MIXED_KEYPAD_CUST"
modifiers= Shift+Control+NumLock+LevelThree;
map[Shift+NumLock]= Level1;
preserve[Shift+NumLock]= None;
map[NumLock]= Level2;
map[Shift]= Level2;
map[LevelThree]= Level3;
map[NumLock+LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Shift+NumLock+LevelThree]= Level4;
map[Control+NumLock]= Level1;
preserve[Control+NumLock]= None;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
;
And I changed the KP_2 section to take this into account that way:
key <KP2>
type= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ Down, KP_2, U2193, U21D3 ]
;
(see KP_Down became Down and I changed the name of the group)
Unfortunately, when I run xkbcomp preserve_none.xkb $DISPLAY, on LibreOffice Calc, Shift + (NumLock) + KP2 produces something like a Shift + Down (it both goes down and select, despite the preserve[...]=None), and when I press Ctrl + KP2, basically nothing happen, I don't even move.
Do you see what I did wrong? Thanks!
NB: You can find the whole file here: http://paste.debian.net/1063341
xkb
add a comment |
I'd like to map my keyboard so that (when the Numlock is On), the numpad key 2 named KP_2 procudes a 2, but when I press Shift or Control I want this same key to produce a Down event, exactly like the down key.
So I created a new type like that contains the following added lines:
modifiers= Shift+Control+NumLock+LevelThree;
map[Shift+NumLock]= Level1;
preserve[Shift+NumLock]= None;
...
map[Control+NumLock]= Level1;
preserve[Control+NumLock]= None;
So the whole type becomes:
type "FOUR_LEVEL_MIXED_KEYPAD_CUST"
modifiers= Shift+Control+NumLock+LevelThree;
map[Shift+NumLock]= Level1;
preserve[Shift+NumLock]= None;
map[NumLock]= Level2;
map[Shift]= Level2;
map[LevelThree]= Level3;
map[NumLock+LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Shift+NumLock+LevelThree]= Level4;
map[Control+NumLock]= Level1;
preserve[Control+NumLock]= None;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
;
And I changed the KP_2 section to take this into account that way:
key <KP2>
type= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ Down, KP_2, U2193, U21D3 ]
;
(see KP_Down became Down and I changed the name of the group)
Unfortunately, when I run xkbcomp preserve_none.xkb $DISPLAY, on LibreOffice Calc, Shift + (NumLock) + KP2 produces something like a Shift + Down (it both goes down and select, despite the preserve[...]=None), and when I press Ctrl + KP2, basically nothing happen, I don't even move.
Do you see what I did wrong? Thanks!
NB: You can find the whole file here: http://paste.debian.net/1063341
xkb
add a comment |
I'd like to map my keyboard so that (when the Numlock is On), the numpad key 2 named KP_2 procudes a 2, but when I press Shift or Control I want this same key to produce a Down event, exactly like the down key.
So I created a new type like that contains the following added lines:
modifiers= Shift+Control+NumLock+LevelThree;
map[Shift+NumLock]= Level1;
preserve[Shift+NumLock]= None;
...
map[Control+NumLock]= Level1;
preserve[Control+NumLock]= None;
So the whole type becomes:
type "FOUR_LEVEL_MIXED_KEYPAD_CUST"
modifiers= Shift+Control+NumLock+LevelThree;
map[Shift+NumLock]= Level1;
preserve[Shift+NumLock]= None;
map[NumLock]= Level2;
map[Shift]= Level2;
map[LevelThree]= Level3;
map[NumLock+LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Shift+NumLock+LevelThree]= Level4;
map[Control+NumLock]= Level1;
preserve[Control+NumLock]= None;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
;
And I changed the KP_2 section to take this into account that way:
key <KP2>
type= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ Down, KP_2, U2193, U21D3 ]
;
(see KP_Down became Down and I changed the name of the group)
Unfortunately, when I run xkbcomp preserve_none.xkb $DISPLAY, on LibreOffice Calc, Shift + (NumLock) + KP2 produces something like a Shift + Down (it both goes down and select, despite the preserve[...]=None), and when I press Ctrl + KP2, basically nothing happen, I don't even move.
Do you see what I did wrong? Thanks!
NB: You can find the whole file here: http://paste.debian.net/1063341
xkb
I'd like to map my keyboard so that (when the Numlock is On), the numpad key 2 named KP_2 procudes a 2, but when I press Shift or Control I want this same key to produce a Down event, exactly like the down key.
So I created a new type like that contains the following added lines:
modifiers= Shift+Control+NumLock+LevelThree;
map[Shift+NumLock]= Level1;
preserve[Shift+NumLock]= None;
...
map[Control+NumLock]= Level1;
preserve[Control+NumLock]= None;
So the whole type becomes:
type "FOUR_LEVEL_MIXED_KEYPAD_CUST"
modifiers= Shift+Control+NumLock+LevelThree;
map[Shift+NumLock]= Level1;
preserve[Shift+NumLock]= None;
map[NumLock]= Level2;
map[Shift]= Level2;
map[LevelThree]= Level3;
map[NumLock+LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Shift+NumLock+LevelThree]= Level4;
map[Control+NumLock]= Level1;
preserve[Control+NumLock]= None;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
;
And I changed the KP_2 section to take this into account that way:
key <KP2>
type= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ Down, KP_2, U2193, U21D3 ]
;
(see KP_Down became Down and I changed the name of the group)
Unfortunately, when I run xkbcomp preserve_none.xkb $DISPLAY, on LibreOffice Calc, Shift + (NumLock) + KP2 produces something like a Shift + Down (it both goes down and select, despite the preserve[...]=None), and when I press Ctrl + KP2, basically nothing happen, I don't even move.
Do you see what I did wrong? Thanks!
NB: You can find the whole file here: http://paste.debian.net/1063341
xkb
xkb
edited Jan 29 at 20:07
tobiasBora
asked Jan 29 at 18:42
tobiasBoratobiasBora
249211
249211
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Hum, I think I found the solution using something based on this answer : https://superuser.com/questions/801611/how-to-make-all-applications-respect-my-modified-xkb-layout/1000320#1000320
So first, I don't know why, but it seems that for some reason I need to use type[Group1]=... instead of just type=... even if sometimes it works.
Then, the key was to introduce some new symcodes (not sure it's the good term) osfDown/osfUp/.... For example, here we say that the symcode osfLeft should be interpreted as a press on the key <LEFT>, after releasing the Shift key (at least it's how I understand it):
interpret osfLeft
repeat= True;
action = RedirectKey(keycode=<LEFT>, clearmodifiers=Shift);
;
If instead you want to release the modifier Control, you can replace Shift with Control, or even Control+Shift if you want to clear both. Then, you need to replace the old KP_Left symcode with the symcode that we just created:
key <KP4>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfLeft, KP_4, U2190, U21D0 ]
;
That way, instead of generating a KP_Left (and eventually the Shift/Control associated, depending on what you pressed), this will remove the Shift/Control modifier (again, depending on what you configured in osfLeft).
So at that step here is a first solution:
# Load with xkbcomp shift_numpad.xkb $DISPLAY
# List modifiers: xmodmap -pm
xkb_keymap
xkb_keycodes
include "evdev+aliases(azerty)"
;
xkb_types
include "complete"
;
xkb_compat
include "complete"
interpret osfLeft
repeat True;
action = RedirectKey(keycode=<LEFT>, clearmodifiers=Shift);
;
interpret osfRight
repeat= True;
action = RedirectKey(keycode=<RGHT>, clearmodifiers=Shift);
;
interpret osfUp
repeat= True;
action = RedirectKey(keycode=<UP>, clearmodifiers=Shift);
;
interpret osfDown
repeat= True;
action = RedirectKey(keycode=<DOWN>, clearmodifiers=Shift);
;
;
xkb_symbols
include "pc+fr(oss)+fr(bepo):2+inet(evdev)+ctrl(swapcaps)"
key <KP8>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfUp, KP_8, U2191, U21D1 ]
;
key <KP4>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfLeft, KP_4, U2190, U21D0 ]
;
key <KP5>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfDown, KP_5, U2194, U21D4 ]
;
key <KP6>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfRight, KP_6, U2192, U21D2 ]
;
key <KP2>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfDown, KP_2, U2193, U21D3 ]
;
;
xkb_geometry
include "pc(pc105)"
;
;
Note however that the type "FOUR_LEVEL_MIXED_KEYPAD" does not define anything for Control, and in my case I wanted to have Shift+2 to be equivalent to Shift+Down (i.e. select), but also that Control+2 generate a Down without any modifier. So I needed to update the definition of osfLeft in order to remove the modifier Control, but keep the modifier Shift if it was already present. Then, I needed to define an a custom type that maps also Ctrl on level 1:
type "FOUR_LEVEL_MIXED_KEYPAD_CUST"
modifiers= Shift+NumLock+LevelThree+Control;
map[Shift+NumLock]= Level1;
map[Control+NumLock]= Level1;
map[NumLock]= Level2;
map[Shift]= Level2;
map[Control]= Level2;
map[LevelThree]= Level3;
map[NumLock+LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Shift+NumLock+LevelThree]= Level4;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
;
If I put that all together, it gives:
# Load with xkbcomp shift_numpad.xkb $DISPLAY
# List modifiers: xmodmap -pm
xkb_keymap
xkb_keycodes
include "evdev+aliases(azerty)"
;
xkb_types
include "complete"
type "FOUR_LEVEL_MIXED_KEYPAD_CUST"
modifiers= Shift+NumLock+LevelThree+Control;
map[Shift+NumLock]= Level1;
map[Control+NumLock]= Level1;
map[NumLock]= Level2;
map[Shift]= Level2;
map[Control]= Level2;
map[LevelThree]= Level3;
map[NumLock+LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Shift+NumLock+LevelThree]= Level4;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
;
;
xkb_compat
include "complete"
interpret osfLeft
repeat= True;
action = RedirectKey(keycode=<LEFT>, clearmodifiers=Control);
;
interpret osfRight
repeat= True;
action = RedirectKey(keycode=<RGHT>, clearmodifiers=Control);
;
interpret osfUp
repeat= True;
action = RedirectKey(keycode=<UP>, clearmodifiers=Control);
;
interpret osfDown
repeat= True;
action = RedirectKey(keycode=<DOWN>, clearmodifiers=Control);
;
;
xkb_symbols
include "pc+fr(oss)+fr(bepo):2+inet(evdev)+ctrl(swapcaps)"
key <KP8>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfUp, KP_8, U2191, U21D1 ]
;
key <KP4>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfLeft, KP_4, U2190, U21D0 ]
;
key <KP5>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfDown, KP_5, U2194, U21D4 ]
;
key <KP6>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfRight, KP_6, U2192, U21D2 ]
;
key <KP2>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfDown, KP_2, U2193, U21D3 ]
;
;
xkb_geometry
include "pc(pc105)"
;
;
NB: And if you want to play with the Super/LWIN key, it's exactly the same thing, but use Mod4 instead of Shift, and make sure you have a
modifier_map Mod4 <LWIN> ;
in the symbol section!
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f497524%2fxkb-shift-or-control-numpad-down-without-shift%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Hum, I think I found the solution using something based on this answer : https://superuser.com/questions/801611/how-to-make-all-applications-respect-my-modified-xkb-layout/1000320#1000320
So first, I don't know why, but it seems that for some reason I need to use type[Group1]=... instead of just type=... even if sometimes it works.
Then, the key was to introduce some new symcodes (not sure it's the good term) osfDown/osfUp/.... For example, here we say that the symcode osfLeft should be interpreted as a press on the key <LEFT>, after releasing the Shift key (at least it's how I understand it):
interpret osfLeft
repeat= True;
action = RedirectKey(keycode=<LEFT>, clearmodifiers=Shift);
;
If instead you want to release the modifier Control, you can replace Shift with Control, or even Control+Shift if you want to clear both. Then, you need to replace the old KP_Left symcode with the symcode that we just created:
key <KP4>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfLeft, KP_4, U2190, U21D0 ]
;
That way, instead of generating a KP_Left (and eventually the Shift/Control associated, depending on what you pressed), this will remove the Shift/Control modifier (again, depending on what you configured in osfLeft).
So at that step here is a first solution:
# Load with xkbcomp shift_numpad.xkb $DISPLAY
# List modifiers: xmodmap -pm
xkb_keymap
xkb_keycodes
include "evdev+aliases(azerty)"
;
xkb_types
include "complete"
;
xkb_compat
include "complete"
interpret osfLeft
repeat True;
action = RedirectKey(keycode=<LEFT>, clearmodifiers=Shift);
;
interpret osfRight
repeat= True;
action = RedirectKey(keycode=<RGHT>, clearmodifiers=Shift);
;
interpret osfUp
repeat= True;
action = RedirectKey(keycode=<UP>, clearmodifiers=Shift);
;
interpret osfDown
repeat= True;
action = RedirectKey(keycode=<DOWN>, clearmodifiers=Shift);
;
;
xkb_symbols
include "pc+fr(oss)+fr(bepo):2+inet(evdev)+ctrl(swapcaps)"
key <KP8>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfUp, KP_8, U2191, U21D1 ]
;
key <KP4>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfLeft, KP_4, U2190, U21D0 ]
;
key <KP5>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfDown, KP_5, U2194, U21D4 ]
;
key <KP6>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfRight, KP_6, U2192, U21D2 ]
;
key <KP2>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfDown, KP_2, U2193, U21D3 ]
;
;
xkb_geometry
include "pc(pc105)"
;
;
Note however that the type "FOUR_LEVEL_MIXED_KEYPAD" does not define anything for Control, and in my case I wanted to have Shift+2 to be equivalent to Shift+Down (i.e. select), but also that Control+2 generate a Down without any modifier. So I needed to update the definition of osfLeft in order to remove the modifier Control, but keep the modifier Shift if it was already present. Then, I needed to define an a custom type that maps also Ctrl on level 1:
type "FOUR_LEVEL_MIXED_KEYPAD_CUST"
modifiers= Shift+NumLock+LevelThree+Control;
map[Shift+NumLock]= Level1;
map[Control+NumLock]= Level1;
map[NumLock]= Level2;
map[Shift]= Level2;
map[Control]= Level2;
map[LevelThree]= Level3;
map[NumLock+LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Shift+NumLock+LevelThree]= Level4;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
;
If I put that all together, it gives:
# Load with xkbcomp shift_numpad.xkb $DISPLAY
# List modifiers: xmodmap -pm
xkb_keymap
xkb_keycodes
include "evdev+aliases(azerty)"
;
xkb_types
include "complete"
type "FOUR_LEVEL_MIXED_KEYPAD_CUST"
modifiers= Shift+NumLock+LevelThree+Control;
map[Shift+NumLock]= Level1;
map[Control+NumLock]= Level1;
map[NumLock]= Level2;
map[Shift]= Level2;
map[Control]= Level2;
map[LevelThree]= Level3;
map[NumLock+LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Shift+NumLock+LevelThree]= Level4;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
;
;
xkb_compat
include "complete"
interpret osfLeft
repeat= True;
action = RedirectKey(keycode=<LEFT>, clearmodifiers=Control);
;
interpret osfRight
repeat= True;
action = RedirectKey(keycode=<RGHT>, clearmodifiers=Control);
;
interpret osfUp
repeat= True;
action = RedirectKey(keycode=<UP>, clearmodifiers=Control);
;
interpret osfDown
repeat= True;
action = RedirectKey(keycode=<DOWN>, clearmodifiers=Control);
;
;
xkb_symbols
include "pc+fr(oss)+fr(bepo):2+inet(evdev)+ctrl(swapcaps)"
key <KP8>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfUp, KP_8, U2191, U21D1 ]
;
key <KP4>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfLeft, KP_4, U2190, U21D0 ]
;
key <KP5>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfDown, KP_5, U2194, U21D4 ]
;
key <KP6>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfRight, KP_6, U2192, U21D2 ]
;
key <KP2>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfDown, KP_2, U2193, U21D3 ]
;
;
xkb_geometry
include "pc(pc105)"
;
;
NB: And if you want to play with the Super/LWIN key, it's exactly the same thing, but use Mod4 instead of Shift, and make sure you have a
modifier_map Mod4 <LWIN> ;
in the symbol section!
add a comment |
Hum, I think I found the solution using something based on this answer : https://superuser.com/questions/801611/how-to-make-all-applications-respect-my-modified-xkb-layout/1000320#1000320
So first, I don't know why, but it seems that for some reason I need to use type[Group1]=... instead of just type=... even if sometimes it works.
Then, the key was to introduce some new symcodes (not sure it's the good term) osfDown/osfUp/.... For example, here we say that the symcode osfLeft should be interpreted as a press on the key <LEFT>, after releasing the Shift key (at least it's how I understand it):
interpret osfLeft
repeat= True;
action = RedirectKey(keycode=<LEFT>, clearmodifiers=Shift);
;
If instead you want to release the modifier Control, you can replace Shift with Control, or even Control+Shift if you want to clear both. Then, you need to replace the old KP_Left symcode with the symcode that we just created:
key <KP4>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfLeft, KP_4, U2190, U21D0 ]
;
That way, instead of generating a KP_Left (and eventually the Shift/Control associated, depending on what you pressed), this will remove the Shift/Control modifier (again, depending on what you configured in osfLeft).
So at that step here is a first solution:
# Load with xkbcomp shift_numpad.xkb $DISPLAY
# List modifiers: xmodmap -pm
xkb_keymap
xkb_keycodes
include "evdev+aliases(azerty)"
;
xkb_types
include "complete"
;
xkb_compat
include "complete"
interpret osfLeft
repeat True;
action = RedirectKey(keycode=<LEFT>, clearmodifiers=Shift);
;
interpret osfRight
repeat= True;
action = RedirectKey(keycode=<RGHT>, clearmodifiers=Shift);
;
interpret osfUp
repeat= True;
action = RedirectKey(keycode=<UP>, clearmodifiers=Shift);
;
interpret osfDown
repeat= True;
action = RedirectKey(keycode=<DOWN>, clearmodifiers=Shift);
;
;
xkb_symbols
include "pc+fr(oss)+fr(bepo):2+inet(evdev)+ctrl(swapcaps)"
key <KP8>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfUp, KP_8, U2191, U21D1 ]
;
key <KP4>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfLeft, KP_4, U2190, U21D0 ]
;
key <KP5>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfDown, KP_5, U2194, U21D4 ]
;
key <KP6>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfRight, KP_6, U2192, U21D2 ]
;
key <KP2>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfDown, KP_2, U2193, U21D3 ]
;
;
xkb_geometry
include "pc(pc105)"
;
;
Note however that the type "FOUR_LEVEL_MIXED_KEYPAD" does not define anything for Control, and in my case I wanted to have Shift+2 to be equivalent to Shift+Down (i.e. select), but also that Control+2 generate a Down without any modifier. So I needed to update the definition of osfLeft in order to remove the modifier Control, but keep the modifier Shift if it was already present. Then, I needed to define an a custom type that maps also Ctrl on level 1:
type "FOUR_LEVEL_MIXED_KEYPAD_CUST"
modifiers= Shift+NumLock+LevelThree+Control;
map[Shift+NumLock]= Level1;
map[Control+NumLock]= Level1;
map[NumLock]= Level2;
map[Shift]= Level2;
map[Control]= Level2;
map[LevelThree]= Level3;
map[NumLock+LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Shift+NumLock+LevelThree]= Level4;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
;
If I put that all together, it gives:
# Load with xkbcomp shift_numpad.xkb $DISPLAY
# List modifiers: xmodmap -pm
xkb_keymap
xkb_keycodes
include "evdev+aliases(azerty)"
;
xkb_types
include "complete"
type "FOUR_LEVEL_MIXED_KEYPAD_CUST"
modifiers= Shift+NumLock+LevelThree+Control;
map[Shift+NumLock]= Level1;
map[Control+NumLock]= Level1;
map[NumLock]= Level2;
map[Shift]= Level2;
map[Control]= Level2;
map[LevelThree]= Level3;
map[NumLock+LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Shift+NumLock+LevelThree]= Level4;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
;
;
xkb_compat
include "complete"
interpret osfLeft
repeat= True;
action = RedirectKey(keycode=<LEFT>, clearmodifiers=Control);
;
interpret osfRight
repeat= True;
action = RedirectKey(keycode=<RGHT>, clearmodifiers=Control);
;
interpret osfUp
repeat= True;
action = RedirectKey(keycode=<UP>, clearmodifiers=Control);
;
interpret osfDown
repeat= True;
action = RedirectKey(keycode=<DOWN>, clearmodifiers=Control);
;
;
xkb_symbols
include "pc+fr(oss)+fr(bepo):2+inet(evdev)+ctrl(swapcaps)"
key <KP8>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfUp, KP_8, U2191, U21D1 ]
;
key <KP4>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfLeft, KP_4, U2190, U21D0 ]
;
key <KP5>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfDown, KP_5, U2194, U21D4 ]
;
key <KP6>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfRight, KP_6, U2192, U21D2 ]
;
key <KP2>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfDown, KP_2, U2193, U21D3 ]
;
;
xkb_geometry
include "pc(pc105)"
;
;
NB: And if you want to play with the Super/LWIN key, it's exactly the same thing, but use Mod4 instead of Shift, and make sure you have a
modifier_map Mod4 <LWIN> ;
in the symbol section!
add a comment |
Hum, I think I found the solution using something based on this answer : https://superuser.com/questions/801611/how-to-make-all-applications-respect-my-modified-xkb-layout/1000320#1000320
So first, I don't know why, but it seems that for some reason I need to use type[Group1]=... instead of just type=... even if sometimes it works.
Then, the key was to introduce some new symcodes (not sure it's the good term) osfDown/osfUp/.... For example, here we say that the symcode osfLeft should be interpreted as a press on the key <LEFT>, after releasing the Shift key (at least it's how I understand it):
interpret osfLeft
repeat= True;
action = RedirectKey(keycode=<LEFT>, clearmodifiers=Shift);
;
If instead you want to release the modifier Control, you can replace Shift with Control, or even Control+Shift if you want to clear both. Then, you need to replace the old KP_Left symcode with the symcode that we just created:
key <KP4>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfLeft, KP_4, U2190, U21D0 ]
;
That way, instead of generating a KP_Left (and eventually the Shift/Control associated, depending on what you pressed), this will remove the Shift/Control modifier (again, depending on what you configured in osfLeft).
So at that step here is a first solution:
# Load with xkbcomp shift_numpad.xkb $DISPLAY
# List modifiers: xmodmap -pm
xkb_keymap
xkb_keycodes
include "evdev+aliases(azerty)"
;
xkb_types
include "complete"
;
xkb_compat
include "complete"
interpret osfLeft
repeat True;
action = RedirectKey(keycode=<LEFT>, clearmodifiers=Shift);
;
interpret osfRight
repeat= True;
action = RedirectKey(keycode=<RGHT>, clearmodifiers=Shift);
;
interpret osfUp
repeat= True;
action = RedirectKey(keycode=<UP>, clearmodifiers=Shift);
;
interpret osfDown
repeat= True;
action = RedirectKey(keycode=<DOWN>, clearmodifiers=Shift);
;
;
xkb_symbols
include "pc+fr(oss)+fr(bepo):2+inet(evdev)+ctrl(swapcaps)"
key <KP8>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfUp, KP_8, U2191, U21D1 ]
;
key <KP4>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfLeft, KP_4, U2190, U21D0 ]
;
key <KP5>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfDown, KP_5, U2194, U21D4 ]
;
key <KP6>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfRight, KP_6, U2192, U21D2 ]
;
key <KP2>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfDown, KP_2, U2193, U21D3 ]
;
;
xkb_geometry
include "pc(pc105)"
;
;
Note however that the type "FOUR_LEVEL_MIXED_KEYPAD" does not define anything for Control, and in my case I wanted to have Shift+2 to be equivalent to Shift+Down (i.e. select), but also that Control+2 generate a Down without any modifier. So I needed to update the definition of osfLeft in order to remove the modifier Control, but keep the modifier Shift if it was already present. Then, I needed to define an a custom type that maps also Ctrl on level 1:
type "FOUR_LEVEL_MIXED_KEYPAD_CUST"
modifiers= Shift+NumLock+LevelThree+Control;
map[Shift+NumLock]= Level1;
map[Control+NumLock]= Level1;
map[NumLock]= Level2;
map[Shift]= Level2;
map[Control]= Level2;
map[LevelThree]= Level3;
map[NumLock+LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Shift+NumLock+LevelThree]= Level4;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
;
If I put that all together, it gives:
# Load with xkbcomp shift_numpad.xkb $DISPLAY
# List modifiers: xmodmap -pm
xkb_keymap
xkb_keycodes
include "evdev+aliases(azerty)"
;
xkb_types
include "complete"
type "FOUR_LEVEL_MIXED_KEYPAD_CUST"
modifiers= Shift+NumLock+LevelThree+Control;
map[Shift+NumLock]= Level1;
map[Control+NumLock]= Level1;
map[NumLock]= Level2;
map[Shift]= Level2;
map[Control]= Level2;
map[LevelThree]= Level3;
map[NumLock+LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Shift+NumLock+LevelThree]= Level4;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
;
;
xkb_compat
include "complete"
interpret osfLeft
repeat= True;
action = RedirectKey(keycode=<LEFT>, clearmodifiers=Control);
;
interpret osfRight
repeat= True;
action = RedirectKey(keycode=<RGHT>, clearmodifiers=Control);
;
interpret osfUp
repeat= True;
action = RedirectKey(keycode=<UP>, clearmodifiers=Control);
;
interpret osfDown
repeat= True;
action = RedirectKey(keycode=<DOWN>, clearmodifiers=Control);
;
;
xkb_symbols
include "pc+fr(oss)+fr(bepo):2+inet(evdev)+ctrl(swapcaps)"
key <KP8>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfUp, KP_8, U2191, U21D1 ]
;
key <KP4>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfLeft, KP_4, U2190, U21D0 ]
;
key <KP5>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfDown, KP_5, U2194, U21D4 ]
;
key <KP6>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfRight, KP_6, U2192, U21D2 ]
;
key <KP2>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfDown, KP_2, U2193, U21D3 ]
;
;
xkb_geometry
include "pc(pc105)"
;
;
NB: And if you want to play with the Super/LWIN key, it's exactly the same thing, but use Mod4 instead of Shift, and make sure you have a
modifier_map Mod4 <LWIN> ;
in the symbol section!
Hum, I think I found the solution using something based on this answer : https://superuser.com/questions/801611/how-to-make-all-applications-respect-my-modified-xkb-layout/1000320#1000320
So first, I don't know why, but it seems that for some reason I need to use type[Group1]=... instead of just type=... even if sometimes it works.
Then, the key was to introduce some new symcodes (not sure it's the good term) osfDown/osfUp/.... For example, here we say that the symcode osfLeft should be interpreted as a press on the key <LEFT>, after releasing the Shift key (at least it's how I understand it):
interpret osfLeft
repeat= True;
action = RedirectKey(keycode=<LEFT>, clearmodifiers=Shift);
;
If instead you want to release the modifier Control, you can replace Shift with Control, or even Control+Shift if you want to clear both. Then, you need to replace the old KP_Left symcode with the symcode that we just created:
key <KP4>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfLeft, KP_4, U2190, U21D0 ]
;
That way, instead of generating a KP_Left (and eventually the Shift/Control associated, depending on what you pressed), this will remove the Shift/Control modifier (again, depending on what you configured in osfLeft).
So at that step here is a first solution:
# Load with xkbcomp shift_numpad.xkb $DISPLAY
# List modifiers: xmodmap -pm
xkb_keymap
xkb_keycodes
include "evdev+aliases(azerty)"
;
xkb_types
include "complete"
;
xkb_compat
include "complete"
interpret osfLeft
repeat True;
action = RedirectKey(keycode=<LEFT>, clearmodifiers=Shift);
;
interpret osfRight
repeat= True;
action = RedirectKey(keycode=<RGHT>, clearmodifiers=Shift);
;
interpret osfUp
repeat= True;
action = RedirectKey(keycode=<UP>, clearmodifiers=Shift);
;
interpret osfDown
repeat= True;
action = RedirectKey(keycode=<DOWN>, clearmodifiers=Shift);
;
;
xkb_symbols
include "pc+fr(oss)+fr(bepo):2+inet(evdev)+ctrl(swapcaps)"
key <KP8>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfUp, KP_8, U2191, U21D1 ]
;
key <KP4>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfLeft, KP_4, U2190, U21D0 ]
;
key <KP5>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfDown, KP_5, U2194, U21D4 ]
;
key <KP6>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfRight, KP_6, U2192, U21D2 ]
;
key <KP2>
type= "FOUR_LEVEL_MIXED_KEYPAD",
symbols[Group1]= [ osfDown, KP_2, U2193, U21D3 ]
;
;
xkb_geometry
include "pc(pc105)"
;
;
Note however that the type "FOUR_LEVEL_MIXED_KEYPAD" does not define anything for Control, and in my case I wanted to have Shift+2 to be equivalent to Shift+Down (i.e. select), but also that Control+2 generate a Down without any modifier. So I needed to update the definition of osfLeft in order to remove the modifier Control, but keep the modifier Shift if it was already present. Then, I needed to define an a custom type that maps also Ctrl on level 1:
type "FOUR_LEVEL_MIXED_KEYPAD_CUST"
modifiers= Shift+NumLock+LevelThree+Control;
map[Shift+NumLock]= Level1;
map[Control+NumLock]= Level1;
map[NumLock]= Level2;
map[Shift]= Level2;
map[Control]= Level2;
map[LevelThree]= Level3;
map[NumLock+LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Shift+NumLock+LevelThree]= Level4;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
;
If I put that all together, it gives:
# Load with xkbcomp shift_numpad.xkb $DISPLAY
# List modifiers: xmodmap -pm
xkb_keymap
xkb_keycodes
include "evdev+aliases(azerty)"
;
xkb_types
include "complete"
type "FOUR_LEVEL_MIXED_KEYPAD_CUST"
modifiers= Shift+NumLock+LevelThree+Control;
map[Shift+NumLock]= Level1;
map[Control+NumLock]= Level1;
map[NumLock]= Level2;
map[Shift]= Level2;
map[Control]= Level2;
map[LevelThree]= Level3;
map[NumLock+LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Shift+NumLock+LevelThree]= Level4;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
;
;
xkb_compat
include "complete"
interpret osfLeft
repeat= True;
action = RedirectKey(keycode=<LEFT>, clearmodifiers=Control);
;
interpret osfRight
repeat= True;
action = RedirectKey(keycode=<RGHT>, clearmodifiers=Control);
;
interpret osfUp
repeat= True;
action = RedirectKey(keycode=<UP>, clearmodifiers=Control);
;
interpret osfDown
repeat= True;
action = RedirectKey(keycode=<DOWN>, clearmodifiers=Control);
;
;
xkb_symbols
include "pc+fr(oss)+fr(bepo):2+inet(evdev)+ctrl(swapcaps)"
key <KP8>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfUp, KP_8, U2191, U21D1 ]
;
key <KP4>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfLeft, KP_4, U2190, U21D0 ]
;
key <KP5>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfDown, KP_5, U2194, U21D4 ]
;
key <KP6>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfRight, KP_6, U2192, U21D2 ]
;
key <KP2>
type[Group1]= "FOUR_LEVEL_MIXED_KEYPAD_CUST",
symbols[Group1]= [ osfDown, KP_2, U2193, U21D3 ]
;
;
xkb_geometry
include "pc(pc105)"
;
;
NB: And if you want to play with the Super/LWIN key, it's exactly the same thing, but use Mod4 instead of Shift, and make sure you have a
modifier_map Mod4 <LWIN> ;
in the symbol section!
edited Jan 30 at 0:37
answered Jan 30 at 0:10
tobiasBoratobiasBora
249211
249211
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f497524%2fxkb-shift-or-control-numpad-down-without-shift%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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