Thursday, May 16, 2024
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 604  / 1 Year ago, sun, february 5, 2023, 1:46:26

I recently installed a Japanese layout keyboard on a Lenovo X220 laptop. Using the terminal, and xmonad as a window manager, I first did:



$ sudo dpkg-reconfigure keyboard-configuration



Where I selected the Sun 7 Japanese 106 key keyboard, using the Japanese OADG-109A layout, as it
matches the layout of the keys on the board I installed.



I rebooted the computer, and the layout was correct, however I had difficulty switching modes. After trying all of the other layout options, I came back to the OADG-109A layout, and made direct modifications to the /usr/share/X11/xkb/symbols/jp file; I added the hiragana unicode numbers for the third block within that file, so that I could press the right alt key and produce the hiragana that were printed on the keys.



This approach was successful using 18.04.



Since then, I have upgraded to 20.04, and now my layout is working generally, for inputting the encryption password at boot, and after logging in, but curiously not at the login prompt.



The changes I made to /usr/share/X11/xkb/symbols/jp did not persist after the upgrade. So, I entered them again. This time, however, having changed the file has had no effect.



I tried changing the keyboard layout after logging into gnome, and was able to successfully produce hiragana with the MOZC, or was it MOCZ, layout, however, I prefer to have the right alt + key functionality working.



Currently, the contents of /etc/default/keyboard are :

XKBLAYOUT="jp"
BACKSPACE="guess"
XKBVARIANT="OADG109A"
XKBMODEL="sun_type7_jp_usb"
XKBOPTIONS="compose:menu,terminate:ctrl_alt_bksp"



Where, as you can see, I have selected most previously to use the default Altgr for the keyboard. Changing this to the right alt key has had no effect, positive or negative.



Just in case it is relevant, here are the contents of the 'jp' symbols file that I have edited. You can see the various U### I have input toward the top of the file:
(again @ /usr/share/X11/xkb/symbols/jp)



// Symbols for Japanese 106-keys keyboards (by [email protected]).



default partial alphanumeric_keys
xkb_symbols "106" {



include "jp(common)"
name[Group1]= "Japanese";

key <AE10> { [ 0, asciitilde, U308F, U3092 ] };
key <AE13> { [ backslash, bar ] };


};



hidden partial alphanumeric_keys
xkb_symbols "common" {
// "Common" keys for jp 106/109A layouts.



key <HZTG> {
type[Group1]="PC_ALT_LEVEL2",
symbols[Group1]= [ Zenkaku_Hankaku, Kanji ]
};

key <AE01> { [ 1, exclam, U306C ] };
key <AE02> { [ 2, quotedbl, U3075 ] };
key <AE03> { [ 3, numbersign, U3042, U3041 ] };
key <AE04> { [ 4, dollar, U3046, U3045 ] };
key <AE05> { [ 5, percent, U3048, U3047 ] };
key <AE06> { [ 6, ampersand, U304A, U3049 ] };
key <AE07> { [ 7, apostrophe, U3084, U3083 ] };
key <AE08> { [ 8, parenleft, U3086, U3085 ] };
key <AE09> { [ 9, parenright, U3088, U3087 ] };
key <AE11> { [ minus, equal, U307B ] };
key <AE12> { [ asciicircum, asciitilde, U3078] };

key <AD01> { [ q, Q, U305F ] };
key <AD02> { [ w, W, U3066 ] };
key <AD03> { [ e, E, U3044, U3043 ] };
key <AD04> { [ r, R, U3059 ] };
key <AD05> { [ t, T, U3095 ] };
key <AD06> { [ y, Y, U3093 ] };
key <AD07> { [ u, U, U306A ] };
key <AD08> { [ i, I, U306B ] };
key <AD09> { [ o, O, U3089 ] };
key <AD10> { [ p, P, U305B ] };
key <AD11> { [ at, grave, U3099 ] };
key <AD12> { [ bracketleft, braceleft, U309A ] };

key <CAPS> { [ Eisu_toggle, Caps_Lock ] };

key <AC01> { [ a, A, U3061 ] };
key <AC02> { [ s, S, U3068 ] };
key <AC03> { [ d, D, U3057 ] };
key <AC04> { [ f, F, U306F ] };
key <AC05> { [ g, G, U304D ] };
key <AC06> { [ h, H, U304F ] };
key <AC07> { [ j, J, U307E ] };
key <AC08> { [ k, K, U306E ] };
key <AC09> { [ l, L, U308A ] };
key <AC10> { [ semicolon, plus, U308C ] };
key <AC11> { [ colon, asterisk, U3096 ] };
key <AC12> { [ bracketright, braceright, U3080 ] };

key <AB01> { [ z, Z, U3064 ] };
key <AB02> { [ x, X, U3063 ] };
key <AB03> { [ c, C, U305D ] };
key <AB04> { [ v, V, U3072 ] };
key <AB05> { [ b, B, U3053 ] };
key <AB06> { [ n, N, U307F ] };
key <AB07> { [ m, M, U3082 ] };
key <AB08> { [ comma, less, U306D ] };
key <AB09> { [ period, greater, U308B ] };
key <AB10> { [ slash, question, U3081 ] };
key <AB11> { [ backslash, underscore, U308D] };
key <LCTL> { [ Control_L, ] };

key <NFER> { [ Muhenkan ] };

key <XFER> {
type[Group1]="PC_ALT_LEVEL2",
symbols[Group1]= [ Henkan, Mode_switch ]
};

key <HKTG> {
type[Group1]="PC_ALT_LEVEL2",
symbols[Group1]= [ Hiragana_Katakana, Romaji ]
};

key <EISU> {
type[Group1]="PC_ALT_LEVEL2",
symbols[Group1]= [ Eisu_toggle ]
};

key <KANA> {
type[Group1]="PC_ALT_LEVEL2",
symbols[Group1]= [ Hiragana_Katakana ]
};

key <PRSC> {
type[Group1]= "PC_ALT_LEVEL2",
symbols[Group1]= [ Print, Execute ]
};


};



partial alphanumeric_keys
xkb_symbols "henkan" {
key {
type[Group1]="PC_ALT_LEVEL2",
symbols[Group1]= [ Henkan, Mode_switch ]
};
};



partial alphanumeric_keys
xkb_symbols "OADG109A" {



include "jp(common)"
name[Group1]= "Japanese (OADG 109A)";

key <AE10> { [ 0 ] };
key <AE13> { [ yen, bar ] };


};



// 86 keys with kana map
partial alphanumeric_keys
xkb_symbols "kana86" {



include "srvr_ctrl(fkey2vt)"
include "pc(editing)"
include "keypad(numoperdecsep)"
include "altwin(menu)"
include "jp(kana)"
include "jp(OADG109A)"
name[Group1]= "Japanese (Kana 86)";

key <ESC> { [ Escape ] };
key <NMLK> { [ Num_Lock ] };
key <BKSP> { [ BackSpace ] };
key <TAB> { [ Tab, ISO_Left_Tab ] };
key <RTRN> { [ Return ] };
key <LFSH> { [ Shift_L ] };
key <RTSH> { [ Shift_R ] };
key <LWIN> { [ Super_L ] };
key <LALT> { [ Alt_L ] };
key <SPCE> { [ space ] };
key <RALT> { [ Alt_R ] };
// For compatibility with other keyboards connected at the same time:
key <RWIN> { [ Super_R ] };
key <RCTL> { [ Control_R ] };


};



partial alphanumeric_keys
xkb_symbols "kana" {



name[Group1]= "Japanese (Kana)";

key <HZTG> {
type[Group1]="PC_ALT_LEVEL2",
symbols[Group1]= [ Zenkaku_Hankaku, Kanji ]
};

key <AE01> { [ kana_NU ] };
key <AE02> { [ kana_FU ] };
key <AE03> { [ kana_A, kana_a ] };
key <AE04> { [ kana_U, kana_u ] };
key <AE05> { [ kana_E, kana_e ] };
key <AE06> { [ kana_O, kana_o ] };
key <AE07> { [ kana_YA, kana_ya ] };
key <AE08> { [ kana_YU, kana_yu ] };
key <AE09> { [ kana_YO, kana_yo ] };
key <AE10> { [ kana_WA, kana_WO ] };
key <AE11> { [ kana_HO ] };
key <AE12> { [ kana_HE ] };
key <AE13> { [ prolongedsound ] };

key <AD01> { [ kana_TA ] };
key <AD02> { [ kana_TE ] };
key <AD03> { [ kana_I, kana_i ] };
key <AD04> { [ kana_SU ] };
key <AD05> { [ kana_KA ] };
key <AD06> { [ kana_N ] };
key <AD07> { [ kana_NA ] };
key <AD08> { [ kana_NI ] };
key <AD09> { [ kana_RA ] };
key <AD10> { [ kana_SE ] };
key <AD11> { [ voicedsound ] };
key <AD12> { [ semivoicedsound, kana_openingbracket ] };

key <CAPS> { [ Eisu_toggle, Caps_Lock ] };
key <AC01> { [ kana_CHI ] };
key <AC02> { [ kana_TO ] };
key <AC03> { [ kana_SHI ] };
key <AC04> { [ kana_HA ] };
key <AC05> { [ kana_KI ] };
key <AC06> { [ kana_KU ] };
key <AC07> { [ kana_MA ] };
key <AC08> { [ kana_NO ] };
key <AC09> { [ kana_RI ] };
key <AC10> { [ kana_RE ] };
key <AC11> { [ kana_KE ] };
key <AC12> { [ kana_MU, kana_closingbracket ] };

key <AB01> { [ kana_TSU, kana_tsu ] };
key <AB02> { [ kana_SA ] };
key <AB03> { [ kana_SO ] };
key <AB04> { [ kana_HI ] };
key <AB05> { [ kana_KO ] };
key <AB06> { [ kana_MI ] };
key <AB07> { [ kana_MO ] };
key <AB08> { [ kana_NE, kana_comma ] };
key <AB09> { [ kana_RU, kana_fullstop ] };
key <AB10> { [ kana_ME, kana_middledot ] };
key <AB11> { [ kana_RO ] };
key <LCTL> { [ Control_L ] };

key <NFER> { [ Muhenkan ] };

key <XFER> {
type[Group1]="PC_ALT_LEVEL2",
symbols[Group1]= [ Henkan, Mode_switch ]
};
key <HKTG> {
type[Group1]="PC_ALT_LEVEL2",
symbols[Group1]= [ Hiragana_Katakana, Romaji ]
};

key <PRSC> {
type[Group1]= "PC_ALT_LEVEL2",
symbols[Group1]= [ Print, Execute ]
};


};



partial alphanumeric_keys
xkb_symbols "nicola_f_bs" {
key {
type="",
symbols[Group1]= [ bracketright, braceright ]
};
key { [ 0, underscore ] };
key { [ colon, asterisk ] };
key { [ BackSpace, BackSpace ] };
key { [ Escape ] };
key { [ at, grave ] };
};



// Copied from macintosh_vndr/jp
partial alphanumeric_keys
xkb_symbols "mac" {
include "jp(kana)"
name[Group1]= "Japanese (Macintosh)";



replace key <CAPS> { [ Caps_Lock ] };


};



partial alphanumeric_keys
xkb_symbols "hztg_escape" {
replace key { [ Escape ] };
};



partial alphanumeric_keys
xkb_symbols "dvorak" {
include "jp(OADG109A)"
name[Group1]= "Japanese (Dvorak)";



key <AE11> { [ at, grave        ] };

key <AD01> { [ colon, asterisk ] };
key <AD02> { [ comma, less ] };
key <AD03> { [ period, greater ] };
key <AD04> { [ p, P ] };
key <AD05> { [ y, Y ] };
key <AD06> { [ f, F ] };
key <AD07> { [ g, G ] };
key <AD08> { [ c, C ] };
key <AD09> { [ r, R ] };
key <AD10> { [ l, L ] };
key <AD11> { [ slash, question ] };

key <AC02> { [ o, O ] };
key <AC03> { [ e, E ] };
key <AC04> { [ u, U ] };
key <AC05> { [ i, I ] };
key <AC06> { [ d, D ] };
key <AC07> { [ h, H ] };
key <AC08> { [ t, T ] };
key <AC09> { [ n, N ] };
key <AC10> { [ s, S ] };
key <AC11> { [ minus, equal ] };

key <AB01> { [ semicolon, plus ] };
key <AB02> { [ q, Q ] };
key <AB03> { [ j, J ] };
key <AB04> { [ k, K ] };
key <AB05> { [ x, X ] };
key <AB06> { [ b, B ] };
key <AB08> { [ w, W ] };
key <AB09> { [ v, V ] };
key <AB10> { [ z, Z ] };


};



// EXTRAS:



partial alphanumeric_keys
xkb_symbols "sun_type6_suncompat" {
include "sun_vndr/jp(sun_type6_suncompat)"
};



partial alphanumeric_keys
xkb_symbols "sun_type6" {
include "sun_vndr/jp(sun_type6)"
};



partial alphanumeric_keys
xkb_symbols "sun_type7_suncompat" {
include "sun_vndr/jp(sun_type7_suncompat)"
};



partial alphanumeric_keys
xkb_symbols "suncompat" {
include "sun_vndr/jp(suncompat)"
};



partial alphanumeric_keys
xkb_symbols "sun_type7" {
include "sun_vndr/jp(sun_type7)"
};



I have tried to no avail to make functional the right-alt key for the purposes of producing hiragana, but now that I'm running 20.04, the previously successful method just isn't working.



I never could get the other mode changing keys to work, by the way, but for the time being I'm perplexed at how changing the appropriate symbols file seems to have no effect. Those are , spacings in the 'jp' file, in case that's relevant. Possibly there has been a format requirement change?....



If anyone out there has any experience with this kind of bug, any help or pointer would be greatly appreciated.



Thank You.


More From » keyboard-layout

 Answers
1

UPDATE SOLUTION



Ok, it turns out there were some compatibility issues with the mode switching keys, and so switching between hiragana and katakana was not as easy as it would have been with native support for those keys, at least the way the layout files were written.



There is a definite logic to the way that keys are numbered, but I couldn't figure out why setting values for hiragana-katakana, henkan, and muhenkan keys wouldn't work.



Eventually, I settled on using the sun6 japanese keyboard, even though my keyboard is clearly not a sun, and selecting the :kana: option during layout configuration. This gave me the ability to switch modes using the capslock and altgr keys.



After that, I was able to add :kana_##: lines to the sun vendor english mode for the kana board, within the sun vendor's layout file, and substitute hiragana unicode values for the places where kana originally was written in. Without the ability to switch between katakana and hiragana, kana defaults to katakana for whatever reason.



Now, if I hit capslock, I have full hiragana support: ぬふあうえ
If instead I press altgr, I have full katakana support: ヌフアウエ



That vendor file, located at /usr/share/X11/xkb/symbols/sun_vndr/jp, now looks like:



//
// Copyright (c) 2010, 2012, Oracle and/or its affiliates. All righ
ts reserved.

//
// Permission is hereby granted, free of charge, to any person obta
ining a

// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, includ
ing

// without limitation the rights to use, copy, modify, merge, publi
sh,

// distribute, and/or sell copies of the Software, and to permit pe
rsons

// to whom the Software is furnished to do so, provided that the ab
ove

// copyright notice(s) and this permission notice appear in all cop
ies of

// the Software and that both the above copyright notice(s) and thi
s

// permission notice appear in supporting documentation.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS

// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRING
EMENT

// OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
// HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
SPECIAL

// INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RES
ULTING

// FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTR
ACT,

// NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNEC
TION

// WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
// Except as contained in this notice, the name of a copyright hold
er

// shall not be used in advertising or otherwise to promote the sal
e, use

// or other dealings in this Software without prior written authori
zation

// of the copyright holder.
//



partial default alphanumeric_keys modifier_keys
xkb_symbols "sun_type6_suncompat" {



    include "inet(evdev)"
include "sun_vndr/us(sunbasic)"

key <AE13> { [ yen, bar ], [ prolongedsound ] }


;

key { [ 1, exclam, kana_NU ], [ U306C ] }
;

key { [ 2, quotedbl, kana_FU ], [ U3075 ] }
;

key { [ 3, numbersign, kana_A ], [ U3042, U3041 ] };
key { [ 4, dollar, kana_U ], [ U3046, U3045 ] };
key { [ 5, percent, kana_E ], [ U3048, U3047 ] };
key { [ 6, ampersand, kana_O ], [ U304A, U3049 ]
};

key { [ 7, apostrophe, kana_YA ], [ U3084, U3083 ]

};

key { [ 8, parenleft, kana_YU ], [ U3086, U3085

] };

key { [ 9, parenright, kana_YO ], [ U3088, U3087 ]

};

key { [ 0, kana_WA , kana_WO ], [ U308F, U30
92 ] };

key { [ minus, equal, kana_HO ], [ U307B ]
};

key { [ asciicircum, asciitilde, kana_HE], [ U3078

] };

//key { [ yen, bar ] };



key <AD01> { [ q, Q, kana_TA          ], [ U305F        ]   };
key <AD02> { [ w, W, kana_TE ], [ U3066 ] };
key <AD03> { [ e, E, kana_I ], [ U3044, U3043 ] };
key <AD04> { [ r, R, kana_SU ], [ U3059 ] };
key <AD05> { [ t, T, kana_KA ], [ U3095 ] };
key <AD06> { [ y, Y, kana_N ], [ U3093 ] };
key <AD07> { [ u, U, kana_NA ], [ U306A ] };
key <AD08> { [ i, I, kana_NI ], [ U306B ] };
key <AD09> { [ o, O, kana_RA ], [ U3089 ] };
key <AD10> { [ p, P, kana_SE ], [ U305B ] };
key <AD11> { [ at, grave, voicedsound ], [ U3099 ] }


;

key { [ bracketleft, braceleft, semivoicedsound ], [
U309A ] };



key <AC01> { [ a, A, kana_CHI         ], [ U3061       ]   };
key <AC02> { [ s, S, kana_TO ], [ U3068 ] };
key <AC03> { [ d, D, kana_SHI ], [ U3057 ] };
key <AC04> { [ f, F, kana_HA ], [ U306F ] };
key <AC05> { [ g, G, kana_KI ], [ U304D ] };
key <AC06> { [ h, H, kana_KU ], [ U304F ] };
key <AC07> { [ j, J, kana_MA ], [ U307E ] };
key <AC08> { [ k, K, kana_NO ], [ U306E ] };
key <AC09> { [ l, L, kana_RI ], [ U308A ] };
key <AC10> { [ semicolon, plus, kana_RE ], [ U308C ] }


;

key { [ colon, asterisk, kana_KE ], [ U3096 ] }
;

key { [ bracketright, braceright, kana_MU ], [ U3080 ] }
;



key <AB01> { [ z, Z, kana_TSU            ], [ U3064, U3063 ]   


};

key { [ x, X, kana_SA ], [ U3055 ] }
;

key { [ c, C, kana_SO ], [ U305D ] }
;

key { [ v, V, kana_HI ], [ U3072 ] }
;

key { [ b, B, kana_KO ], [ U3053 ] }
;

key { [ n, N, kana_MI ], [ U307F ] }
;

key { [ m, M, kana_MO ], [ U3082 ] }
;

key { [ comma, less, kana_NE ], [ U306D ] };
key { [ period, greater, kana_RU ], [ U308B ] };
key { [ slash, question, kana_ME ], [ U3081 ]};
key { [ backslash, underscore, kana_RO ], [ U308D

] };

//key { [ backslash, underscore], [ kana_RO ] };



key <EXEC> { [ Execute                          ]   };
key <KANJ> { [ Kanji ] };
key <HENK> { [ Henkan_Mode ] };
key <ALGR> { [ Kana_Lock, Mode_switch ] };


key <COMP> { [ Multi_key ] }


;

key { [ SunSys_Req ] }
;



    modifier_map Mod3 { Kana_Lock };


};



partial alphanumeric_keys
xkb_symbols "sun_type6" {



// include "jp"
// type6 based on "jp" should be provided later

include "sun_vndr/jp(sun_type6_suncompat)"


};



partial alphanumeric_keys
xkb_symbols "sun_type7_suncompat" {



include "sun_vndr/jp(sun_type6_suncompat)"

key <AE10> { [ 0, asciitilde, kana_WA, kana_WO ] };
key <TLDE> { [ Henkan_Mode ] };
key <HENK> { [ Kana_Lock, Mode_switch ] };
key <ALGR> { [ Alt_R, Alt_R ] };


};



partial alphanumeric_keys
xkb_symbols "suncompat" {



include "sun_vndr/jp(sun_type7_suncompat)"


};



partial alphanumeric_keys
xkb_symbols "sun_type7" {



include "jp"


};



partial alphanumeric_keys
xkb_symbols "106" {
include "jp(106)"
};



partial alphanumeric_keys
xkb_symbols "common" {
include "jp(common)"
};



partial alphanumeric_keys
xkb_symbols "OADG109A" {
include "jp(OADG109A)"
};



partial alphanumeric_keys
xkb_symbols "kana86" {
include "jp(kana86)"
};



partial alphanumeric_keys
xkb_symbols "kana" {
include "jp(kana)"
};



partial alphanumeric_keys
xkb_symbols "nicola_f_bs" {
include "jp(nicola_f_bs)"
};



partial alphanumeric_keys
xkb_symbols "mac" {
include "jp(mac)"
};



partial alphanumeric_keys
xkb_symbols "hztg_escape" {
include "jp(hztg_escape)"
};



partial alphanumeric_keys
xkb_symbols "dvorak" {
include "jp(dvorak)"
};



At this point I would like to thank everyone who made helpful suggestions.
Thank You!


[#3447] Monday, February 6, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
enytidge

Total Points: 169
Total Questions: 105
Total Answers: 107

Location: Papua New Guinea
Member since Tue, Aug 24, 2021
3 Years ago
enytidge questions
Tue, Feb 28, 23, 15:26, 1 Year ago
Sun, Jan 1, 23, 19:36, 1 Year ago
Sun, Oct 24, 21, 07:30, 3 Years ago
Wed, Nov 9, 22, 22:02, 2 Years ago
;