2

I have a Asus n551 laptop. It's mostly usable despite an inconvenient touchpad, Optimus graphics card that complicate things and a screen that shows major (depending on your sensitivity) color banding.

Anyway, its keyboard lacks a End key, which is a problem for me as I use it a lot.

It has a NumLock key, though, which I don't use, and which is at the same position where, on my previous laptop, was the End key (on that previous laptop there was no NumLock key...).

Can the NumLock key be comfortably used as an End key?

1 Answers1

2

Wow, this was tricky to get right.

Sort-of solution

Adding this to a ~/.Xmodmap file somehow does the trick:

keycode 77 = End NoSymbol End

For immediate effect,

xmodmap ~/.Xmodmap

If works very well, for simple keypresses as with shift and control keys.

Now what about NumLock?

But now another problem is that the NumLock toggle is disabled, and the keypad perform arrow-like actions instead of typing numbers.

Here comes numlockx and fail:

$ numlockx status
Numlock is off
$ numlockx on
$ numlockx status
Numlock is off

Hum, strange.

Shift+NumLock (key) as Num_Lock (keysym). Works, but inconvenient.

I tried

keycode 77 = End Num_Lock End

but though it allows to do Shift+NumLock to toggle keypad behavior, it hinders Shift+End, a combination that I often use while typing (select to end-of-line).

Keypad-divide as Num_Lock. Fail.

I tried the key next to it:

keycode 77 = End NoSymbol End
keycode 106 = Num_Lock KP_Divide KP_Divide KP_Divide KP_Divide XF86Ungrab

or even

keycode 77 = End NoSymbol End
keycode 106 = Num_Lock Num_Lock Num_Lock Num_Lock Num_Lock Num_Lock Num_Lock Num_Lock

but pressing that key did not have any effect.

Actually, xmodmap ~/.Xmodmap seems to reset NumLock toggle to false.

Same for the ² twosuperior key which I don't use for typing:

keycode 49 = Num_Lock Num_Lock Num_Lock Num_Lock Num_Lock Num_Lock Num_Lock Num_Lock

Tricky solution

It looks like if the keycode 77 is not bound to Num_Lock at all, then NumLock toggle is always kept at false.

Let's assign it (in ~/.Xmodmap) some combination so obscure that I can't figure out:

keycode 77 = End NoSymbol End Num_Lock

Then

$ numlockx on
$ numlockx status
Numlock is on

Conclusion: success

  • I can use the physical NumLock key as End key with Shift and Control.
  • numlockx on works, for the rare case I will need it.

Additional information

  • French keyboard layout on Xubuntu 15.04.
  • Just noticed a drawback: even with all this stuff each press on the "num lock" key sets the flag to off. A workaround is to have numlockx enable it at all times: nohup bash -c "while sleep 1 ; do numlockx on ; done" &

    Something simpler might be possible.

    – Stéphane Gourichon Dec 31 '15 at 10:30