How do I make a shortcut that types "o" when I I hit Alt+p?

Solution 1:

As long as you are on Xorg, xmodmap should be the appropriate tool. Alternatively, you can bind a command to Alt+p that simulates hitting o using xdotool.

xdotool keyup alt keyup p type o

This first releases the hotkey you are pressing, then types an o.

Linux distributions, including Ubuntu, are moving to Wayland. Both tools do not anymore work on Wayland. The most fundamental way to adapt your keyboard layout, i.e., editing kbe configuration files, will continue to work but this is very complicated.