Disable num lock indicator LED or reverse keypad so when num lock is on, indicator light is off
You can invert the meaning of Num Lock. With Xmodmap, put this in your .Xmodmap
.
keycode 79 = KP_Home KP_7 KP_Home KP_7 KP_Home KP_7 KP_Home KP_7
keycode 80 = KP_Up KP_8 KP_Up KP_8 KP_Up KP_8 KP_Up KP_8
keycode 81 = KP_Prior KP_9 KP_Prior KP_9 KP_Prior KP_9 KP_Prior KP_9
keycode 83 = KP_Left KP_4 KP_Left KP_4 KP_Left KP_4 KP_Left KP_4
keycode 84 = KP_Begin KP_5 KP_Begin KP_5 KP_Begin KP_5 KP_Begin KP_5
keycode 85 = KP_Right KP_6 KP_Right KP_6 KP_Right KP_6 KP_Right KP_6
keycode 87 = KP_End KP_1 KP_End KP_1 KP_End KP_1 KP_End KP_1
keycode 88 = KP_Down KP_2 KP_Down KP_2 KP_Down KP_2 KP_Down KP_2
keycode 89 = KP_Next KP_3 KP_Next KP_3 KP_Next KP_3 KP_Next KP_3
keycode 90 = KP_Insert KP_0 KP_Insert KP_0 KP_Insert KP_0 KP_Insert KP_0
keycode 91 = KP_Delete KP_Decimal KP_Delete KP_Decimal KP_Delete KP_Decimal KP_Delete KP_Decimal
You may need to add xmodmap ~/.Xmodmap
to your startup applications, I'm not sure if Xfce does this by default.
Doing it this way has the advantage that most of the time, you won't have NumLock on. A few programs have trouble with NumLock because they consider it to be a modifier and that causes their keyboard shortcuts not to work when it's on.
If you never turn off NumLock, you can disable the NumLock key while you're at it.
keycode 77 = NoSymbol
If you enjoy pain, you can use XKB instead. Here's my configuration which effectively makes NumLock always on. Create a file ~/.xkb/types/mytypes
containing
// Digits without NumLock, cursor with NumLock. Shift swaps the meaning.
// Do it this way because I almost always want digits, but the NumLock state
// breaks key bindings in some applications.
partial xkb_types "invert_numlock" {
type "KEYPAD" {
modifiers = Shift+NumLock;
map[None] = Level2;
map[Shift] = Level1;
map[NumLock] = Level1;
map[Shift+NumLock] = Level2;
level_name[Level1] = "Base";
level_name[Level2] = "Number";
};
include "extra(keypad)"
};
Create a file ~/.xkb/symbols/mysymbols
containing:
partial xkb_symbols "mykeypad" {
key <KP7> { [ KP_7, KP_Home ] };
key <KP8> { [ KP_8, KP_Up ] };
key <KP9> { [ KP_9, KP_Prior ] };
key <KP4> { [ KP_4, KP_Left ] };
key <KP5> { [ KP_5, KP_Begin ] };
key <KP6> { [ KP_6, KP_Right ] };
key <KP1> { [ KP_1, KP_End ] };
key <KP2> { [ KP_2, KP_Down ] };
key <KP3> { [ KP_3, KP_Next ] };
key <KP0> { [ KP_0, KP_Insert ] };
key <KPDL> { [ KP_Decimal, KP_Delete ] };
};
Run the following shell command as part of your X initialization startup (add other options to the setxkbmap
call as desired):
setxkbmap -types "complete+mytypes(invert_numlock)" \
-symbols "us+compose(menu)+mysymbols(mykeypad)" \
-print | xkbcomp -I ~/.xkb - "$DISPLAY"
If “num lock turned on by default” means “keys on the numpad by default” and you don’t want/don’t care about navigation on the keypad:
setxkbmap -option numpad:mac <layout>
So for the us
layout:
setxkbmap -option numpad:mac us
Now the numpad always enters digits, no matter the num lock state.
Reference: xkeyboard-config man-page