管理多个 Chrome 配置文件 - OSX

发布于 2024-10-27 00:00:09 字数 1239 浏览 5 评论 0原文

我正在将此 shell 脚本作为应用程序运行在OSX 使用新的个人文件夹启动多个 Chrome 实例:

do shell script "/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --enable-udd-profiles --user-data-dir=/Users/$USER/Library/Application\\ Support/Google/ChromePersonal > /dev/null 2>&1 &"

这太棒了 - 因为我可以在 Chrome 实例之间进行 CMD-TAB,而无需清除 cookie/缓存等。

问题:我想扩展脚本以覆盖一个大的“ 2”、“3”等在 Dock 和 CMD-TAB 弹出窗口中的每个实例的 Chrome 图标上,以便我可以区分实例。现在,我看到的只是多个 Chrome.app 图标。

关于如何实现这一目标有什么想法吗?我也愿意编辑图标,但是 Chrome2.app 图标不会影响 Dock 图标 - 因为 Dock 图标来自原始 Chrome.app。

更新:问题已解决,方法如下:

  1. 复制粘贴“Google Chrome.app”以在应用程序文件夹中创建副本。

  2. 将该副本命名为 Chrome2.app。

  3. 按照 Google 的说明创建Applescript,基于 Google Chrome.app 的新副本,现已命名为 Chrome2.app。 。这将使用正确的(备用)用户配置文件启动 Chrome 的新副本,因此不会发生 cookie 问题。

  4. 将 Chrome2.app 的名称和 Chrome2.app 的图标更改为您想要在任务切换器和任务栏中显示的任何内容。基本应用程序(而不是脚本快捷方式)决定了 OS X 中的图标和名称。

  5. Ta-da。

  6. 可选:在两个 Chrome 副本之间设置 Google Sync,以便您的书签、偏好设置、扩展程序保持不变!

I'm running this shell script as an app in OSX to initiate multiple instances of Chrome with a fresh personal folder:

do shell script "/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --enable-udd-profiles --user-data-dir=/Users/$USER/Library/Application\\ Support/Google/ChromePersonal > /dev/null 2>&1 &"

This is awesome - because I can CMD-TAB between instances of Chrome without purging cookies/cache etc.

The problem: I'd like to expand the script to overlay a big "2", "3", etc over the Chrome icon for each instance in the Dock and CMD-TAB popup so that I can differentiate between isntances. Right now, all I see are multiple Chrome.app icons.

Any ideas on how to accomplish this? I'm also open to editing the icon, however the Chrome2.app icon does not influence the Dock icon - because the dock icon comes from the original Chrome.app.

UPDATED: Problem Solved, Here's How:

  1. Copy-Paste "Google Chrome.app" to create a carbon copy in the Applications folder.

  2. Name the copy something like Chrome2.app.

  3. Follow the instructions from Google to create the Applescript, based on the NEW copy of Google Chrome.app that is now named Chrome2.app. Could name this script something like LaunchChrome2.app, etc. This will launch the NEW copy of Chrome with the correct (alternate) user profile, therefore no cookie issues will happen.

  4. Change the name of Chrome2.app and the icon of Chrome2.app to whatever you want to show up in the Task Switcher and Task Bar. The base application, NOT the script shortcut, is what determines the icon and name in OS X.

  5. Ta-da.

  6. Optional: Set up Google Sync between the two copies of Chrome so that your bookmarks, prefs, extensions, stay the same!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

酒废 2024-11-03 00:00:09

我正在使用 http://blog.duoconsulting.com/2011/03/13/multiple-profiles-in-google-chrome-for-os-x/,它会在“应用程序”文件夹中为您创建新的 Chrome 应用程序,绑定到特定的配置文件。

之后,您可以简单地获取信息并粘贴 PNG 作为您的图标。我为每个 Chrome 实例使用不同颜色的 Chrome 图标和主题。

I'm using the script at http://blog.duoconsulting.com/2011/03/13/multiple-profiles-in-google-chrome-for-os-x/, which creates new Chrome application for you in the Applications folder, tied to a specific profile.

After that you can simply Get Info and paste a PNG as your icon. I use differently colored Chrome icons and themes for each Chrome instance.

路弥 2024-11-03 00:00:09

实现这一目标的最佳方法(由 此 Chromium 帮助文档) 是:

编写 AppleScript 包装器 (Mac OS X)

在 Mac OS X 上,您可以创建一个使用自定义的运行 Chrome 的应用程序
--user-data-dir:

  1. 打开应用程序>公用事业>脚本编辑器。

  2. 输入:

set chrome to "\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\""
set userdatadir to "\"$HOME/Library/Application Support/Google/Chrome Alt\""
do shell script chrome & " --user-data-dir=" & userdatadir & " > /dev/null 2>&1 &"
  1. 根据需要修改您的安装路径、Chrome 与 Chromium,以及
    所需的用户数据目录。

  2. 使用文件格式将脚本保存在您的应用程序目录中
    “申请”。

  3. 关闭脚本编辑器,找到新创建的应用程序,然后运行它。
    这将打开一个指向您的新个人资料的 Chrome 实例。

如果需要,您可以为此应用程序提供与 Chrome 相同的图标:

  1. 选择 Google Chrome 应用程序,然后选择“文件”>“Chrome 浏览器”。获取信息。
  2. 选择信息对话框左上角的图标。你会看到一个蓝色
    突出显示图标周围。
  3. 按 ⌘C 复制图标。
  4. 打开新应用程序的信息对话框,然后选择其中的图标
    左上角。
  5. 按 ⌘V 粘贴复制的图标。

The best way to achieve this (courtesy of this Chromium help doc) is:

Writing an AppleScript wrapper (Mac OS X)

On Mac OS X, you can create an application that runs Chrome with a custom
--user-data-dir:

  1. Open Applications > Utilities > Script Editor.

  2. Enter:

set chrome to "\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\""
set userdatadir to "\"$HOME/Library/Application Support/Google/Chrome Alt\""
do shell script chrome & " --user-data-dir=" & userdatadir & " > /dev/null 2>&1 &"
  1. Modify as needed for your installation path, Chrome versus Chromium, and
    desired user data directory.

  2. Save the script in your Applications directory with the file format
    "Application".

  3. Close the Script Editor, find your newly created application, and run it.
    This opens a Chrome instance pointing to your new profile.

If you want, you can give this application the same icon as Chrome:

  1. Select the Google Chrome application and choose File > Get Info.
  2. Select the icon at the top left of the info dialog. You will see a blue
    highlight around the icon.
  3. Press ⌘C to copy the icon.
  4. Open the info dialog for the new application and select the icon in the
    top left.
  5. Press ⌘V to paste the copied icon.
淡淡的优雅 2024-11-03 00:00:09

This is duly answered including the icon in the Google Chrome help here. I use it and it works well. The only problem I have is that the "profile 2" dock icon doesn't keep highlighted and a new -third- dock icon appears.

惟欲睡 2024-11-03 00:00:09

问题中提到的“来自 Google 的说明”不再讨论如何创建 AppleScript,因此我无法让该脚本正常工作。

我还尝试了 @Miguel 的脚本的变体,它部分起作用(谢谢!),但我遇到了一些困难。主要问题是 Chrome 的包装副本虽然是独立的,但有自己的图标,并且可以自行正常工作,无法打开从其他应用程序发送的 URL,因此它无法与 Choosy 一起使用。

以下是对我有用的方法,获取可以通过 Choosy 打开链接的第二个 Chrome,例如:

  1. Library/Application Support/Google/Chrome 复制到 Library/Application Support/Google/ChromePersonal 在你的主目录中。
    这是可选的;我想将我的 Chrome 用户配置文件转移到新实例。但如果您可以重新开始,则可以跳过此步骤。
  2. Google Chrome.app 复制到其他位置。我使用了 /Applications/Google Chrome Personal.app
  3. 将我的wrapper.sh 脚本(如下)复制到应用的 Contents/MacOS 目录中。
  4. 修改此新应用中的 Contents/Info.plist 以指向包装器脚本(将 CFBundleExecutable 值设置为 wrapper.sh),并让唯一的 CFBundleIdentifier(只需将“个人”添加到现有值中)。

这是我修改后的wrapper.sh脚本。将其放在 /Applications/Google\ Chrome\ Personal.app/Contents/MacOS/wrapper.sh 中,然后按照步骤 4 编辑 Info.plist。

#!/bin/bash

# Wrapper script that starts independent instance of Google Chrome for Mac

# To use: copy Google Chrome.app to a new location.  Copy this script into
# the Contents/MacOS directory of the copied app.  Edit the copied app's
# Contents/Info.plist and change CFBundleExecutable to "wrapper.sh",
# and pick a unique CFBundleIdentifier.

# Instance data will be stored here.  You can copy your existing data 
# to this location if you want to preserve your existing user profile(s).
# You can also change this if you want to store the data somewhere else.
INSTANCE_DIR="/Users/$USER/Library/Application Support/Google/ChromePersonal"

# Find the Google Chrome binary:
CHOME_BIN="$(dirname "$0")/Google Chrome"

# Start Chrome
exec "$CHOME_BIN" --user-data-dir="$INSTANCE_DIR"

(完全披露:我还在apple.stackexchange

The "instructions from Google" mentioned in the question no longer talk about how to create an AppleScript, so I wasn't able to get that one to work.

I also tried a variant of the script from @Miguel and it partly worked (thanks!) but I ran into some difficulties. The main problem is that the wrapped copy of Chrome, although it is independent, has its own icon, and works correctly on its own, cannot open URLs sent from other applications, so it doesn't work with Choosy.

Here is what worked for me, to get a second Chrome which can open links via Choosy, for example:

  1. Copy Library/Application Support/Google/Chrome to Library/Application Support/Google/ChromePersonal in your home directory.
    This is optional; I wanted to transfer over my Chrome User profiles to the new instance. But if you're OK starting fresh you can skip this.
  2. Copy Google Chrome.app to another location. I used /Applications/Google Chrome Personal.app.
  3. Copy my wrapper.sh script (below) into the app's Contents/MacOS directory.
  4. Modify Contents/Info.plist in this new app to point to the wrapper script (set CFBundleExecutable value to wrapper.sh), and to have a unique CFBundleIdentifier (just add "Personal" to the existing value).

Here is my modified wrapper.sh script. Put it at /Applications/Google\ Chrome\ Personal.app/Contents/MacOS/wrapper.sh and then edit the Info.plist as in step 4.

#!/bin/bash

# Wrapper script that starts independent instance of Google Chrome for Mac

# To use: copy Google Chrome.app to a new location.  Copy this script into
# the Contents/MacOS directory of the copied app.  Edit the copied app's
# Contents/Info.plist and change CFBundleExecutable to "wrapper.sh",
# and pick a unique CFBundleIdentifier.

# Instance data will be stored here.  You can copy your existing data 
# to this location if you want to preserve your existing user profile(s).
# You can also change this if you want to store the data somewhere else.
INSTANCE_DIR="/Users/$USER/Library/Application Support/Google/ChromePersonal"

# Find the Google Chrome binary:
CHOME_BIN="$(dirname "$0")/Google Chrome"

# Start Chrome
exec "$CHOME_BIN" --user-data-dir="$INSTANCE_DIR"

(full disclosure: I also posted this answer on apple.stackexchange)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文