{
"conditions": [
{
"bundle_identifiers": [
"^com\\.apple\\.finder$"
],
"type": "frontmost_application_if"
},
{
"name": "FINDER_INSERT_MODE",
"type": "variable_unless",
"value": true
},
{
"name": "FINDER_FIND_MODE",
"type": "variable_unless",
"value": true
}
],
"from": {
"key_code": "z"
},
"to": [
{
"shell_command": "SEL=$(osascript -e 'tell application \"Finder\" to POSIX path of (item 1 of (get selection) as text)')\nselection_count=$(osascript -e 'tell application \"Finder\" to count (selection as list)')\n\nif [[ -d \"$SEL\" && $selection_count -eq 1 ]] ; then\n cd \"$SEL\"\n foldername=$(basename \"$SEL\")\n zip -r \"../$foldername.zip\" .\n open -R \"../$foldername.zip\"\n\n current_vol=$(osascript -e 'output volume of (get volume settings)')\n vol_percent=$(echo \"scale=2 ; $current_vol / 100\" | bc) # afplay play with 100% volume by default\n (afplay --volume \"$vol_percent\" \"/System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/system/Volume Mount.aif\" &)\nelse\n osascript -e '\n tell application \"System Events\" to tell process \"Finder\"\n click menu item \"Compress\" of menu \"File\" of menu bar 1\n end tell'\nfi\n"
}
],
"type": "basic"
}