0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

KDEのユーザーディレクトリを英語名にする

0
Posted at

KDE環境でホームディレクトリに作成される「デスクトップ」や「ダウンロード」などのディレクトリが日本語名だと、シェルで操作するときに不便に感じることがあります。

そこで、ユーザーディレクトリを英語名に設定するスクリプトを作成しました。改善点などあるかと思いますが、ひとまず公開します。

#!/usr/bin/env bash

# ホームディレクトリ内に英語名のユーザーディレクトリを作成し、
# その場所を xdg-user-dirs に設定します。
# 不要になった日本語名のディレクトリは、内容を確認してから手動で削除してください

if cd "$HOME" &&
   mkdir -p Desktop Downloads Templates Public Documents Music Pictures Videos &&
   chmod 700 Desktop Downloads Templates Public Documents Music Pictures Videos; then
  xdg-user-dirs-update --set DESKTOP "$HOME/Desktop"
  xdg-user-dirs-update --set DOWNLOAD "$HOME/Downloads"
  xdg-user-dirs-update --set DOCUMENTS "$HOME/Documents"
  xdg-user-dirs-update --set MUSIC "$HOME/Music"
  xdg-user-dirs-update --set PICTURES "$HOME/Pictures"
  xdg-user-dirs-update --set VIDEOS "$HOME/Videos"
  xdg-user-dirs-update --set TEMPLATES "$HOME/Templates"
  xdg-user-dirs-update --set PUBLICSHARE "$HOME/Public"
else
  echo "ディレクトリの作成または権限設定に失敗しました。" >&2
  exit 1
fi

この内容を change_dir_name_eng.sh などの名前で保存し、次のように実行してください。

bash change_dir_name_eng.sh

この例では、アクセス権を一律、所有者のみに制限しています。お好みで、アクセス権を調整してください。

0
0
0

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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?