You are not logged in.
I followed https://wiki.archlinux.org/title/Localization/Japanese and installed IBus and added two keyboard layouts in the IBus Preferences:
German, Swiss - German (Switzerland)
Japanese - Mozc:あ
(When I click on "Japanese - Mozc:あ" and then on "About", it says "Keyboard layout: default".)
I also unchecked "Use system keyboard layout" in IBus Preferences.
When I now type Japanese with Mozc, under the hood it uses the Swiss German layout instead of a true Japanese layout (y/z are the same for my layouts when they're supposed to be flipped). I want to change this because üöä are useless and because some vital keys are inaccessible. Basically, I want it to work like it does on Windows.
I found https://github.com/google/mozc/blob/mas … rations.md and followed the instructions under "Specify the keyboard layout", i.e. I opened ~/.config/mozc/ibus_config.textproto and changed layout : "default" to layout : "ja" (or layout : "jp") for all three engines. (The .md says "ja" but I'm pretty sure it has to be "jp"; doesn't work either way.)
After ibus write-cache; ibus restart, it still didn't not work, i.e. when I switch to Mozc it still uses the Swiss German layout and I can still type üöä.
Apparently, Mozc forwarded everything correctly to ibus:
$ ibus read-config
SCHEMA: org.freedesktop.ibus
SCHEMA: org.freedesktop.ibus.general
enable-by-default: false
xkb-latin-layouts: ['af', 'af(fa-olpc)', 'af(ps-olpc)', 'af(ps)', 'af(uz)', 'af(uz-olpc)', 'am', 'am(eastern)', 'am(eastern-alt)', 'am(phonetic)', 'am(phonetic-alt)', 'am(western)', 'ara', 'ara(azerty)', 'ara(azerty_digits)', 'ara(buckwalter)', 'ara(digits)', 'ara(qwerty)', 'ara(qwerty_digits)', 'az(cyrillic)', 'bd', 'bd(probhat)', 'bg', 'bg(bas_phonetic)', 'bg(phonetic)', 'brai', 'brai(left_hand)', 'brai(right_hand)', 'bt', 'by', 'by(phonetic)', 'by(legacy)', 'ca(ike)', 'cn(tib)', 'cn(tib_asciinum)', 'cn(ug)', 'cz', 'cz(ucw)', 'de(ru)', 'dev', 'et', 'fr(geo)', 'ge', 'ge(os)', 'gr', 'gr(extended)', 'gr(nodeadkeys)', 'gr(polytonic)', 'gr(simple)', 'gur', 'il', 'il(biblical)', 'il(lyx)', 'il(phonetic)', 'id(melayu-phonetic)', 'id(melayu-phoneticx)', 'id(pegon-phonetic)', 'in', 'in(ben)', 'in(ben_baishakhi)', 'in(ben_bornona)', 'in(ben_gitanjali)', 'in(ben_inscript)', 'in(ben_probhat)', 'in(bolnagri)', 'in(deva)', 'in(guj)', 'in(guj-kagapa)', 'in(guru)', 'in(hin-kagapa)', 'in(hin-wx)', 'in(jhelum)', 'in(kan)', 'in(kan-kagapa)', 'in(mal)', 'in(mal_enhanced)', 'in(mal_lalitha)', 'in(mar-kagapa)', 'in(ori)', 'in(san-kagapa)', 'in(tam)', 'in(tamilnet)', 'in(tamilnet_TAB)', 'in(tamilnet_TSCII)', 'in(tamilnet_tamilnumbers)', 'in(tam_tamilnumbers)', 'in(tel)', 'in(tel-kagapa)', 'in(urd-phonetic)', 'in(urd-phonetic3)', 'in(urd-winkeys)', 'iq', 'ir', 'ir(azb)', 'ir(pes_keypad)', 'jp(kana)', 'jp(mac)', 'kg', 'kg(phonetic)', 'kh', 'kz', 'kz(kazrus)', 'kz(ruskaz)', 'la', 'la(stea)', 'lk', 'lk(tam_TAB)', 'lk(tam_unicode)', 'lv(modern-cyr)', 'ma', 'ma(tifinagh)', 'ma(tifinagh-alt)', 'ma(tifinagh-alt-phonetic)', 'ma(tifinagh-extended)', 'ma(tifinagh-extended-phonetic)', 'ma(tifinagh-phonetic)', 'me(cyrillic)', 'me(cyrillicalternatequotes)', 'me(cyrillicyz)', 'mk', 'mk(nodeadkeys)', 'mm', 'mn', 'mv', 'np', 'ph(capewell-dvorak-bay)', 'ph(capewell-qwerf2k6-bay)', 'ph(colemak-bay)', 'ph(dvorak-bay)', 'ph(qwerty-bay)', 'pk', 'pk(ara)', 'pk(snd)', 'pk(urd-crulp)', 'pk(urd-nla)', 'pl(ru_phonetic_dvorak)', 'rs', 'rs(alternatequotes)', 'rs(rue)', 'rs(yz)', 'ru', 'ru(bak)', 'ru(chm)', 'ru(cv)', 'ru(dos)', 'ru(kom)', 'ru(legacy)', 'ru(mac)', 'ru(os_legacy)', 'ru(os_winkeys)', 'ru(phonetic)', 'ru(phonetic_winkeys)', 'ru(sah)', 'ru(srp)', 'ru(tt)', 'ru(typewriter)', 'ru(typewriter-legacy)', 'ru(udm)', 'ru(xal)', 'se(rus)', 'se(swl)', 'sy', 'sy(syc)', 'sy(syc_phonetic)', 'th', 'th(pat)', 'th(tis)', 'tj', 'tj(legacy)', 'tz', 'ua', 'ua(homophonic)', 'ua(legacy)', 'ua(phonetic)', 'ua(typewriter)', 'ua(winkeys)', 'us(chr)', 'us(rus)', 'uz']
use-xmodmap: true
preload-engines: ['xkb:ch::gsw', 'mozc-on']
dconf-preserve-name-prefixes: ['/desktop/ibus/engine/pinyin', '/desktop/ibus/engine/bopomofo', '/desktop/ibus/engine/hangul']
use-global-engine: true
engines-order: ['xkb:ch::gsw', 'mozc-on']
embed-preedit-text: true
switcher-delay-time: 400
use-system-keyboard-layout: false
version: '1.5.30'
SCHEMA: org.freedesktop.ibus.general.hotkey
previous-engine: @as []
enable-unconditional: @as []
disable-unconditional: @as []
next-engine: ['Alt+Shift_L']
trigger: ['Control+space', 'Zenkaku_Hankaku', 'Alt+Kanji', 'Alt+grave', 'Hangul', 'Alt+Release+Alt_R']
next-engine-in-menu: ['Alt+Shift_L']
prev-engine: @as []
triggers: ['<Control>space']
SCHEMA: org.freedesktop.ibus.panel
show-im-name: false
custom-font: 'Sans 10'
custom-icon: 'Adwaita'
show: 0
auto-hide-timeout: 10000
custom-theme: 'Adwaita'
x: -1
use-custom-theme: false
property-icon-delay-time: 500
lookup-table-orientation: 1
use-custom-font: false
follow-input-cursor-when-always-shown: false
use-custom-icon: false
y: -1
show-icon-on-systray: true
use-glyph-from-engine-lang: true
xkb-icon-rgba: '#51a2da'
SCHEMA: org.freedesktop.ibus.panel.emoji
has-partial-match: false
favorite-annotations: @as []
load-unicode-at-startup: false
partial-match-length: 3
favorites: ['?️']
hotkey: ['<Super>period', '<Super>semicolon']
lang: 'en'
font: 'Monospace 16'
load-emoji-at-startup: true
unicode-hotkey: ['<Control><Shift>u']
partial-match-condition: 0
and
$ ibus read-cache
//snip
<component>
<name>com.google.IBus.Mozc</name>
<description>Mozc Component</description>
<version>0.0.0.0</version>
<license>New BSD</license>
<author>Google Inc.</author>
<homepage>https://github.com/google/mozc</homepage>
<exec>/usr/lib/ibus-mozc/ibus-engine-mozc --ibus</exec>
<textdomain>ibus-mozc</textdomain>
<observed-paths>
<path mtime="1729890940" >/usr/share/ibus/component/mozc.xml</path>
</observed-paths>
<engines>
<engine>
<name>mozc-jp</name>
<longname>Mozc</longname>
<description>Mozc (Japanese Input Method)</description>
<language>ja</language>
<license></license>
<author></author>
<icon>/usr/share/ibus-mozc/product_icon.png</icon>
<layout>jp</layout>
<layout_variant></layout_variant>
<layout_option></layout_option>
<hotkeys></hotkeys>
<symbol>あ</symbol>
<setup>/usr/lib/mozc/mozc_tool --mode=config_dialog</setup>
<version></version>
<textdomain></textdomain>
<icon_prop_key>InputMode</icon_prop_key>
<rank>80</rank>
</engine>
<engine>
<name>mozc-on</name>
<longname>Mozc:あ</longname>
<description>Mozc (Japanese Input Method)</description>
<language>ja</language>
<license></license>
<author></author>
<icon>/usr/share/ibus-mozc/product_icon.png</icon>
<layout>jp</layout>
<layout_variant></layout_variant>
<layout_option></layout_option>
<hotkeys></hotkeys>
<symbol>あ</symbol>
<setup>/usr/lib/mozc/mozc_tool --mode=config_dialog</setup>
<version></version>
<textdomain></textdomain>
<icon_prop_key>InputMode</icon_prop_key>
<rank>99</rank>
</engine>
<engine>
<name>mozc-off</name>
<longname>Mozc:A_</longname>
<description>Mozc (Japanese Input Method)</description>
<language>ja</language>
<license></license>
<author></author>
<icon>/usr/share/ibus-mozc/product_icon.png</icon>
<layout>jp</layout>
<layout_variant></layout_variant>
<layout_option></layout_option>
<hotkeys></hotkeys>
<symbol>A</symbol>
<setup>/usr/lib/mozc/mozc_tool --mode=config_dialog</setup>
<version></version>
<textdomain></textdomain>
<icon_prop_key>InputMode</icon_prop_key>
<rank>99</rank>
</engine>
</engines>
</component>
//snip
So the layout was correctly passed on to IBus.
BTW, ibus read-cache | grep jp produces multiple hits in the non-Mozc part for <layout>s which is why I think the .md is incorrect for using "ja".
There was also this small tidbit in the wiki https://wiki.archlinux.org/title/IBus#Ibus_IME_packages_only_input_keyboard's_native_charset: Setting GTK_IM_MODULE=xim.
Unfortunately, this didn't change anything for me either.
Using "us" instead of "jp"/"ja" for layout didn't change anything either.
My localectl is:
$ localectl
System Locale: LANG=en_US.UTF-8
VC Keymap: de_CH-latin1
X11 Layout: ch
X11 Variant: de_nodeadkeys
Packages:
ibus 1.5.30-3
ibus-mozc 2.30.5618.102-1
ibus-mozc-debug 2.30.5618.102-1
libibus 1.5.30-3
mozc-ut 2.30.5618.102.20241010-1
mozc-ut-debug 2.30.5618.102.20241010-1
Offline
What's your testcase and on what desktop environment?
If the answer doesn't involve gnome, have you considered fcitx5?
Do you use ibus for input at all?
Because https://wiki.archlinux.org/title/IBus#Ibus_IME_packages_only_input_keyboard's_native_charset deliberately does NOT use ibus for gtk clients (the reasoning in that paragraph kinda escapes me)
Have you tried adding a second layout "setxkbmap -layout ch,jp" (this will probably not work on wayland)
Online
My testcase is to just open a few programs like xfce4-terminal, mousepad and Firefox and see what pressing different keys (like üöä$) produces with each of the IBus profiles.
I use Xfce4 with Xfwm4 on X11:
xfdesktop 4.18.1-3
xfwm4 4.18.0-3
xorg-server 21.1.13-1
In Xfce's setting dialog "Keyboard", I've had "Use system defaults" toggled on.
If I switch it off, it allows me to define layouts in that dialog. If I define a Swiss German and a Japanese layout, and if I use both Xfce's and IBus's toggling hotkeys (one after another), I get the desired result (but having two toggles is not really practical for me).
I haven't tried fcitx5 but I'll consider switching to it if I can't get IBus to work as desired.
I strongly assume I use IBus for input given that Mozc is running and working whenever I use IBus's toggle. I've set the environment variables as per "2 Integration"; =xim was just a test.
setxkbmap does not seem to work. It also doesn't show up in localectl's output
fytch@abc:~$ setxkbmap -layout ch,jp -variant de_nodeadkeys,
fytch@abc:~$ localectl
System Locale: LANG=en_US.UTF-8
VC Keymap: de_CH-latin1
X11 Layout: ch
X11 Variant: de_nodeadkeys
fytch@abc:~$ setxkbmap -layout ch,jp
fytch@abc:~$ localectl
System Locale: LANG=en_US.UTF-8
VC Keymap: de_CH-latin1
X11 Layout: ch
X11 Variant: de_nodeadkeys
Offline
localectl simply reads /etc/vconsole.conf (well, through dbus - it's systemd after all)
setxkbmap -print -query
will get you the current set of layouts.
If I define a Swiss German and a Japanese layout, and if I use both Xfce's and IBus's toggling hotkeys (one after another), I get the desired result (but having two toggles is not really practical for me).
If ibus cannot change the layout itself, you can "xdotool key ISO_First_Group" resp. "xdotool key ISO_Last_Group" to programatically switch them.
Online
Ok, now I set:
localectl set-x11-keymap "ch,jp" "de_nodeadkeys,"
localectl set-keymap --no-convert de_CH-latin1
I get:
fytch@abc:~$ localectl
System Locale: LANG=en_US.UTF-8
VC Keymap: de_CH-latin1
X11 Layout: ch,jp
X11 Model: de_nodeadkeys,
IBus still fails to change layouts when I use its toggle functionality even after a reboot.
Now, following your suggestion, I removed the key binding from IBus and instead added these two application shortcuts to my Xfce keyboard tool:
bash -c "setxkbmap -layout ch -variant de_nodeadkeys && ibus engine xkb:ch::gsw"
bash -c "setxkbmap -layout jp && ibus engine mozc-on"
It only works with this order (first setxkbmap and then ibus)! It's an ugly hack but I guess if IBus refuses to work any other way then I have to go with this.
Offline
localectl set-x11-keymap "ch,jp" "de_nodeadkeys,"
X11 Model: de_nodeadkeys,
https://wiki.archlinux.org/title/Xorg/K … _localectl isn't very smart, you need to provide the correct parameters in correct order or it'll try to turn your variant into a model
Also always use setxkbmap to query the actual layout, again: localectl just reads a file it has written itself. It doesn't tell you anything about the current constitution of the X11 server.
bash -c "setxkbmap -layout jp && ibus engine mozc-on"
Ewww… don't use setxkbmap to change layouts, use the layout switch ("xdotool key ISO_First_Group" resp. "xdotool key ISO_Last_Group")
setxkbmap is slow AF and will steamroll over/reset other keyboard settings.
Online
Thanks for pointing out that mistake. It should have been:
localectl set-x11-keymap "ch,jp" "" "de_nodeadkeys,"
Unfortunately, I haven't had any success with xdotool:
fytch@abc:~$ setxkbmap -print -query
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwertz)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+ch(de_nodeadkeys)+jp:2+inet(evdev)" };
xkb_geometry { include "pc(pc105)" };
};
rules: evdev
model: pc105
layout: ch,jp
variant: de_nodeadkeys,
fytch@abc:~$ xkblayout-state print "%s"; echo
ch
fytch@abc:~$ xdotool key ISO_Last_Group
fytch@abc:~$ xkblayout-state print "%s"; echo
ch
fytch@abc:~$ xdotool key ISO_First_Group
fytch@abc:~$ xkblayout-state print "%s"; echo
ch
It's not just xkblayout-state; when I press äöü on my keyboard I actually get these letters, which shouldn't happen with the Japanese layout.
I'm fine with using the hacky setxkbmap solution if the proper solution doesn't work.
Offline
You don't have any groub switch configured,
grep grp /usr/share/X11/xkb/rules/base.lst
Online