Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making keyboard shortcuts show up in System Preferences #1

Open
ZevEisenberg opened this issue Jan 13, 2015 · 4 comments
Open

Making keyboard shortcuts show up in System Preferences #1

ZevEisenberg opened this issue Jan 13, 2015 · 4 comments

Comments

@ZevEisenberg
Copy link

I was googling around and I happened upon your dot files, where you state this on your keyboard shortcut adding commands:

These shortcuts will not show in System Preferences

All you have to do is add an entry to the com.apple.custommenu.apps to the com.apple.universalaccess preference. Don’t add duplicates, or you will make System Preferences crash. I have a function that I use to prevent this:

function addCustomMenuEntryIfNeeded
{
    if [[ $# == 0 || $# > 1 ]]; then
        echo "usage: addCustomMenuEntryIfNeeded com.company.appname"
        return 1
    else
        contents=`defaults read com.apple.universalaccess "com.apple.custommenu.apps"`
        grepResults=`echo $contents | grep $1`
        if [[ -z $grepResults ]]; then
            # does not contain app
            defaults write com.apple.universalaccess "com.apple.custommenu.apps" -array-add "$1"
        else
            # contains app already, so do nothing
        fi
    fi
}

And I use it like this:

function fixTerminal
{
    defaults write com.apple.Terminal NSUserKeyEquivalents '{ "Select Next Tab" = "^\U21e5"; "Select Previous Tab" = "^$\U21e5"; }'
    addCustomMenuEntryIfNeeded "com.apple.Terminal"
}
@ymendel
Copy link
Owner

ymendel commented Jan 14, 2015

Wow, thanks a lot, Zev! I'm not sure when I'll get around to actually adding this (the list is long, and my dotfiles don't get a lot of attention), but I definitely appreciate the tip.

Also, I just installed Padiddle. I'll see if I can prioritize making my dotfiles a little better over breaking my iPad.

@ZevEisenberg
Copy link
Author

:D

@lucaorio
Copy link

Hey @ZevEisenberg , great suggestion! Do you know how to apply this to the NSUserDictionaryReplacementItems?

@ZevEisenberg
Copy link
Author

@lucaorio no, but you can try some of the debugging/exploration techniques I mentioned here: https://www.raizlabs.com/dev/2015/02/how-to-script-os-x-keyboard-shortcuts/

The main one is to use fseventer to see which files have changed. If you can't get a copy (the developer's site is down), let me know and I can send you a copy. It only works on Sierra if you launch it, quit it, and launch it again. I'll be so sad when it breaks for good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants