Created
June 22, 2022 03:25
-
-
Save pmbauer/bd16b780ee59ec2caeb6257dfd50b7c2 to your computer and use it in GitHub Desktop.
Revisions
-
pmbauer created this gist
Jun 22, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ #!/usr/bin/env bash # NOTE: you will need node installed (for npx asar) # NOTE: this works on MacOS. # You'll need to modify MAIN_ASAR and CACHE_DIR for your platform MAIN_ASAR=/Applications/Obsidian.app/Contents/Resources/obsidian.asar CACHE_DIR="/Users/$USER/Library/Application Support/obsidian" TARGET_ASAR=$((ls -r "$CACHE_DIR"/obsidian-*.asar 2>/dev/null || echo "$MAIN_ASAR") | head -n 1) TMP_ASAR=/tmp/obsidian.asar UNPACKED_ASAR=/tmp/obsidian.asar.unpacked # cleanup rm -rf $TMP_ASAR $UNPACKED_ASAR npx asar extract "$TARGET_ASAR" /tmp/obsidian.asar.unpacked # Remove emacs keybindings and conflicting Mod-[ mapping sed -i 's/{key:"Ctrl-b".*key:"Ctrl-v"[^}]*}//;s/{key:"Mod-\["[^}]*},//' "$UNPACKED_ASAR"/app.js npx asar pack $UNPACKED_ASAR $TMP_ASAR # replace with patched asar pkill Obsidian cp $TMP_ASAR "$TARGET_ASAR"