Como posso migrar todos os atalhos de teclado de um mac para outro?

8

Tenho muitos atalhos de teclado personalizados e serão migradores Macs. Eu testei o Migration Assistant e parece que não consegui isso.

Eu li em algum lugar que eles estão armazenados nos arquivos plist do aplicativo individual na pasta ~/Library/Application Support , mas mesmo depois de copiar algumas dessas pastas sobre os atalhos, não parece seguir-se.

Como posso obter todos os atalhos de teclado migrados para um novo mac?

    
por cwd 06.11.2013 / 22:31

2 respostas

8

Os atalhos que podem ser alterados na guia Atalhos de aplicativos são armazenados em ~/Library/Preferences/.GlobalPreferences.plist e nas listas de propriedades de aplicativos em ~/Library/Preferences/*.plist e ~/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" = "$@g";
        "Find and Replace..." = "~@f";
        "Full Screen" = "^@f";
        Fullscreen = "^@f";
        "Increase Indent Level" = "^\Uf703";
        "Increase Level" = "^\Uf703";
        "Increase Paragraph Indent" = "^\Uf703";
        "Line Spacing..." = "~@l";
        Minimize = "
defaults write -g NSUserKeyEquivalents '{
"Browse All Versions..." = "^@v";
"Minimize" = "";
"Minimize All" = "";
"Show Previous Tab" = "~@\Uf702";
"Show Next Tab" = "~@\Uf703";
}'

defaults write -app Safari NSUserKeyEquivalents '{
"Reopen Last Closed Window" = "~@r";
"Reopen All Windows from Last Session" = "~$@r";
"Mail Contents of This Page" = "";
}'
1"; "Minimize All" = "
$ 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" = "$@g";
        "Find and Replace..." = "~@f";
        "Full Screen" = "^@f";
        Fullscreen = "^@f";
        "Increase Indent Level" = "^\Uf703";
        "Increase Level" = "^\Uf703";
        "Increase Paragraph Indent" = "^\Uf703";
        "Line Spacing..." = "~@l";
        Minimize = "
defaults write -g NSUserKeyEquivalents '{
"Browse All Versions..." = "^@v";
"Minimize" = "";
"Minimize All" = "";
"Show Previous Tab" = "~@\Uf702";
"Show Next Tab" = "~@\Uf703";
}'

defaults write -app Safari NSUserKeyEquivalents '{
"Reopen Last Closed Window" = "~@r";
"Reopen All Windows from Last Session" = "~$@r";
"Mail Contents of This Page" = "";
}'
1"; "Minimize All" = "%pre%1"; "Move Line Down" = "^\Uf701"; "Move Line Up" = "^\Uf700"; "Next Tab" = "~@\Uf703"; "Next Workspace" = "~@\Uf703"; "Normal Screen" = "^@f"; "Original Size" = "@0"; "Previous Tab" = "~@\Uf702"; "Previous Workspace" = "~@\Uf702"; "Remove Full Screen" = "^@f"; Reveal = "$@r"; "Select Next Tab" = "~@\Uf703"; "Select Next Tab View" = "~@\Uf703"; "Select Previous Tab" = "~@\Uf702"; "Select Previous Tab View" = "~@\Uf702"; "Shift Down" = "^\Uf701"; "Shift Left" = "^\Uf702"; "Shift Right" = "^\Uf703"; "Shift Up" = "^\Uf700"; "Show Next Tab" = "~@\Uf703"; "Show Previous Tab" = "~@\Uf702"; "Show in Finder" = "$@r"; "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" = "$@."; Refresh = "@r"; "Show Invisible Files" = "$@."; "Synchronize..." = "$@y"; }; } Found 1 keys in domain 'net.sourceforge.skim-app.skim': { NSUserKeyEquivalents = { Crop = "@k"; "Single Page" = "$@1"; "Single Page Continuous" = "$@0"; "Two Pages" = "$@2"; }; } 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 = "%pre%1"; Delete = "$@d"; Italic = "%pre%1"; "Plain Text Style" = "%pre%1"; Strikethrough = "%pre%1"; }; } Found 1 keys in domain 'com.apple.Safari': { NSUserKeyEquivalents = { "Mail Contents of This Page" = "%pre%1"; "Reopen All Windows from Last Session" = "~$@r"; "Reopen Last Closed Window" = "~@r"; }; } Found 1 keys in domain 'com.hogbaysoftware.WriteRoom.mac': { NSUserKeyEquivalents = { "Column 120" = "$@7"; "Column 200" = "$@8"; "Column 40" = "$@1"; "Column 50" = "$@2"; "Column 60" = "$@3"; "Column 66" = "$@4"; "Column 80" = "$@5"; "Column 90" = "$@6"; "Column Window Width" = "$@0"; "Enter Full Screen" = "$@f"; "Enter Full Screen Single" = "^@f"; "Exit Full Screen" = "$@f"; "Exit Full Screen Single" = "^@f"; }; }
1"; "Move Line Down" = "^\Uf701"; "Move Line Up" = "^\Uf700"; "Next Tab" = "~@\Uf703"; "Next Workspace" = "~@\Uf703"; "Normal Screen" = "^@f"; "Original Size" = "@0"; "Previous Tab" = "~@\Uf702"; "Previous Workspace" = "~@\Uf702"; "Remove Full Screen" = "^@f"; Reveal = "$@r"; "Select Next Tab" = "~@\Uf703"; "Select Next Tab View" = "~@\Uf703"; "Select Previous Tab" = "~@\Uf702"; "Select Previous Tab View" = "~@\Uf702"; "Shift Down" = "^\Uf701"; "Shift Left" = "^\Uf702"; "Shift Right" = "^\Uf703"; "Shift Up" = "^\Uf700"; "Show Next Tab" = "~@\Uf703"; "Show Previous Tab" = "~@\Uf702"; "Show in Finder" = "$@r"; "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" = "$@."; Refresh = "@r"; "Show Invisible Files" = "$@."; "Synchronize..." = "$@y"; }; } Found 1 keys in domain 'net.sourceforge.skim-app.skim': { NSUserKeyEquivalents = { Crop = "@k"; "Single Page" = "$@1"; "Single Page Continuous" = "$@0"; "Two Pages" = "$@2"; }; } 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 = "%pre%1"; Delete = "$@d"; Italic = "%pre%1"; "Plain Text Style" = "%pre%1"; Strikethrough = "%pre%1"; }; } Found 1 keys in domain 'com.apple.Safari': { NSUserKeyEquivalents = { "Mail Contents of This Page" = "%pre%1"; "Reopen All Windows from Last Session" = "~$@r"; "Reopen Last Closed Window" = "~@r"; }; } Found 1 keys in domain 'com.hogbaysoftware.WriteRoom.mac': { NSUserKeyEquivalents = { "Column 120" = "$@7"; "Column 200" = "$@8"; "Column 40" = "$@1"; "Column 50" = "$@2"; "Column 60" = "$@3"; "Column 66" = "$@4"; "Column 80" = "$@5"; "Column 90" = "$@6"; "Column Window Width" = "$@0"; "Enter Full Screen" = "$@f"; "Enter Full Screen Single" = "^@f"; "Exit Full Screen" = "$@f"; "Exit Full Screen Single" = "^@f"; }; }

Na verdade, eu uso um script de shell como este para configurar os atalhos:

%pre%

As strings de atalho usam o mesmo formato que em DefaultKeyBinding.dict . Você pode remover um atalho atribuindo um item de menu a . Se você atribuir um item de menu a nil , ele será acionado quando você pressionar n em alguns aplicativos, como o Audacity. Se você atribuir um item de menu a killall cfprefsd , ele será acionado quando você pressionar qualquer tecla no Safari em 10.9.

Observe que as preferências são armazenadas em cache no Mavericks. As alterações feitas com padrões ainda são aplicadas depois que você simplesmente fecha e reabre um aplicativo. Mas se você editar um plist diretamente ou substituir o plist, você também terá que executar defaults read /path/to/plist ou %code% .

    
por 22.11.2013 / 12:44
5

Graças à resposta existente, criei um script que salvará os atalhos em um script para ser executado em outras máquinas.

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

DESTFILE=~/Dropbox/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

Salve isso em um arquivo chamado save-hotkeys.sh e execute-o executando sh save-hotkeys.sh . Na máquina remota, execute ./install-hotkeys.sh enquanto estiver no mesmo diretório do arquivo. No meu exemplo, salve o arquivo no dropbox para que ele seja sincronizado com minhas outras máquinas.

    
por 10.07.2014 / 20:55