0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Ubuntu24.04 でファイルエクスプローラnautilusのファイル、フォルダ名入力時に日本語が二重入力される問題をChatGPT5に解決してもらった。(再起動時になぜか日本語入力ができなくなるバグの、再起動なしの復旧方法も)

0
Last updated at Posted at 2025-08-18

了解。“今のあなたの状態(Xorg + Fcitx5 + Mozc で Nautilus のリネームも正常)”を、他の Ubuntu 24.04 マシンでも確実に再現するための手順だけを、必要十分にまとめます。
※以下は Xorg(XDG_SESSION_TYPE=x11 前提です。まず Xorg でログインしてください(ログイン画面右下の ⚙ →「Ubuntu on Xorg」を選択)。


再現手順(Xorg + Fcitx5 方式)

1) 必要パッケージの導入

sudo apt update
sudo apt install -y fcitx5 fcitx5-mozc fcitx5-frontend-gtk4 fcitx5-config-qt

2) 入力メソッドを Fcitx5 に指定

im-config -n fcitx5

3) 環境変数を“全セッション”に適用(environment.d)

mkdir -p ~/.config/environment.d
cat > ~/.config/environment.d/80-fcitx.conf <<'EOF'
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
EOF

4) Xorg セッション開始時に Fcitx5 を常駐(保険)

cat > ~/.xprofile <<'EOF'
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
command -v fcitx5 >/dev/null && (fcitx5 -d || true)
EOF

mkdir -p ~/.config/autostart
cp /usr/share/applications/org.fcitx.Fcitx5.desktop ~/.config/autostart/ 2>/dev/null || true

5) IBus を停止(競合防止)

ibus exit 2>/dev/null || true
pkill -f ibus-daemon 2>/dev/null || true

6) 完全ログアウト → Xorg で再ログイン(重要)


成功チェック(必ず確認)

echo "$XDG_SESSION_TYPE"                     # → x11
pgrep -a fcitx5                              # → fcitx5 -d が常駐している
pgrep -a ibus                                # → (出力なし=動いていない)
echo "GTK_IM_MODULE=$GTK_IM_MODULE  QT_IM_MODULE=$QT_IM_MODULE  XMODIFIERS=$XMODIFIERS"
# 期待値:GTK_IM_MODULE=fcitx  QT_IM_MODULE=fcitx  XMODIFIERS=@im=fcitx

動作テスト:

  • gtk4-demo → “Entry” で日本語変換・確定が正常
  • Nautilus を開いてファイル/フォルダを F2 でリネーム → 二重入力なしで正常

まとめ(コピペ一括セットアップ版)

複数台に配るときは、これを setup_fcitx5.sh として保存→実行でOKです。

#!/usr/bin/env bash
set -euo pipefail
sudo apt update
sudo apt install -y fcitx5 fcitx5-mozc fcitx5-frontend-gtk4 fcitx5-config-qt
im-config -n fcitx5 || true
mkdir -p ~/.config/environment.d
cat > ~/.config/environment.d/80-fcitx.conf <<'EOF'
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
EOF
cat > ~/.xprofile <<'EOF'
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
command -v fcitx5 >/dev/null && (fcitx5 -d || true)
EOF
mkdir -p ~/.config/autostart
cp /usr/share/applications/org.fcitx.Fcitx5.desktop ~/.config/autostart/ 2>/dev/null || true
ibus exit 2>/dev/null || true
pkill -f ibus-daemon 2>/dev/null || true
echo "Done. Log out, choose 'Ubuntu on Xorg', log in, then verify:"
echo '  pgrep -a fcitx5 ; pgrep -a ibus'
echo '  echo "$GTK_IM_MODULE $QT_IM_MODULE $XMODIFIERS"'

以上で、あなたの現状と同じ “Xorg + Fcitx5 + Mozc/環境変数は fcitx に統一” の状態を、他の Ubuntu 24.04 マシンにも確実に再現できます。


バグが生じたら、以下で対処。

  1. IBus を止める(競合防止)
    ibus exit 2>/dev/null || true
    pkill -f ibus-daemon 2>/dev/null || true

  2. Fcitx5 をクリーン再起動
    fcitx5 -rd

  3. Mozc の有無を確認し、無ければ入れる(←ここを { ... } でグルーピング)
    dpkg -s fcitx5-mozc >/dev/null 2>&1 || { sudo apt update && sudo apt install -y fcitx5-mozc; }

  4. Mozc を“現在のIM”にする
    fcitx5-remote -l # ← mozc が一覧に出るのを確認(省略可)
    fcitx5-remote -o # ← Fcitx5 を有効化
    fcitx5-remote -s mozc # ← mozc を選択(以後 Ctrl+Space / 半角全角 で切替)


0
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?