Posted on October 1, 2018
How to simulate an insert key on a Mac running Linux for Milkytracker
You may have seen my video where I installed Lubuntu 16.04LTS on an iBook G4 from 2005. I got the computer running great and in fact I am creating this post on it right now. One of the programs I like to use to make music is Milkytracker. I also recently posted a video of a song I made on Milkytracker on this very iBook.
However, there was something that will make working with Milkytracker on an old iBook (or even a Macbook) very difficult. That is that Mac keyboards do not have insert keys. The insert key is an essential function in Milkytracker, since it is what adds rows in the pattern editor. Without this function it’s nearly impossible to make anything worthwhile in a tracker.
So what was I to do? Old versions of Milkytracker actually gave you the option to define a way to simulate this key with another key in the settings, but for some reason this feature was removed in recent builds of Milkytracker. On Mac OS, you can easily simulate the insert key with ‘control+return’, but this keyboard shortcut doesn’t work if you’re running Linux on a mac.
However, iBooks have a second ‘enter’ key next to the right ‘apple’ key on the keyboard. I thought surely there was a way to remap that key to the ‘insert’ command. I first searched for key remapping GUIs with really no luck. I googled it for almost a whole day until I found a simple solution. I figured it out by looking at these two posts.
What it boils down to is first you need to figure out what the keycode of the key you want to turn into your new Insert key by using the program, xev. First install xev if you don’t have it, and then run it from the terminal.
See the part that says “keycode 104”? That’s my keycode for the enter key next to the right apple key. Now all I have to do is map the insert command to that keycode. This is very simple, just open terminal and type “xmodmap -e “keycode 104 = Insert Insert” &”. Now open Milkytracker and test it! You could also make this permanent by creating a custom keymap. But I didn’t want to do all that and found an easier way to map the key only when I open Milkytracker. I just wrote a simple bash script to do that for me. First open a text editor (nano, leafpad, or gedit, or whatever you like) and put in the following code:
xmodmap -e “keycode 104 = Insert Insert” &
Now save the file as something like iMilkytracker.sh. After you saved and closed the file make it executable by typing:
sudo chmod +x iMilkytracker.sh
Now you can just open Milkytracker using the command ./iMilkytracker. This will create the new keyboard mapping then open Milkytracker in one move. You are now free to insert rows in Milkytracker!