Created
February 22, 2018 00:43
-
-
Save cinsk/79859434590d38053607992eb3a92365 to your computer and use it in GitHub Desktop.
How to create Dock Emacs/Aquamacs Icon reading bash init scripts and more
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 characters
# See https://www.emacswiki.org/emacs/EmacsForMacOS | |
# | |
# Create an app that runs a shell script that runs Emacs.app, like this: | |
# 1. use Finder to navigate to /Applications and double-click Automator.app. | |
# 2. Select the document type “Application” and click “Choose”. | |
# 3. In the list on the left, select “Library”. | |
# 4. In the next list, find “Run Shell Script” and drag it into the workflow area on the right. | |
# 5. In the new shell script, delete the text and replace it with: | |
EMACS=/Applications/Aquamacs.app/Contents/MacOS/Aquamacs | |
EMACSCLIENT=/Applications/Aquamacs.app/Contents/MacOS/bin/emacsclient | |
cd # start in my home directory | |
if pgrep -U $(id -u) $(basename $EMACS) >/dev/null; then | |
if [ "$#" -eq 0 ]; then | |
# set -- -e '(select-frame-set-input-focus (car (or (visible-frame-list) (frame-list)))' | |
echo "\"$EMACSCLIENT\" -e '(select-frame-set-input-focus (car (or (visible-frame-list) (frame-list))))'" | bash --login -s "$@"; | |
else | |
echo "\"$EMACSCLIENT\" -n \"\$@\"" | bash --login -s "$@"; | |
fi | |
else | |
echo "\"$EMACS\" \"\$@\"" | bash --login -s "$@" & | |
disown %- | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment