macos – Is there a easy technique to have separate dock icons for various Chrome Profiles?


None of those solutions labored for me in a complete approach underneath Mac OS X Yosemite. Right here is my answer, which supplies you a number of cases, a dock launch menu for the cases, and totally different icons for every occasion. Once you run the script it will routinely undergo all of your profiles, after which inform you what to do subsequent.

#!/bin/bash

# cdi.sh - Make chrome profiles behave like a number of browsers on Mac OS X
#          (Examined on Yoshmite). Make profiles work like seperate functions
#          - esp. helpful if you wish to simply swap between totally different browsers
#          in numerous digital desktops / workspaces, or don't desire work
#          home windows combined in with dwelling home windows within the "Window" menu, or wish to
#          be capable to simply see what processes are with a sure profile in
#          chrome job supervisor, or be capable to eaisly give up one profile with
#          a number of home windows open and begin the place you left of later.

set -e

cd /Customers/$USER/Library/Utility Assist/Google/Chrome

CDI="cdi-chrome-multiple-profile-instances-in-dock-with-different-icons.d"
APPLESCRIPTS="$CDI/Applescript-Sources"
LAUNCHERS="$CDI/Chrome-Launchers"
RUNTIMES="$CDI/Chrome-Runtimes"
check -d $CDI || mkdir $CDI
check -d $APPLESCRIPTS || mkdir $APPLESCRIPTS
check -d $LAUNCHERS || mkdir $LAUNCHERS
check -d $RUNTIMES || mkdir $RUNTIMES

grep '"username"' Profile*/Preferences Default/Preferences | grep -v '               ' | awk -F : '{print $1";"$3}' | sed 's:/Preferences::g' | sed 's:@:-at-:g' | sed 's/; /;/g' > $CDI/profiles.txt
# Like: Profile 1;"webmaster-at-example.org"

echo "Be affected person, this entails copying lots of information..."

whereas learn PROFILE; do

DIR="$(echo $PROFILE | awk -F; '{print $1}')"
# Like: DIR='Profile 1'
echo "Engaged on profile: $DIR"

LINK="$(echo $PROFILE | awk -F; '{print $2}' | sed 's/ /-/g' | sed 's/"//g' | sed 's/^/cdi-profile-/g')"
# Like: cdi-profile-webmaster-at-example.org

APP="$(echo $LINK | sed 's/^cdi-profile-//g' | sed 's/$/-DO-NOT-RUN-DIRECTLY-JUST-USE-FOR-CHANGING-ICON-cdi.app/g')"
# Like: webmaster-at-example.org-DO-NOT-RUN-DIRECTLY-JUST-USE-FOR-CHANGING-ICON-cdi.app

SHIM="$(echo $LINK | sed 's/^cdi-profile-//g' | sed 's/$/.app/g')"
# Like: webmaster-at-example.org.app

TXT="$APPLESCRIPTS/$(echo $LINK | sed 's:^cdi-profile-:chrome-:g' | sed 's/$/.txt/g')"
# Like:
# cdi-chrome-multiple-profile-instances-in-dock-with-different-icons.d
# /Applescript-Sources/chrome-webmaster-at-example.org.txt

check -L "$LINK" || ln -s "$DIR" "$LINK"
cd "$LINK"
check -L Default || ln -s . Default
cd /Customers/$USER/Library/Utility Assist/Google/Chrome
check -d "$RUNTIMES/$APP" || cp -R /Functions/Google Chrome.app "$RUNTIMES/$APP"

## This part disabled as a result of enabling it makes computerized profile login not work.
## There's a probability somebody who is aware of extra about chrome will assist in some unspecified time in the future; see:
## 
## 
## 
# Change Bundle ID so desktop assignation works. Unsure if it will survive updates.
# CFBundleIdentifier should include solely alphanumeric (A-Z,a-z,0-9), hyphen (-), and interval (.) characters.
# (Primarily based on fiddling round there additionally appears to be a size restrict.)
#UUID="$(echo $APP | md5sum | awk '{print $1}' | tr [0-9] [A-Z] | lower -c 1-4,29-32)"
#plutil -replace CFBundleIdentifier -string "cdi.$UUID" -- "$RUNTIMES/$APP/Contents/Data.plist"
#plutil -replace CFBundleName -string "$UUID" -- "$RUNTIMES/$APP/Contents/Data.plist"
#plutil -replace CFBundleDisplayName -string "$UUID" -- "$RUNTIMES/$APP/Contents/Data.plist"
#plutil -replace KSProductID -string "cdi.$UUID" -- "$RUNTIMES/$APP/Contents/Data.plist"
# To verify: defaults learn ~/Library/Preferences/com.apple.areas.plist app-bindings

echo "on run" > $TXT
echo -n "do shell script " >> $TXT
echo -n '"' >> $TXT
echo -n "/Customers/$USER/Library/Utility\ Assist/Google/Chrome/$RUNTIMES/$APP/Contents/MacOS/Google\ Chrome --user-data-dir=/Customers/$USER/Library/Utility\ Assist/Google/Chrome/$LINK" >> $TXT
echo ' > /dev/null 2>&1 &"' >> $TXT
echo "give up" >> $TXT
echo "finish run" >> $TXT
check -d "$LAUNCHERS/$SHIM" || osacompile -o "$LAUNCHERS/$SHIM" $TXT

performed < $CDI/profiles.txt

echo
echo 'Accomplished with automated portion. Now it is best to manually:'
echo
echo '1. Add (equivalent) icons of your selection to every pair of profile Launchers'
echo '   / Runtimes within the folder ~/Library/Utility Assist/Google/Chrome/'
echo '   cdi-chrome-multiple-profile-instances-in-dock-with-different-icons.d'
echo '   (google for quite a few guides on tips on how to change mac os x app icons)'
echo
echo '2. From the finder, drag the "Chrome-Launchers" folder to the stacks space'
echo '   of the dock. Proper click on on the stack and choose "Record" for straightforward viewing.'
echo '   Additionally choose "Show as Folder" and provides the folder a pleasant icon.'
echo
echo '3. BE SURE to solely open Chrome by way of this stack. DO NOT pin the app-area'
echo '   Chrome icon(s) to the app space of the dock! DO NOT run "regular" Chrome!'
echo
echo 'The one exception to (3) is that if it's worthwhile to add a brand new profile. In that case,'
echo 'shut all cases, then open the "regular" Chrome, add profile, shut, and'
echo 'then run this script once more.'
echo
echo 'Word: once you launch first time you'll get "Welcome to Google Chrome"'
echo '      dialog field. That is regular; don't worry. It can ask if you need'
echo '      to set Chrome as default; this is applicable to that occasion of chrome.'
echo '      Picky -  - works nice with this!'
echo

For icons, you should utilize any PNG (or most likely many different codecs).

The chrome avatars which you will already be used to are positioned underneath “~/Library/Utility Assist/Google/Chrome/Avatars” – avatar_ninja.png and so on.

Or make your individual, or use one of many quite a few icon websites – I like Easyicon.

Additionally this seems presumably helpful – Get Again Avatars in Chrome to Swap Consumer Profiles Extra Simply – to make the open home windows simpler to shortly establish (untested).

One factor that is not working but is the flexibility to assign totally different consumer profile chrome cases to particular desktops. It is because if the attribute used to do that is modified, the browser is now not capable of routinely log in to that profile when the browser begins up. I’ve made a discussion board publish and bug report on this concern; additionally it is an issue for site-specific browsers, so the chrome-ssb-osx undertaking could get this working in some unspecified time in the future. I haven’t got the ten repute factors wanted to incorporate greater than 2 hyperlinks in posts right here (assist! :-), so you may have to have a look at the hyperlinks to those issues within the script above (“This part disabled” part).

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles