2022年11月21日月曜日

Ubuntu22.04で、mozcの日本語InputModeをHiraganaで固定する

 Ubuntu 22.04でmozcを使っています。

英字→日本語にするときに、DirectInputになってマウスでHiraganaに変更していたのですが、こちらのやりかたで固定できました。

ビルドがめちゃくちゃ重くてハングアップしたり聞いたこと無い音でマシンが回っていましたが、なんとか成功しました。

https://gist.github.com/giner/77f5b0f7c14603ce5e78b6fcebf48162

https://github.com/google/mozc/issues/381


使ったコードはこれ

# Make ibus-mozc remember the last used mode (e.g. hiragana) and not switch back to Alphabet on restart
# See https://github.com/google/mozc/issues/381
cd $(mktemp -d)
apt source ibus-mozc
cd mozc-*/

patch src/unix/ibus/property_handler.cc << 'EOF'
--- src/unix/ibus/property_handler.cc.orig 2020-10-28 17:21:18.000849932 +0900
+++ src/unix/ibus/property_handler.cc 2020-10-28 17:21:34.172696046 +0900
@@ -80,7 +80,7 @@
// On IBus 1.4.x, IBus expects that an IME should always be turned on and
// IME on/off keys are handled by IBus itself rather than each IME.
#if IBUS_CHECK_VERSION(1, 5, 0)
-const bool kActivatedOnLaunch = false;
+const bool kActivatedOnLaunch = true;
#else
const bool kActivatedOnLaunch = true;
#endif // IBus>=1.5.0
EOF

sudo apt build-dep ibus-mozc
dpkg-buildpackage -us -uc -b
sudo dpkg -i ../ibus-mozc_*.deb


再起動するには

ibus-daemon -drx

とすればよく、これを好きなショートカットにアサインすればよいです。例えば以下のように custom shortcut から設定。



=== 以下メモ

文字変更をshift + spaceにしているが、変換できなくて再起動しないといけないときがある。

1つのキーアサインで同時にできないか、と思ってやってみた。

上記のショートカットを設定すると、dconfは上書きされるらしい。

そのあとdconf を新たに設定すると、大丈夫なのでは?2024/02/28設定して試し中

dconfは以下も参考に。

https://tabeta-log.blogspot.com/2022/05/ubuntu2204.html


の 入力切り替えを自分で設定する




2022年11月6日日曜日

Ubuntuで停止のCtrlCをMetaCに変えられなかった

できなかったけどメモ

stty intr \^k

とすると、InterruptコマンドをCtrl Kに変えられる。

Macと同じように、Meta(Super) Cに変えたいのだけど、できない。

stty intr 131

として

stty -a

とすると、設定がメタキー+Cになっているのは見えるが、動作しないようで。。

speed 38400 baud; rows 48; columns 118; line = 0;

intr = M-^C; 


stty sane

でデフォルトに戻す。



sttyはシングルバイトでないと使えない

https://stackoverflow.com/questions/36289048/what-does-m-in-stty-output-mean


https://superuser.com/questions/160388/change-bash-shortcut-keys-such-as-ctrl-c


文字コードをみたいとき

メタキーの話