`/etc/profile`のキーボード設定は機能しません。

`/etc/profile`のキーボード設定は機能しません。

以下は、キーボードレイアウトを設定するためにインポートまたは実行できるスクリプトです。

#!/bin/bash
# Testing to only apply the layout to Kinesis keyboard.
# Get Device ID with: `xinput -list | grep -i key
debug_out=/tmp/layout_kinesis.log

echo "layout_kinesis start" >> $debug_out 2>&1
echo $SHELL >> $debug_out 2>&1
date >> $debug_out 2>&1
whoami >> $debug_out 2>&1
kinesis_device_id=$(xinput --list | grep "05f3:0007[[:blank:]]*id=" | sed -n "s/^.*id=\(\S*\).*/\1/p") >> $debug_out 2>&1
echo "layout_kinesis id $kinesis_device_id" >> $debug_out 2>&1
if [ ! -z "$kinesis_device_id" ] ; then
    echo "layout_kinesis on display $DISPLAY" >> $debug_out 2>&1
    xkbcomp -i $kinesis_device_id /home/gauthier/kinesis/kinesis_swe_us.conf $DISPLAY >> $debug_out 2>&1
fi
echo "layout_kinesis id done" >> $debug_out 2>&1

リダイレクトブームについて申し訳ありません。妄想ができました。

これは、ログインした状態で実行または取得したときに機能します。

今キーボードが接続されている場合は、ログインしているすべての人に設定したいと思います。スクリプトをにコピーしました/etc/profile.d/layout_kinesis.sh。これには次の権限があります-rwxr-xr-x 1 root root

レイアウトが読み込まれませんでした。

デバッグ出力ファイルは合理的なようです(stderrリダイレクトが必要xkbcomp:それ以外の場合は「続行しますか?」ポップアップが表示されます)。シェルはあり、/bin/bashユーザーは私のものです。id(9)とDISPLAY:0)は正しいようです。多くの警告が表示されxkbcompますが、彼らはいつも同じです。

ログイン後、ターミナルエミュレータで手動でソーシングすると/etc/profile.d/layout_kinesis.sh機能します。それでは、そもそもそうではないのはなぜですか?ソースは合うようですが効果はありませんね。他の起動ファイルはこの設定を上書きしますか?


私が調査したもの:

  • または言及はありませんxkbcompsetxkbmap/etc/profile.d/
  • ~/.profile何の関係もない、~/.bash_profile何の関係もない~/.bash_login

これはUbuntu 20.04にあります。

ベストアンサー1

おすすめ記事