Skip to content

Instantly share code, notes, and snippets.

@Hayao0819
Last active December 12, 2019 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hayao0819/b89dede83bbc271fb1a542fe31a46790 to your computer and use it in GitHub Desktop.
Save Hayao0819/b89dede83bbc271fb1a542fe31a46790 to your computer and use it in GitHub Desktop.
ArchLinuxへ日本語入力をセットアップするGUIスクリプト
#!/bin/bash
# 初期化
function window () {
zenity \
--title="ArchLinux 日本語入力 インストーラー" \
--window-icon="/usr/share/icons/Papirus-Dark/16x16/apps/mozc.svg" \
--width="500" \
--height="100" \
$@
}
script_path=$(cd $(dirname $0) && pwd)/$(basename $0)
# 言語確認
if [[ -f /etc/locale.conf ]]; then
source /etc/locale.conf
else
window --error --text="/etc/locale.confがありません。"
fi
case $LANG in
*ja_JP* ) :;;
* ) window --error --test="日本語に設定されていません。";;
esac
if [[ ! $UID = 0 ]]; then
window --question --text="日本語入力システムをインストールします。よろしいですか?" || exit 1
# .xprofile設定
echo -e 'export GTK_IM_MODULE=fcitx\nexport QT_IM_MODULE=fcitx\nexport XMODIFIERS=”@im=fcitx”' >> ~/.xprofile
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY $script_path > /dev/null
exit
else
pacman -S --noconfirm fcitx-im fcitx-configtool fcitx-mozc | window --progress --auto-close --pulsate --text="Fcitxをインストールしています。しばらくお待ちください。"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment