Sample Header Ad - 728x90

Scrolling TTY without dedicated PgUp and PgDown

6 votes
1 answer
6697 views
**Stop reading if uname -r returns a Linux version greater than 5.9**, since scrollback has been simply removed (1 , 2 ). ---- My keyboard does not have separate PgUp and PgDown keys. They are in the numpad, sharing their position with KP_9 and KP_3. Keypad picture Scrolling terminals with Shift+Pg{Up,Down} was not possible either with Numlock on or off. Since I don't care for the keypad numbers but do care a lot for scrolling, I have successfully remapped them in X11 to "Prior" and "Next" regardless of Numlock state, and now Shift+{PgUp,Down} both work in Xterm. However, I can't achieve the same in the TTY. With other keyboards that had exclusive Page keys, I could use Shift+PgUp to scroll back after cating a large file, for example. ### Original keycodes As of showkeys:
KP_3/KP_PgUp   = 73
KP_9/KP_PgDown = 81
Slash          = 89
Right Shift    = 54
As of dumpkeys:
PgUp   = 104
PgDown = 109
Slash and Right Shift were also listed because I will also swap them just for testing. ### Attempts - Modified /etc/console-setup/remap.inc to exactly this:
keycode 73 = Prior
    shift keycode 73 = Scroll_Backward
    shift shiftl  keycode 73 = Scroll_Backward
    shift shiftr  keycode 73 = Scroll_Backward
    shift shiftl  shiftr  keycode 73 = Scroll_Backward
    shift ctrll keycode 73 = Scroll_Backward
    shift shiftl  ctrll keycode 73 = Scroll_Backward
    shift shiftr  ctrll keycode 73 = Scroll_Backward
    shift shiftl  shiftr  ctrll keycode 73 = Scroll_Backward 
  keycode 81 = Next
    shift keycode 81 = Scroll_Forward
    shift shiftl  keycode 81 = Scroll_Forward
    shift shiftr  keycode 81 = Scroll_Forward
    shift shiftl  shiftr  keycode 81 = Scroll_Forward
    shift ctrll keycode 81 = Scroll_Forward
    shift shiftl  ctrll keycode 81 = Scroll_Forward
    shift shiftr  ctrll keycode 81 = Scroll_Forward
    shift shiftl  shiftr  ctrll keycode 81 = Scroll_Forward  
  keycode  89 = Shift
  keycode  54 = slash
    shift keycode  54 = question
    altgr keycode  54 = degree
    shift altgr keycode  54 = questiondown
- Followed the instructions of How to change console keymap in Linux? .
dumpkeys > pageupdown
Then swapped
keycode 73  keycode 104
  keycode 81  keycode 109
  keycode 54  keycode 89
in that file and issued loadkeys -s pageupdown. ### Results In both experiments, - Although the two keypad keys don't print numbers anymore and PgUp still works (it scrolls in less) as desired, Shift+PgUp does not scroll the TTY. - Right Shift and Slash have been correctly swapped. ### Additional notes - Toggling Numlock does not help in any of the configurations. The Fn key also does not have any effect in those keys. - I have also tried mapping more ordinary keys, namely l and p, to the Page actions, without success. - If it helps in any way, this is the XKB map that works in the X session:
partial keypad_keys
  xkb_symbols "noKPNumbers" {
      key   {	[  Prior,	Prior	]	};
      key   {	[  Next,	Next	]	};
  };
How can I map the keypad PgUp and PgDown keys in such a way that Shift+Pg{Up,Down} scroll the TTY buffer? Is it possible at all?
Asked by Quasímodo (19361 rep)
Oct 21, 2020, 03:07 PM
Last activity: Apr 13, 2025, 11:05 PM