Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

let's call the app what the user called it #1

Merged
merged 3 commits into from

2 participants

@thomasjachmann

My main reason to fork was that I'm using slate to switch apps and wasn't able to switch to a Chrome SSB. I then found out that the app (eg mine was called "Googlemail") was called "Googlemail" in OS X's app switcher, but in the Activity Monitor, the process was called "Google Chrome". Slate had only access to the process name to switch to the app, so I could only switch to "Google Chrome" but not to "Googlemail" which gets confusing when you've got both apps running simultaneously. With my last commit, the app now is called "Googlemail" and can be referenced by slate.

Furthermore, I sped up the retrieval of Google Chrome and avoided reconverting existing icns files.

thomasjachmann added some commits
@thomasjachmann thomasjachmann Use spotlight to find chrome
This is much faster than finding in the Applications folder.
2920d86
@thomasjachmann thomasjachmann Don't reconvert icns icons 1519219
@thomasjachmann thomasjachmann Link the chrome executable into the ssb
This way, we don't spawn a "Google Chrome" instance but an own app
instance that can be named via the settings in en.lproj. In the end, the
running app has the name specified upon creation, not "Google Chrome".
af42018
@lhl lhl merged commit 52f3a75 into lhl:master
@lhl
Owner

Awesome, these look great! Thanks Thomas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 25, 2013
  1. @thomasjachmann

    Use spotlight to find chrome

    thomasjachmann authored
    This is much faster than finding in the Applications folder.
  2. @thomasjachmann
  3. @thomasjachmann

    Link the chrome executable into the ssb

    thomasjachmann authored
    This way, we don't spawn a "Google Chrome" instance but an own app
    instance that can be named via the settings in en.lproj. In the end, the
    running app has the name specified upon creation, not "Google Chrome".
This page is out of date. Refresh to see the latest.
Showing with 26 additions and 5 deletions.
  1. +26 −5 chrome-ssb.sh
View
31 chrome-ssb.sh
@@ -25,7 +25,8 @@ icon=`trim "$inputline"`
#### Find Chrome
-chromePath=`find /Applications | grep -e 'Google Chrome$' | head -n 1`
+chromePath=`mdfind "kMDItemCFBundleIdentifier == 'com.google.Chrome'" | head -n 1`
+chromeExecPath="$chromePath/Contents/MacOS/Google Chrome"
# Let's make the app whereever we call the script from...
appRoot=`pwd`
@@ -35,21 +36,29 @@ 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"
+versionsPath="$appRoot/$name.app/Contents/Versions"
# 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" --resampleWidth 128 >& /dev/null
- tiff2icns -noLarge "$resourcePath/icon.tiff" >& /dev/null
+ if [ ${icon: -5} == ".icns" ] ; then
+ cp "$icon" "$resourcePath/icon.icns"
+ else
+ sips -s format tiff "$icon" --out "$resourcePath/icon.tiff" --resampleWidth 128 >& /dev/null
+ tiff2icns -noLarge "$resourcePath/icon.tiff" >& /dev/null
+ fi
fi
-### Create the executable
+### link the chrome executable
+ln -s "$chromeExecPath" "$execPath/$name Chrome"
+
+### Create the wrapper executable
cat >"$execPath/$name" <<EOF
#!/bin/bash
ABSPATH=\$(cd "\$(dirname "\$0")"; pwd)
-exec "$chromePath" --app="$url" --user-data-dir="\$ABSPATH/../Profile" "\$@"
+exec "\$ABSPATH/$name Chrome" --app="$url" --user-data-dir="\$ABSPATH/../Profile" "\$@"
EOF
chmod +x "$execPath/$name"
@@ -68,3 +77,15 @@ cat > "$plistPath" <<EOF
</dict>
</plist>
EOF
+
+### link the Versions directory
+ln -s "$chromePath/Contents/Versions" "$versionsPath"
+
+### create a default (en) localization to name the app
+mkdir -p "$resourcePath/en.lproj"
+cat > "$resourcePath/en.lproj/InfoPlist.strings" <<EOF
+CFBundleDisplayName = "$name";
+CFBundleGetInfoString = "$name, Copyright 2012 Google Inc. Alle Rechte vorbehalten.";
+CFBundleName = "$name";
+NSHumanReadableCopyright = "Copyright 2012 Google Inc. Alle Rechte vorbehalten.";
+EOF
Something went wrong with that request. Please try again.