Introduction: How to Repurpose Lesser Used Keys on Linux

There are several lesser-used keys on the keyboard, including insert, print screen, scroll lock, and pause/break. However, there is an easy way to repurpose them if you are using a Linux-based OS. This will add functionality to them such as opening applications or running custom scripts.

Materials:

  • 1 keyboard (mechanical is best)
  • 1 key cap remover (optional)
  • 1 computer running a Linux-based operating system
  • 1 post-it note
  • 1 pencil or pen
  • 1 pair of scissors

Step 1: Remove Key

The first step is to remove the key you want to repurpose. This is easiest if you are using a mechanical keyboard. This is not necessary, but makes future steps easier. I am going to use the print screen key.

Step 2: Make the Label

The next step is to make a label for the key. This can be done with a computer, but I prefer to use a sticky note. Cut a piece of the sticky part of the sticky note to be the size of your key. Then, put the sticky note piece on the key. Next, draw an icon on the key. I drew a robot. Finally, put the key back on the keyboard.

Step 3: Install AutoKey

AutoKey is the hotkey management system that you will use to make the key actually do something. If you are using Debian/Ubuntu, you can install it with a PPA. Otherwise, you can build it from source. Here's how to install it with the PPA (from here):

Open a terminal and type:

sudo add-apt-repository ppa:cdekter/ppa
sudo apt-get update

For Gnome users:

sudo apt-get install autokey-gtk

For KDE users:

sudo apt-get install autokey-qt

AutoKey should be installed.

Step 4: Configure Your Key

Now, you need to configure your key. Open AutoKey, click on "My Phrases" on the left panel, click on New, and then click on Script. Enter a name for it. Now it is time to code the key.

If you are good with Python, the language AutoKey uses, then you can do much more advanced things with your key, but if you are not, then here is some basic code to launch the Instructables homepage in Firefox:

import os
os.system("firefox https://www.instructables.com")

If you are using Chrome, change "firefox" to "google-chrome". For Chromium users, replace "firefox" with "chromium-browser".

Finally, you need to bind the key to the script. Click the "set" button that is on the same line as "Hotkey: (None configured)". Then, click "Press to Set" and press your key. Click OK.

Click save and close AutoKey. Now try pressing your key. It should open the Instructables web site!

If you would like to learn more about Python, I recommend "Automate the Boring Stuff with Python" by Al Sweigart. It is a free online tutorial.

Unusual Uses Challenge 2017

Participated in the
Unusual Uses Challenge 2017