Skip to content

Instantly share code, notes, and snippets.

@socheatsok78
Last active May 22, 2017 02:25
Show Gist options
  • Save socheatsok78/81f43ddd5f38e3cf541e to your computer and use it in GitHub Desktop.
Save socheatsok78/81f43ddd5f38e3cf541e to your computer and use it in GitHub Desktop.
Khmer Unicode Keyboard Layout for External/Physical Keyboard for Android devices, we've made the keyboard working with standard NiDA keyboard layout. But we still have problem on combining two unicode character key like "ុ" and "ំ" together in order to get "កុំ​" like word.

Khmer Unicode for External Keyboard

Open Institute

Khmer Unicode Keyboard Layout for External/Physical Keyboard for Android devices, we've made the keyboard working with standard NiDA keyboard layout. But we still have problem on combining two unicode character key like "ុ" and "ំ" together in order to get "កុំ​" like word.

Template

Unicode Character

Zero Width Space U+200B

  • use U+200B as Zero Width Space
package kh.org.open.physicalkeyboard;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class InputDeviceReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// Nothing to do at this time.
}
}
# Copyright (C) 2012 The Android Open Source Project
# Copyright (C) Open Institute
#
# http://open.org.kh/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
type OVERLAY
#
# Number Row Character Key
#
key 1 {
label: '1'
base: '\u17e1'
shift: '!'
}
key 2 {
label: '2'
base: '\u17e2'
shift: '\u17d7'
ralt: '@'
}
key 3 {
label: '3'
base: '\u17e3'
shift: '#'
ralt: '\u17d1'
}
key 4 {
label: '4'
base: '\u17e4'
shift: '\u17db'
ralt: '$'
}
key 5 {
label: '5'
base: '\u17e5'
shift: '%'
}
key 6 {
label: '6'
base: '\u17e6'
shift: '\u17cd'
ralt: '^'
}
key 7 {
label: '7'
base: '\u17e7'
shift: '\u17d0'
ralt: '&'
}
key 8 {
label: '8'
base: '\u17e8'
shift: '\u17cf'
ralt: '*'
}
key 9 {
label: '9'
base: '\u17e9'
shift: '('
ralt: '{'
}
key 0 {
label: '0'
base: '\u17e0'
shift: ')'
ralt: '}'
}
#
# Default QWERTY A-Z Character Key
#
key A {
label: 'A'
base: '\u17b6'
}
key B {
label: 'B'
base: '\u1794'
shift: '\u1796'
}
key C {
label: 'C'
base: '\u1785'
shift: '\u1787'
}
key D {
label: 'D'
base: '\u178a'
shift: '\u178c'
}
key E {
label: 'E'
base: '\u17c1'
shift: '\u17c2'
ralt: '\u17af'
}
key F {
label: 'F'
base: '\u1790'
shift: '\u1792'
}
key G {
label: 'G'
base: '\u1784'
shift: '\u17a3'
}
key H {
label: 'H'
base: '\u17a0'
shift: '\u17c7'
}
key I {
label: 'I'
base: '\u17b7'
shift: '\u17b8'
ralt: '\u17a6'
}
key J {
label: 'J'
base: '\u17d2'
shift: '\u1789'
}
key K {
label: 'K'
base: '\u1780'
shift: '\u1782'
}
key L {
label: 'L'
base: '\u179b'
shift: '\u17a1'
}
key M {
label: 'M'
base: '\u1798'
shift: '\u17c6'
}
key N {
label: 'N'
base: '\u1793'
shift: '\u178e'
}
key O {
label: 'O'
base: '\u17c4'
shift: '\u17c5'
ralt: '\u17b1'
}
key P {
label: 'P'
base: '\u1795'
shift: '\u1797'
ralt: '\u17b0'
}
key Q {
label: 'Q'
base: '\u1786'
shift: '\u1788'
}
key R {
label: 'R'
base: '\u179a'
shift: '\u17ac'
ralt: '\u17ab'
}
key S {
label: 'S'
base: '\u179f'
shift: '\u17c3'
}
key T {
label: 'T'
base: '\u178f'
shift: '\u1791'
}
key U {
label: 'U'
base: '\u17bb'
shift: '\u17bc'
}
key V {
label: 'V'
base: '\u179c'
}
key W {
label: 'W'
base: '\u17b9'
shift: '\u17ba'
}
key X {
label: 'X'
base: '\u1781'
shift: '\u1783'
}
key Y {
label: 'Y'
base: '\u1799'
shift: '\u17bd'
}
key Z {
label: 'Z'
base: '\u178b'
shift: '\u178d'
}
#
# Special Character Key
#
# Within Number Row Key
key MINUS {
label: '-'
base: '\u17a5'
shift: '\u17cc'
}
key EQUALS {
label: '='
base: '\u17b2'
shift: '='
ralt: '\u17ce'
}
key BACKSLASH {
label: '\\'
base: '\u17ae'
shift: '\u17ad'
ralt: '\\'
}
# Within QWERTY Key
key LEFT_BRACKET {
label: '['
base: '\u17c0'
shift: '\u17bf'
ralt: '\u17a9'
}
key RIGHT_BRACKET {
label: ']'
base: '\u17aa'
shift: '\u17a7'
ralt: '\u17b3'
}
key SEMICOLON {
label: ';'
base: '\u17be'
}
key APOSTROPHE {
label: '\''
base: '\u17cb'
shift: '\u17c9'
ralt: '\u17c8'
}
key COMMA {
label: ','
base: ','
shift: '<'
ralt: ','
}
key PERIOD {
label: '.'
base: '\u17d4'
shift: '\u17d5'
ralt: '.'
}
key SLASH {
label: '/'
base: '\u17ca'
shift: '?'
ralt: '/'
alt, meta: fallback SEARCH
ctrl: fallback LANGUAGE_SWITCH
}
key SPACE {
label: ' '
base: '\u200b'
shift: ' '
}
### Non-printing keys
key ESCAPE {
base: fallback BACK
alt, meta: fallback HOME
ctrl: fallback MENU
}
//
// khmer unicode keyboard for XFree86 4.3 or XOrg
// (might work with older versions, not tested)
//
// layout defined by National Information Communications Technology Development Authority (NiDA)
// http://www.nida.gov.kh
//
// version: 1.0.1
//
// date: 14.09.2005
//
// author: Jens Herden (jens at khmeros.info)
//
//
// understanding the symbols:
//
// 0x100yyyy = unicode, yyyy is hexcode
// codes that are not assigned in unicode (0x10017fb-0x10017ff),
// are used to make compositions for special vowels
//
// voidsymbol = no symbol for this combination
//
// all other symbol are defined in: /usr/X11/include/X11/keysymdef.h
// but with a leading 'XK_'
//
default partial alphanumeric_keys
xkb_symbols "basic" {
name[Group1]= "Khmer (Cambodia)";
// there are four levels defined:
//
// normal shift right-alt right-alt + shift
//
// keys: `1234567890-=\
key <TLDE> { [ guillemotleft, guillemotright, 0x100200d, voidsymbol ] };
key <AE01> { [ 0x10017e1, exclam, 0x100200c, 0x10017f1 ] };
key <AE02> { [ 0x10017e2, 0x10017d7, at, 0x10017f2 ] };
key <AE03> { [ 0x10017e3, quotedbl, 0x10017d1, 0x10017f3 ] };
key <AE04> { [ 0x10017e4, 0x10017db, dollar, 0x10017f4 ] };
key <AE05> { [ 0x10017e5, percent, EuroSign, 0x10017f5 ] };
key <AE06> { [ 0x10017e6, 0x10017cd, 0x10017d9, 0x10017f6 ] };
key <AE07> { [ 0x10017e7, 0x10017d0, 0x10017da, 0x10017f7 ] };
key <AE08> { [ 0x10017e8, 0x10017cf, asterisk, 0x10017f8 ] };
key <AE09> { [ 0x10017e9, parenleft, braceleft, 0x10017f9 ] };
key <AE10> { [ 0x10017e0, parenright, braceright, 0x10017f0 ] };
key <AE11> { [ 0x10017a5, 0x10017cc, x, voidsymbol ] };
key <AE12> { [ 0x10017b2, equal, 0x10017ce, voidsymbol ] };
key <BKSL> { [ 0x10017ae, 0x10017ad, backslash, voidsymbol ] };
// keys: qwertyuiop[]
key <AD01> { [ 0x1001786, 0x1001788, 0x10017dc, 0x10019e0 ] };
key <AD02> { [ 0x10017b9, 0x10017ba, 0x10017dd, 0x10019e1 ] };
key <AD03> { [ 0x10017c1, 0x10017c2, 0x10017af, 0x10019e2 ] };
key <AD04> { [ 0x100179a, 0x10017ac, 0x10017ab, 0x10019e3 ] };
key <AD05> { [ 0x100178f, 0x1001791, 0x10017a8, 0x10019e4 ] };
key <AD06> { [ 0x1001799, 0x10017bd, voidsymbol, 0x10019e5 ] };
key <AD07> { [ 0x10017bb, 0x10017bc, voidsymbol, 0x10019e6 ] };
key <AD08> { [ 0x10017b7, 0x10017b8, 0x10017a6, 0x10019e7 ] };
key <AD09> { [ 0x10017c4, 0x10017c5, 0x10017b1, 0x10019e8 ] };
key <AD10> { [ 0x1001795, 0x1001797, 0x10017b0, 0x10019e9 ] };
key <AD11> { [ 0x10017c0, 0x10017bf, 0x10017a9, 0x10019ea ] };
key <AD12> { [ 0x10017aa, 0x10017a7, 0x10017b3, 0x10019eb ] };
// keys: asdfghjkl;'
key <AC01> { [ 0x10017b6, 0x10017ff, voidsymbol, 0x10019ec ] };
key <AC02> { [ 0x100179f, 0x10017c3, voidsymbol, 0x10019ed ] };
key <AC03> { [ 0x100178a, 0x100178c, voidsymbol, 0x10019ee ] };
key <AC04> { [ 0x1001790, 0x1001792, voidsymbol, 0x10019ef ] };
key <AC05> { [ 0x1001784, 0x10017a2, voidsymbol, 0x10019f0 ] };
key <AC06> { [ 0x10017a0, 0x10017c7, voidsymbol, 0x10019f1 ] };
key <AC07> { [ 0x10017d2, 0x1001789, voidsymbol, 0x10019f2 ] };
key <AC08> { [ 0x1001780, 0x1001782, 0x100179d, 0x10019f3 ] };
key <AC09> { [ 0x100179b, 0x10017a1, voidsymbol, 0x10019f4 ] };
key <AC10> { [ 0x10017be, 0x10017fe, 0x10017d6, 0x10019f5 ] };
key <AC11> { [ 0x10017cb, 0x10017c9, 0x10017c8, 0x10019f6 ] };
// keys: zxcvbnm,./
key <AB01> { [ 0x100178b, 0x100178d, voidsymbol, 0x10019f7 ] };
key <AB02> { [ 0x1001781, 0x1001783, voidsymbol, 0x10019f8 ] };
key <AB03> { [ 0x1001785, 0x1001787, voidsymbol, 0x10019f9 ] };
key <AB04> { [ 0x100179c, 0x10017fd, voidsymbol, 0x10019fa ] };
key <AB05> { [ 0x1001794, 0x1001796, 0x100179e, 0x10019fb ] };
key <AB06> { [ 0x1001793, 0x100178e, voidsymbol, 0x10019fc ] };
key <AB07> { [ 0x1001798, 0x10017c6, voidsymbol, 0x10019fd ] };
key <AB08> { [ 0x10017fc, 0x10017fb, comma, 0x10019fe ] };
key <AB09> { [ 0x10017d4, 0x10017d5, period, 0x10019ff ] };
key <AB10> { [ 0x10017ca, question, slash, voidsymbol ] };
key <SPCE> { [ 0x100200b, space, 0x10000a0, voidsymbol ] };
key <RALT> { [ Alt_R ] };
// third level with right-Alt
include "level3(ralt_switch)"
};
partial alphanumeric_keys
xkb_symbols "olpc" {
include "kh(basic)"
// Contact Walter@laptop.org
key <AC10> { [ 0x10017be, 0x10017c8, 0x10017d6, 0x10019f5 ] };
key <AE01> { [ 0x10017e1, 0x100200c, exclam, 0x10017f1 ] };
key <AE03> { [ 0x10017e3, 0x10017d1, quotedbl, 0x10017f3 ] };
key <AE05> { [ 0x10017e5, EuroSign, percent, 0x10017f5 ] };
key <AE12> { [ 0x10017b2, 0x10017ce, equal, voidsymbol ] };
//language key
include "group(olpc)"
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment