Skip to content

Instantly share code, notes, and snippets.

@ole
Last active January 29, 2024 08:30
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ole/2ddddd45098c1acf0cdc969714ae7156 to your computer and use it in GitHub Desktop.
Save ole/2ddddd45098c1acf0cdc969714ae7156 to your computer and use it in GitHub Desktop.
Assign a keyboard shortcut to the Export Unmodified Originals menu command in Photos.app on macOS
#!/bin/bash
# Assigns a keyboard shortcut to the Export Unmodified Originals
# menu command in Photos.app on macOS.
# @ = Command
# ^ = Control
# ~ = Option
# $ = Shift
shortcut='@~^e'
# Set shortcut for 1 selected item
echo "Setting shortcut for 1 item"
defaults write com.apple.Photos NSUserKeyEquivalents -dict-add "Export Unmodified Original For 1 Photo" "$shortcut"
defaults write com.apple.Photos NSUserKeyEquivalents -dict-add "Export Unmodified Original For 1 Video" "$shortcut"
# Set shortcut for 2-20 selected items
objects=(Photos Videos Items)
for i in {2..20}
do
echo "Setting shortcut for $i items"
for object in "${objects[@]}"
do
defaults write com.apple.Photos NSUserKeyEquivalents -dict-add "Export Unmodified Originals For $i $object" "$shortcut"
done
done
# Use this command to verify the result:
# defaults read com.apple.Photos NSUserKeyEquivalents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment