it-swarm-ja.com

すべてのキーボードショートカットをあるMacから別のMacに移行するにはどうすればよいですか?

私はたくさんのカスタムキーボードショートカットを持っており、移行Macになります。移行アシスタントをテストしましたが、これらを取得できなかったようです。

~/Library/Application Supportフォルダー内の個々のアプリケーションのplistファイルに保存されていることをどこかで読みましたが、これらのフォルダーのいくつかをショートカットにコピーした後でも、従わないようです。

すべてのキーボードショートカットを新しいMacに移行するにはどうすればよいですか?

screenshot-with-shadow.png

10
cwd

[アプリケーションのショートカット]タブから変更できるショートカットは、~/Library/Preferences/.GlobalPreferences.plistに保存され、アプリケーションのプロパティリストには~/Library/Preferences/*.plist~/Library/Containers/*/Data/Library/Preferences/*.plistに保存されます。

$ defaults find NSUserKeyEquivalents
Found 1 keys in domain 'Apple Global Domain': {
    NSUserKeyEquivalents =     {
        "Actual Size" = "@0";
        "Automatic Fit" = "@9";
        "Automatically Resize" = "@9";
        "Browse All Versions..." = "^@v";
        "Decrease Indent Level" = "^\\Uf702";
        "Decrease Level" = "^\\Uf702";
        "Decrease Paragraph Indent" = "^\\Uf702";
        "Enter Full Screen" = "^@f";
        "Enter Full Screen Mode" = "^@f";
        "Exit Full Screen" = "^@f";
        "Exit Full Screen Mode" = "^@f";
        "Find Next" = "@g";
        "Find Previous" = "[email protected]";
        "Find and Replace..." = "[email protected]";
        "Full Screen" = "^@f";
        Fullscreen = "^@f";
        "Increase Indent Level" = "^\\Uf703";
        "Increase Level" = "^\\Uf703";
        "Increase Paragraph Indent" = "^\\Uf703";
        "Line Spacing..." = "[email protected]";
        Minimize = "\001";
        "Minimize All" = "\001";
        "Move Line Down" = "^\\Uf701";
        "Move Line Up" = "^\\Uf700";
        "Next Tab" = "[email protected]\\Uf703";
        "Next Workspace" = "[email protected]\\Uf703";
        "Normal Screen" = "^@f";
        "Original Size" = "@0";
        "Previous Tab" = "[email protected]\\Uf702";
        "Previous Workspace" = "[email protected]\\Uf702";
        "Remove Full Screen" = "^@f";
        Reveal = "[email protected]";
        "Select Next Tab" = "[email protected]\\Uf703";
        "Select Next Tab View" = "[email protected]\\Uf703";
        "Select Previous Tab" = "[email protected]\\Uf702";
        "Select Previous Tab View" = "[email protected]\\Uf702";
        "Shift Down" = "^\\Uf701";
        "Shift Left" = "^\\Uf702";
        "Shift Right" = "^\\Uf703";
        "Shift Up" = "^\\Uf700";
        "Show Next Tab" = "[email protected]\\Uf703";
        "Show Previous Tab" = "[email protected]\\Uf702";
        "Show in Finder" = "[email protected]";
        "Toggle Full Screen" = "^@f";
        "Use Selection for Find" = "@e";
        "Zoom Reset" = "@0";
        "Zoom to Fit" = "@9";
    };
}
Found 1 keys in domain 'com.panic.Transmit': {
    NSUserKeyEquivalents =     {
        "Hide Invisible Files" = "[email protected]";
        Refresh = "@r";
        "Show Invisible Files" = "[email protected]";
        "Synchronize..." = "[email protected]";
    };
}
Found 1 keys in domain 'net.sourceforge.skim-app.skim': {
    NSUserKeyEquivalents =     {
        Crop = "@k";
        "Single Page" = "[email protected]";
        "Single Page Continuous" = "[email protected]";
        "Two Pages" = "[email protected]";
    };
}
Found 1 keys in domain 'com.googlecode.iterm2': {
    NSUserKeyEquivalents =     {
        "Next Pane" = "@\\Uf703";
        "Open Autocomplete..." = "@;";
        "Previous Pane" = "@\\Uf702";
        "Select Pane Above" = "@\\Uf700";
        "Select Pane Below" = "@\\Uf701";
    };
}
Found 1 keys in domain 'net.notational.velocity': {
    NSUserKeyEquivalents =     {
        Bold = "\001";
        Delete = "[email protected]";
        Italic = "\001";
        "Plain Text Style" = "\001";
        Strikethrough = "\001";
    };
}
Found 1 keys in domain 'com.Apple.Safari': {
    NSUserKeyEquivalents =     {
        "Mail Contents of This Page" = "\001";
        "Reopen All Windows from Last Session" = "[email protected]";
        "Reopen Last Closed Window" = "[email protected]";
    };
}
Found 1 keys in domain 'com.hogbaysoftware.WriteRoom.mac': {
    NSUserKeyEquivalents =     {
        "Column 120" = "[email protected]";
        "Column 200" = "[email protected]";
        "Column 40" = "[email protected]";
        "Column 50" = "[email protected]";
        "Column 60" = "[email protected]";
        "Column 66" = "[email protected]";
        "Column 80" = "[email protected]";
        "Column 90" = "[email protected]";
        "Column Window Width" = "[email protected]";
        "Enter Full Screen" = "[email protected]";
        "Enter Full Screen Single" = "^@f";
        "Exit Full Screen" = "[email protected]";
        "Exit Full Screen Single" = "^@f";
    };
}

私は実際に次のようなシェルスクリプトを使用してショートカットを構成します。

defaults write -g NSUserKeyEquivalents '{
"Browse All Versions..." = "^@v";
"Minimize" = "\1";
"Minimize All" = "\1";
"Show Previous Tab" = "[email protected]\Uf702";
"Show Next Tab" = "[email protected]\Uf703";
}'

defaults write -app Safari NSUserKeyEquivalents '{
"Reopen Last Closed Window" = "[email protected]";
"Reopen All Windows from Last Session" = "[email protected]";
"Mail Contents of This Page" = "\1";
}'

ショートカット文字列は、 DefaultKeyBinding.dict と同じ形式を使用します。メニュー項目を\1に割り当てると、ショートカットを削除できます。メニュー項目をnilに割り当てると、Audacityなどの一部のアプリケーションでnを押すとトリガーされます。メニュー項目を\0に割り当てると、10.9でSafariのいずれかのキーを押すとトリガーされます。

プリファレンスはMavericksにキャッシュされていることに注意してください。デフォルトで行われた変更は、アプリケーションを終了して再度開いた後も引き続き適用されます。ただし、plistを直接編集するか、plistを置き換える場合は、killall cfprefsdまたはdefaults read /path/to/plistも実行する必要があります。

12
Lri

既存の回答のおかげで、ショートカットをスクリプトに保存して他のマシンで実行するスクリプトを作成しました。

#!/bin/sh
# save-hotkeys.sh

DESTFILE=~/install-hotkeys.sh
echo '#!/bin/bash' > $DESTFILE

defaults find NSUserKeyEquivalents | sed -e "s/Found [0-9]* keys in domain '\\([^']*\\)':/defaults write \\1 NSUserKeyEquivalents '/" -e "s/    NSUserKeyEquivalents =     {//"  -e "s/};//" -e "s/}/}'/" >> $DESTFILE
echo killall cfprefsd >> $DESTFILE
chmod a+x $DESTFILE

これをsave-hotkeys.shというファイルに保存し、sh save-hotkeys.shを実行して実行します。リモートマシンで、ファイルと同じディレクトリにいるときに./install-hotkeys.shを実行します。私の例では、ファイルをドロップボックスに保存して、他のマシンと同期できるようにします。

9
Alan Shutko