-
-
Save demonbane/1065791 to your computer and use it in GitHub Desktop.
#!/bin/sh | |
echo "What should the Application be called (no spaces allowed e.g. GCal)?" | |
read inputline | |
name="$inputline" | |
echo "What is the url (e.g. https://www.google.com/calendar/render)?" | |
read inputline | |
url="$inputline" | |
echo "What is the full path to the icon (e.g. /Users/username/Desktop/icon.png)?" | |
read inputline | |
icon="$inputline" | |
chromePath="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" | |
appRoot="/Applications" | |
# various paths used when creating the app | |
resourcePath="$appRoot/$name.app/Contents/Resources" | |
execPath="$appRoot/$name.app/Contents/MacOS" | |
profilePath="$appRoot/$name.app/Contents/Profile" | |
plistPath="$appRoot/$name.app/Contents/Info.plist" | |
# make the directories | |
mkdir -p "$resourcePath" "$execPath" "$profilePath" | |
# convert the icon and copy into Resources | |
if [ -f "$icon" ] ; then | |
sips -s format tiff "$icon" --out "$resourcePath/icon.tiff" --resampleHeightWidth 128 128 >& /dev/null | |
tiff2icns -noLarge "$resourcePath/icon.tiff" >& /dev/null | |
fi | |
# create the executable | |
cat >"$execPath/$name" <<EOF | |
#!/bin/sh | |
exec "$chromePath" --app="$url" --user-data-dir="$profilePath" "\$@" | |
EOF | |
chmod +x "$execPath/$name" | |
# create the Info.plist | |
cat > "$plistPath" <<EOF | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" “http://www.apple.com/DTDs/PropertyList-1.0.dtd”> | |
<plist version=”1.0″> | |
<dict> | |
<key>CFBundleExecutable</key> | |
<string>$name</string> | |
<key>CFBundleIconFile</key> | |
<string>icon</string> | |
</dict> | |
</plist> | |
EOF | |
This has been updated. I added @sanfordredlich's fix for non-square images and also added the ability to use an app name with spaces in it.
This works great but sometimes the App icon gets lost and the Chrome icon will show up in its place. Very odd. Though looks like this issue is already well mentioned here.
One of the ways of consistently losing the customized icon is by downloading a file or invoking the "open file" dialog. I reported the issue here:
The problem I am encountering with the app shortcuts created with this script is that my main Google Chrome installation thinks that it is already running when one of the app shortcuts is running, so it will not launch. Maybe there is a setting for Chrome that allows for multiple copies of Chrome to run simultaneously?
If profile data is stored within the application itself it is not possible for non-admin users to run it. Changed the script https://gist.github.com/eerne/8222446 to store the profile data in the users home directory at "~/Library/Application Support/<appname>/<randomnumber>/".
Just, thank you. I've been struggling with Fluid.app for days because it's user agent does not support Wunderlist. With this script I created a wunderlist standalone app in 1 minute. Thank you so much.
Is there a way to get notifications & app name in the menubar working ?
Sorry to ask stupid questions. but how do I make an app out of that code?
You can follow this video on Lifehacker, but download the script here and extract it. It's a good idea to create a folder called "Scripts" and place things like this in there. I also have a subfolder called App Icons. Basically you extract file, open terminal and follow the video instructions. http://lifehacker.com/5611711/create-application-shortcuts-in-google-chrome-for-mac-with-a-shell-script
is there any way to have chrome to open new windows in a tab? not liking the 'new window' bit...
Thanks so much for this—now I can use chrome extensions in a FluidApp-esque fasion! Good work!
Thanks for the awesome script! Does anyone know how to make the tab bar show in the ssb? Using this to make a standalone Gmail :)
The instructions still say that the app name can't include spaces while that's no longer true
why does this open in a different profile? how can I get it to open in my default profile?
Thanks!!
This is a great script! I would like to use 1Password within the app. Could anyone suggest how I can install the add-in. I can't get an address bar to go to the site. (I know that is the point of the script.) Thank you.
@lkingsella Open your app, press CMD + N (or CTRL + N on Windows) to open a new window with the same profile, then install the 1Password extension.
@nhodges, THANK YOU!
Thank you! Just what I was looking for. Now I can use WhatsApp web as an 'application'.
I've used this script to make a GUI: https://github.com/victor-torres/quickwebapp.
Is there a way to get notifications & app name in the menubar working ?
Ditto both these questions.
- Click on the 'Raw' button. Download and save the file to your Desktop.
- Open Terminal.app
- In terminal prompt, make the file executable by running the following command (copy paste the command and hit return key)
chmod +x ~/makeapp.sh
- Execute the script
~/makeapp.sh
Great script! But how do I prevent links to open in that new app instead of the standard chrome profile? If all links I open in my new Gmail app open there instead of my browser that kind of defeats the purpose of such an app. Any ideas? Can I force links to open in my standard Chrome profile?
Hey, good job! Unfortunately it doesn't work for Chrome Extensions, like the Any.Do app. It opens the "oops, couldn't open.." window. First I thought it might be the string being handled wrong, so I hard coded it into the script and could even see the right URL in the Menubar while loading. But again "oops.." Any thoughts about it?
Edit: my fault - of course it doesn't work. The created app is not aware of any installed extensions, because it's working with a new profile. I had to install the extension to the newly created profile.