How to Program Number Keypad as Function Keys

By Xah Lee. Date: . Last updated: .

This page shows you how to set the numberpad keys as function keys, for {Windows, Linux, Mac}. For example, set a key to copy, paste, switch to browser, close tab, etc.

havit keyboard 20210307 s50 numpad
Windows keyboard numerical keypad

Microsoft Windows

First, you need to install AutoHotkey. [see AutoHotkey Tutorial]

Create a file with the following content.

; set number pad keys
NumpadDiv::Send ^{PgUp} ; previous tab
NumpadMult::Send ^{PgDn} ; next tab
NumpadSub::Send ^w ; close window

Name the file โ€œnumpad_keys.ahkโ€.

Now, double click the file to run it. It will run in the background, and now you can press the / * to switch to pre/next tab, and - to close tab.

Put a file shortcut of the script in the auto start directory. See Windows: Add App to Auto Start

Mac

Use Karabiner-Elements to program the keys. [see Mac Keyboard Software Guide]

Linux

For Linux, there are 2 things you need to do.

  1. Set a key to run a shell command.
  2. The shell command does action. It can send key combination such as Ctrl+c, or {switch, close, launch, etc} {windows, apps, tabs, etc}.

For major Linux desktops such as Gnome, KDE, Xfce , there's a GUI that lets you easily set a key to run a shell command. Look for it in your system control panel.

xfce window manager keys panel 2017-02-04
xfce window manager keys panel 2017-02-04 Linux: Xfce Keyboard Shortcuts

I recommend using the desktop GUI to set a key. Otherwise, you can use xbindkeys. See Linux: xbindkeys Tutorial

For {switch, open, close} windows, see Linux: Add Keyboard Shortcut to Switch App

For sending key combinations, use xvkbd. See Linux: xvkbd tutorial

Emacs

Emacs: Bind Number Pad Keys

Programable Keypad