Skip to content

Commit

Permalink
keyboard shortcut tweaks
Browse files Browse the repository at this point in the history
- if there's no com.apple.universalaccess "com.apple.custommenu.apps",
  don't complain, just take the exit error status
- shorten the cmd/opt/ctrl/shift variable names. No need to have "Key"
  as part of them
  • Loading branch information
ymendel committed Sep 3, 2021
1 parent ab85ac8 commit 57ba88e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions macos/keyboard_shortcuts.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ addCustomMenuEntryIfNeeded()
echo "usage: addCustomMenuEntryIfNeeded com.company.appname"
return 1
else
if ! ( defaults read com.apple.universalaccess "com.apple.custommenu.apps" | grep -q "$appName" )
if ! ( defaults read com.apple.universalaccess "com.apple.custommenu.apps" 2>/dev/null | grep -q "$appName" )
then
# FIXME: this gives me a "could not write" error, but sudo quiets that and still does nothing
defaults write com.apple.universalaccess "com.apple.custommenu.apps" -array-add "$appName"
Expand All @@ -24,10 +24,10 @@ addCustomMenuEntryIfNeeded()
# ~ = option
# $ = shift

CmdKey='@'
CtrlKey='^'
OptKey='~'
ShiftKey='$'
Cmd='@'
Ctrl='^'
Opt='~'
Shift='$'

LeftArrow='\U2190'
RightArrow='\U2192'
Expand All @@ -40,12 +40,12 @@ RightArrow='\U2192'
prefixes=('' 'Show ' 'Select ')
for prefix in "${prefixes[@]}"
do
defaults write NSGlobalDomain NSUserKeyEquivalents -dict-add "${prefix}Previous Tab" "${CmdKey}${OptKey}${LeftArrow}"
defaults write NSGlobalDomain NSUserKeyEquivalents -dict-add "${prefix}Next Tab" "${CmdKey}${OptKey}${RightArrow}"
defaults write NSGlobalDomain NSUserKeyEquivalents -dict-add "${prefix}Previous Tab" "${Cmd}${Opt}${LeftArrow}"
defaults write NSGlobalDomain NSUserKeyEquivalents -dict-add "${prefix}Next Tab" "${Cmd}${Opt}${RightArrow}"
done

# Mailplane
# close tab with cmd-W
defaults write com.mailplaneapp.Mailplane3 NSUserKeyEquivalents -dict-add "Close Tab" "${CmdKey}W"
defaults write com.mailplaneapp.Mailplane3 NSUserKeyEquivalents -dict-add "Close Tab" "${Cmd}W"
# TODO: uncomment this when the function works
# addCustomMenuEntryIfNeeded "com.mailplaneapp.Mailplane3"

0 comments on commit 57ba88e

Please sign in to comment.