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

Add script to show neovide as an option in "Open With" menus #1563

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions scripts/addtypes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

set -Eeuf -o pipefail
shopt -s inherit_errexit
set -x

run() {
local cmd=$1
/usr/libexec/PlistBuddy -c "${cmd}" target/release/bundle/osx/Neovide.app/Contents/Info.plist
}

main() {
plist=target/release/bundle/osx/Neovide.app/Contents/Info.plist

if [[ -e "${plist}.bak" ]]; then
# If the backup exists, overwrite the work copy during development to start fresh
cp "${plist}"{.bak,}
else
# If the backup doesn't exist, create it
cp "${plist}"{,.bak}
fi

run 'Add :CFBundleDocumentTypes array'

run 'Add :CFBundleDocumentTypes:0:CFBundleTypeExtensions array'
run 'Add :CFBundleDocumentTypes:0:CFBundleTypeExtensions:0 string txt'

run 'Add :CFBundleDocumentTypes:0:CFBundleTypeMIMETypes array'
run 'Add :CFBundleDocumentTypes:0:CFBundleTypeMIMETypes:0 string text/plain'

run 'Add :CFBundleDocumentTypes:0:CFBundleTypeName string "Plain Text File"'
run 'Add :CFBundleDocumentTypes:0:CFBundleTypeRole string Editor'

run 'Add :CFBundleDocumentTypes:1:LSItemContentTypes array'
run 'Add :CFBundleDocumentTypes:1:LSItemContentTypes:0 string public.text'
run 'Add :CFBundleDocumentTypes:1:CFBundleTypeRole string Editor'
}
main "$@"