python helper script to convert hangul keyboard mapping for any keyboard.
Because libhangul uses mapping xml for Korean Input, it allows you to modify its mapping xml for any physical keyboard layout.
On Mac, 구름 입력기 uses libhangul, so the same approach can be applied.
- Input Method with libhangul
- uv (recommended) or python3
- update config.yaml as needed
name: colemak-dh:crkbd:thunderbird2086 conversions: - targets: - hangul-keyboard-2.xml - hangul-keyboard-2-full.xml mapping: e: f r: p t: b s: r d: s
nameis a reference and inserted into xml mapping<?xml version='1.0' encoding='utf-8'?> <hangul-keyboard id="2" type="jamo" converted="colemak-dh:crkbd:thunderbird2086">
targetshas mappig file names to be modified. In case 구름 입력기 is installed on a Mac, it can be found under/Library/Input Methods/Gureum.app/Contents/Frameworks/Hangul.framework/Versions/A/Resources/keyboards.
mappigcontains key mapping. For instance,e: fchanges keyetof. Refer to the image below. - run
convert.py. The default input path is ./original and it contains the 두벌식 xml files.$ python3 convert.py --help usage: Keyboard mapping convertor for libhangul [-h] [--config CONFIG] --in_path IN_PATH [--out_path OUT_PATH] optional arguments: -h, --help show this help message and exit --config CONFIG, -c CONFIG mapping confiiguration --in_path IN_PATH, -i IN_PATH path for input files. Default is ./original --out_path OUT_PATH, -o OUT_PATH path for output files. Default is ./converted
- copy the output file to the input method's directory. With 구름 입력기 installed on a Mac, it can be found under
/Library/Input Methods/Gureum.app/Contents/Frameworks/Hangul.framework/Versions/A/Resources/keyboards.- You must overwrite the original files. If you rename the original files and keep their locations to backup them, 구름 입력기 uses the renamed original files.
./originaldirectory contains the backup of the original files, so you can use them to revert the changes.
- Restart the input method to apply the new mapping. On Mac, Activity Monitor can be used to restart the input method.
- For 2-3 steps,
apply_to_gureum.sh <CONFIG_FILE.yaml>can be used instead.
config.yaml- 키보드 펌웨어가 Colemak-DH일 때 두벌식 사용
- QWERTY의 ; 자리를 ㅔ로 사용하게 되어있음
exchange_ㅔ_;.yaml- 키보드 펌웨어는 QWERTY이고 구름 입력기에서 로마자로 Colemak을 사용할 때, 두벌식에서만 ㅔ와 ;를 바꾸고 싶을 때 사용