I then created autokey scripts for my various hotkeys, such as Alt-Shift-A which uses the following code to produce capital-A-with-macron (Ā):
The good thing about this method is that it passes the Unicode character through the clipboard, instead of relying on Ctrl-Shift-U, which doesn't always work.
Code: Select all
import sys reload(sys) sys.setdefaultencoding('utf8') from subprocess import Popen, PIPE def paste_character(symbol): c = Popen(['xclip', '-selection', 'clipboard'], stdin=PIPE) c.communicate(symbol.encode('utf-8')) keyboard.send_keys('<ctrl>+v') #from MyCopy import paste_character paste_character('Ā')
NB: This doesn't work immediately in a terminal. After entering the hotkey, press Ctrl-Shift-v, and the unicode character appears.