勝手に独り読書会 - その03

はい.

osx 設定スクリプトの勝手に独りで読書会,3 回目.

続いてる.

今回相手にするパラグラフは,長めですね.
途中あきらめて分割したらごめんなさい.

###############################################################################
# Finder                                                                      #
###############################################################################

# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons
defaults write com.apple.finder QuitMenuItem -bool true
### 無; [Finder] メニューに [Finder を終了] アイテムの表示
### -> true (表示)

# Finder: disable window animations and Get Info animations
defaults write com.apple.finder DisableAllAnimations -bool true
### 無; アニメーションエフェクトの無効化
### -> true (アニメーションを無効にする)

# Show icons for hard drives, servers, and removable media on the desktop
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
### [Finder の環境設定],pnl[一般] > [デスクトップに表示する項目]
### - chb[ハードディスク]       -> "オン"
### - chb[外部ディスク]         -> "オン"
### - chb[CD,DVD,および iPod] -> "オン"
### - chb[接続しているサーバ]   -> "オン"

# Finder: show hidden files by default
defaults write com.apple.finder AppleShowAllFiles -bool true
### 無; 不可視ファイル/フォルダ(.ファイル等)の表示
### -> true (表示する)

# Finder: show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
### [Finder の環境設定],pnl[詳細] > [すべてのファイル名拡張子を表示]
### -> "オン"

# Finder: show status bar
defaults write com.apple.finder ShowStatusBar -bool true
### finder のメニュー [表示] > [ステータスバーを表示]

# Finder: show path bar
defaults write com.apple.finder ShowPathbar -bool true
### finder のメニュー [表示] > [パスバーを表示]

# Finder: allow text selection in Quick Look
defaults write com.apple.finder QLEnableTextSelection -bool true
### 無; quicklook でのテキストコンテンツ編集
### -> true (編集可)

# Display full POSIX path as Finder window title
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
### 無; タイトルバーへのパス表示
### -> true (表示する)defaults write NSGlobalDomain com.apple.springing.enabled -bool true

# When performing a search, search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
### [Finder の環境設定],pnl[詳細] > pdm[検索実行時]
### -> [現在のフォルダ内を検索]

# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
### [Finder の環境設定],pnl[詳細] > chb[拡張子を変更する前に警告を表示]
### -> "オン"

# Enable spring loading for directories
defaults write NSGlobalDomain com.apple.springing.enabled -bool true
### [Finder の環境設定],pnl[一般] > chb[スプリングフォルダとスプリングウインドウ]
### -> "オン"

# Remove the spring loading delay for directories
defaults write NSGlobalDomain com.apple.springing.delay -float 0
### [Finder の環境設定],pnl[一般] > chb[スプリングフォルダとスプリングウインドウ] > sld[反応時間]
### -> [短い]

# Avoid creating .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
### 無; ネットワーク接続時の .DS_Store ファイル生成の抑制
### -> true (作らない)

# Disable disk image verification
defaults write com.apple.frameworks.diskimages skip-verify -bool true
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
### 無; ディスクイメージ .dmg 展開時の検証処理のスキップ
### -> true (スキップする,検証しない)

# Automatically open a new Finder window when a volume is mounted
defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true
### 無; ボリュームのマウント時,新しいファインダで開く
### -> true (開く)

# Show item info near icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
### 表示スタイルが "アイコン" の状態で,finder のメニュー [表示] > [表示オプション] で開くダイアログ [デスクトップ]/[<それぞれのアイテム名>] の chb[項目の情報を表示]
### -> "オン" (表示する)

# Show item info to the right of the icons on the desktop
/usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist
### 表示スタイルが "アイコン" の状態で,デスクトップをアクティブにし,finder のメニュー [表示] > [表示オプション] - [デスクトップ] ダイアログの rbt[ラベルの位置]
### -> [右側]

# Enable snap-to-grid for icons on the dktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
### 表示スタイルが "アイコン" の状態で,finder のメニュー [表示] > [表示オプション] で開くダイアログ [デスクトップ]/[<それぞれのアイテム名>] の pmn[並び順序]
### -> [グリッドに沿う]

# Increase grid spacing for icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist
### 表示スタイルが "アイコン" の状態で,finder のメニュー [表示] > [表示オプション] で開くダイアログ [デスクトップ]/[<それぞれのアイテム名>] の sld[グリッド間隔]
### -> 100 px (なんとなく 1/8 くらい)

# Increase the size of icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist
### 表示スタイルが "アイコン" の状態で,finder のメニュー [表示] > [表示オプション] で開くダイアログ [デスクトップ]/[<それぞれのアイテム名>] の sld[アイコンサイズ]

# Use list view in all Finder windows by default
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
### 表示スタイルが "リスト" の状態で,finder のメニュー [表示] > [表示オプション] で開くダイアログ [<それぞれのアイテム名>] の sld[デフォルトとして使用]
### -> "オン"

# Disable the warning before emptying the Trash
defaults write com.apple.finder WarnOnEmptyTrash -bool false
### [Finder の環境設定],pnl[詳細] > [ゴミ箱を空にする前に警告を表示]
### -> "オフ"

# Empty Trash securely by default
defaults write com.apple.finder EmptyTrashSecurely -bool true
### [Finder の環境設定],pnl[詳細] > [確実にゴミ箱を空にする]
### -> "オフ"

# Enable AirDrop over Ethernet and on unsupported Macs running Lion
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true
### 無; AirDrop が使えない Mac で AirDrop を使えるようにする
### -> true (使えるようにする)

# Enable the MacBook Air SuperDrive on any Mac
sudo nvram boot-args="mbasd=1"
### 無; すべての mac で superdrive が動くようにする
### -> する

# Show the ~/Library folder
chflags nohidden ~/Library
### 無; Library フォルダの可視化

# Remove Dropbox’s green checkmark icons in Finder
file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns
[ -e "$file" ] && mv -f "$file" "$file.bak"
### ??; dropbox の同期マーク表示
### -> 非表示

以上です.

終わった.

以下,メモ.

はじめ.

Enable spring loading for directories

# Enable spring loading for directories
defaults write NSGlobalDomain com.apple.springing.enabled -bool true

いやー今まで知らなかったよん,ma ji de(笑

何気なく,特に便利だとも不便だとも感じず,時々現れる挙動に何の疑問も感じず目の当たりにしていたもんが,コレなのね.

つか,その挙動,それがひとつの "機能" としてすら認識していなかったyo www
単なる効果かと.

コメント読んでいて「あ? spring loading」?
英語 ui では [Spring-loaded folders and windows] という設定アイテムがあることを知り,"spring-loaded" って言うんだということを学ぶ.
それを key に検索流してみたら,ここ とか ここ とかに引っかかって日本 ui では "スプリングフォルダ" と言うことを知る.

今になって.

ちょっと思い返してみると,あんま使ったことないな.
殆どの操作はキーボードでまかなおうとしているし... ということなのかな.

Remove the spring loading delay for directories

# Remove the spring loading delay for directories
defaults write NSGlobalDomain com.apple.springing.delay -float 0

この行を見た時はすでに,スプリングフォルダという存在を知ったことで,俄然戦闘能力が上がっていたことから,「あーそれここでしょ?」な感じで [スプリングフォルダとスプリングウインドウ] の スライダー[反応時間] にアクセス.

ui から,このコマンドで設定しようとしているのは [短い] だな,とサラっと抜けようとした.

...時,思わず,それは志村ばりの二度見.

"短い" ?

コマンドでは "0 sec" に設定しようとしている.
それが "短い"?

何か違和感.

改めてコメント見ると,"Remove ...".
反応時間 delay を "Remove" ?

この 0 というのは,速く (短く) していると言うことで良い?
でも,アイテムを重ねた瞬間,それと同時に,ドン! ってこと?
いやいや,0 は "ない" ので,もしかして無効にすることで,"remove" はそんな意味が込められている?

"0" って何,って話.

で実際やってみる.

% defaults write NSGlobalDomain com.apple.springing.delay -float 0
% killall Finder

[反応時間] スライダーは,[短い] になった.

ui からスライダーを [短い] にして,値を見てみる.

0 でした.

"0" は最速の設定と言うことみたい.

とはいえ,やっぱりこの機能使わなそうだから,別にいーんだけど(笑

Show item info near icons on the desktop and in other icon views

# Show item info near icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist

これも使わない機能なので,最初分からなかった.

デスクトップには,何も表示させないようにしているし,
基本,デスクトップにモノを置かないようにしているので.

この辺りをみて,"show item info" という設定項目があるのを知り,やっと「あぁ,こういうことか」と.

"show item info" を key にやっと,ここのことかと.

これデスクトップに対してやっているけど,
各アイテムごとにひとつひとつやらなくてはいけないの?

つか,これも使わないだろうけど(笑

ちなみに.
この設定アイテムは,ちょっと癖あって.

表示スタイルが "アイコン" であることが前提です

設定アイテムは,上述の [表示]メニュ > [表示オプション] 以外にも,
操作対象の中でのコンテキストメニューからもアクセスできるし,ツールバーのアクションメニューからもアクセスする方法もあります.もちろん [command]+[j] も.

さらに,何気なく見ていて今まで気づかなかったのですが,この設定アイテムは,
表示スタイルを,[アイコン] にしていないとダメです.

先述同様に [表示オプション] ダイアログ開いても,
ここで触れているアイテムは存在しなかったりします.

って,自分自身,今の今まで気づかなかった(笑

[表示オプション] ダイアログの設定アイテムは,この表示スタイルによって違うということ.

なので,まずこの設定を ui から行う場合は,表示スタイルを [アイコン] にしておく,というのが前提です.
finder メニュー の [表示] やら,ツールバーのアクションメニューやら,[command]+[1] とかで.

表示は,[リスト] をデフォルトにしているし,
デスクトップには物をおかないし,なスタイルで使っているから,
そりゃ気づかないわな,と.

思った.

Enable snap-to-grid for icons on the desktop and in other icon views

# Enable snap-to-grid for icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist

とゆーか.
"PlistBuddy" って何,て話.

/usr/libexec にあるんですね.

もうドンぴしゃりで,こちらが分かり易くまとめてくださっております.

拡張子「.plist」のファイルを読み書きするときに利用する。

で,幾つか新しい発見があったのでメモ.

  • plist は,最初テキスト形式,それからバイナリ形式へ.
  • 多くの plist はバイナリ形式のため,そのまま読み書きできず,property list editor や defaults コマンドを使う必要あり.
  • plistbuddy は,新しい plist ファイル編集用コマンド.

こんなところか.
最後の plistbuddy が "新しい plist ファイル編集用コマンド" と言う記述の "新しい" がどう掛かるのか迷っちゃうのが気になるところだけど...
"新しい plist" ?
"新しい コマンド" ?

あと,defaults と plistbubby の摘み分け方で,plistbuddy の方がイケているのだったら,いっそのこと default も全部 plistbuddy で書いてもいいんじゃ? と言う疑問を抱いてはダメなのだろうか.

とか.

いずれにせよ,plistbubby については,もう少し知っておく必要があるみたい.
うっちゃり!

あはw

あともうひとつ,どうしても気になるのがあって.
"FK_StandardViewSettings" とか "StandardViewSettings" って何なのだろう.

ということで,
何時になるか分からない,何時かの自分へ丸投げっ.

はい,おしまい.