Skip to content

Instantly share code, notes, and snippets.

@demonbane
Created July 5, 2011 20:05
Show Gist options
  • Save demonbane/1065791 to your computer and use it in GitHub Desktop.
Save demonbane/1065791 to your computer and use it in GitHub Desktop.
Create a Fluid-style app launcher for single-window Chrome instances on OSX
#!/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
@kevinnguy
Copy link

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 :)

@AnthonyDiSanti
Copy link

The instructions still say that the app name can't include spaces while that's no longer true

@kylamct
Copy link

kylamct commented Mar 3, 2015

why does this open in a different profile? how can I get it to open in my default profile?

Thanks!!

@lkingsella
Copy link

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.

@nhodges
Copy link

nhodges commented Apr 14, 2015

@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.

@lkingsella
Copy link

@nhodges, THANK YOU!

@victor-torres
Copy link

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.

@75th
Copy link

75th commented Nov 17, 2015

Is there a way to get notifications & app name in the menubar working ?

Ditto both these questions.

@JoyceBabu
Copy link

@lydudlejning

  1. Click on the 'Raw' button. Download and save the file to your Desktop.
  2. Open Terminal.app
  3. In terminal prompt, make the file executable by running the following command (copy paste the command and hit return key)
    chmod +x ~/makeapp.sh
  4. Execute the script
    ~/makeapp.sh

@muesliq
Copy link

muesliq commented Aug 4, 2016

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment