xev utility and then apply a permanent rule via xmodmap. This process involves mapping the key to no action or binding it to a harmless function, ensuring that the physical key no longer triggers page-down events in your window manager. The solution requires editing configuration files to ensure the change persists across sessions, providing a robust fix for users who find this key intrusive or accidental.
Identifying the Keycode
Before modifying any keyboard mappings, you need to know the exact numerical code Xorg assigns to your Pagedown key. This code can vary between different keyboard layouts and hardware manufacturers. The standard tool for discovering these codes isxev, which generates event windows for debugging X11 applications.
First, open a terminal emulator within your active Xorg session. Type xev and press Enter. A small, blank window will appear on your screen. Click inside this window to give it focus. Now, press the Pagedown key once. Look at the terminal output where xev is logging events. You are looking for a line that resembles the following:
KeyPress event, serial 36, synthetic NO, window 0x4c00001,
root 0x1f9, subw 0x0, time 12345678, (100,100), root:(105,105),
state 0x0, keycode 118 (keysym 0xff54, Page_Down), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
In this example, the keycode is 118. Note this number down, as you will need it for the next step. If you have multiple keys labeled "Page Down" or similar variations like "PgDn", check all of them to see if they share the same keycode or if they differ. Some compact keyboards may use different scancodes for modifier combinations.
Applying the Change with xmodmap
Once you have the keycode, you can usexmodmap to remap it. The command syntax is straightforward: you specify the keycode followed by an empty set of parentheses to indicate that the key should produce no output. Using the example keycode from above, the command would be:
xmodmap -e "keycode 118 ="
Execute this command in your terminal. Immediately test the Pagedown key in your browser, document viewer, or text editor. It should now do nothing when pressed. If you want to bind it to a different function instead of disabling it entirely, you can replace the empty quotes with a valid keysym, such as NoSymbol or another command like Home. However, for pure disabling, leaving the value empty is the most effective method.
This change is temporary and will revert upon logout or system reboot. To make it permanent, you need to add this command to your startup configuration. Most Linux desktop environments load user-specific X modmaps from the file ~/.Xmodmap. Create or edit this file in your home directory and add the line:
keycode 118 =
If your distribution uses a display manager that does not automatically load ~/.Xmodmap, you may need to add the xmodmap command to your window manager's autostart script or your ~/.xprofile file. For systemd-based systems, creating a simple user service is also a reliable alternative.
Verifying and Troubleshooting
After applying the changes, verify that the mapping has taken effect. You can runxmodmap -pke | grep 118 to see the current mapping for that keycode. If it shows keycode 118 =, the change was successful. If it still shows Page_Down, the configuration file was not loaded correctly.
Common issues arise from conflicting configurations. Some desktop environments, such as GNOME or KDE, may override xmodmap settings with their own keyboard handling daemons. In such cases, you might need to disable the default keyboard layout management in your desktop settings or use tools like setxkbmap for more persistent control. Additionally, if you are using a laptop with special function keys, ensure that the Fn lock is not interfering with the base keycode interpretation.
For users experiencing broader input issues, such as keys not working in other environments, checking kernel-level drivers might be necessary. See our guide on Keyboard not working in Windows or Fedora 37 but works in Grub for deeper diagnostic steps on hardware-level failures.
Frequently Asked Questions
How do I re-enable the Pagedown key after disabling it?
To restore functionality, simply remove or comment out the line containing the empty keycode assignment in your ~/.Xmodmap file. Then, either log out and back in, or run xmodmap ~/.Xmodmap to reload the default mappings. The key will return to its standard page-down behavior.
Why does my Pagedown key still work after adding the xmodmap rule?
This usually happens because your desktop environment overrides user-level X modmaps with its own configuration system. Check your desktop settings for custom keyboard shortcuts that might be capturing the key before xmodmap processes it. Disabling the shortcut in the GUI settings often resolves the conflict.
Can I disable other keys using the same method?
Yes, the xmodmap method works for any key whose keycode you can identify with xev. You can map Caps Lock, Escape, or even unused media keys to NoSymbol to disable them. This is useful for cleaning up cluttered keyboards or preventing accidental triggers during workflows.
Is there a way to disable the key globally without editing config files?
You can apply the change temporarily by running the xmodmap -e command directly in the terminal, but it will vanish after a restart. For a global system-wide change affecting all users, you would need to modify system-level XKB rules in /usr/share/X11/xkb/, though this requires root privileges and carries higher risk than user-level edits.
What if xev doesn't show any output when I press the key?
If xev shows nothing, the key might be handled by the kernel or firmware before reaching Xorg. Try pressing it in a plain text console (Ctrl+Alt+F3) to see if it produces characters. If it works in the console but not in X, the issue might be related to X11 forwarding or display server permissions rather than the key mapping itself.