如何使用两个 Firefox 配置文件?

Ves*_*l75 21 firefox launcher .desktop

我运行 Ubuntu 14.04 并希望为同一登录的 Ubuntu 用户使用一个带有两个不同配置文件的 Firefox 安装。

我该如何设置,以便我可以轻松地从 Unity 启动器启动两个配置文件?

Byt*_*der 31

如何为同一个 Ubuntu 用户和同一个 Firefox 安装设置不同的 Firefox 配置文件

命令行选项的摘录man firefox

-ProfileManager
   Start the profilemanager. Use this to choose the profile you would like to
   run firefox with. You will need to also use -no-remote if there is already
   a running firefox instance.

-P profile
   Start firefox with the profile named profile. Will start the profile
   manager if a valid profile name is not specified. You will need to also
   use -no-remote if there is already a running firefox instance.
Run Code Online (Sandbox Code Playgroud)

因此,您只需要在编辑其配置文件后,使用终端Alt+ F2HUD 从启动器图标的上下文菜单中使用这些参数之一启动 Firefox ,我将在下面进行描述。

设置一个新的配置文件:

  • 从终端或使用Alt+启动 Firefox 的 ProfileManager F2

    firefox -ProfileManager
    
    Run Code Online (Sandbox Code Playgroud)

    Firefox ProfileManager 主窗口

  • 将您当前的配置文件重命名defaultprofile1(或您喜欢的任何名称,您甚至不必重命名它,但我将在本指南中进行澄清 - 您只需profile1在出现的任何位置替换为您的确切名称!)单击Rename Profile...

  • 通过单击 使用向导创建新配置文件Create Profile...。它将首先显示一个信息窗口,阅读它并单击Next。第二个窗口将要求您输入配置文件的名称,在profile2此处输入(或将本指南中出现的任何位置替换为您输入的内容)。我建议您不要更改存储配置文件的文件夹,除非您有充分的理由这样做。单击Finish

    Firefox ProfileManager 创建配置文件向导

  • 退出配置文件管理器。

设置启动器图标以从上下文菜单访问这些配置文件:

  • 将原始启动器文件(由 root 拥有,在系统范围内使用并将被下一次更新替换)复制到您的主文件夹:

    cp /usr/share/applications/firefox.desktop ~/.local/share/applications/firefox.desktop
    
    Run Code Online (Sandbox Code Playgroud)
  • 例如使用 Gedit (GUI) 或 Nano (终端) 编辑副本:

    gedit ~/.local/share/applications/firefox.desktop
    nano ~/.local/share/applications/firefox.desktop
    
    Run Code Online (Sandbox Code Playgroud)
  • 搜索行:

    Actions=NewWindow;NewPrivateWindow;
    
    Run Code Online (Sandbox Code Playgroud)

    并像这样添加新的上下文菜单操作标识符(示例名称,但仅在文件中使用,您不会在其他任何地方看到它们):

    Actions=NewWindow;NewPrivateWindow;Profile1;Profile2;ProfileManager;
    
    Run Code Online (Sandbox Code Playgroud)
  • 在文件末尾插入下面的代码片段,您可以更改Name=值并根据需要添加任意数量的翻译(给出了德语 [de] 的示例)。这些Exec=firefox -P ...行必须包含您在概要文件管理器中创建的概要文件的确切名称(区分大小写)!该-no-remote标志允许多个 Firefox 配置文件同时运行。此外,行中的最后一个单词[Desktop Action ...]必须与您添加到Actions=上面行中的键完全匹配。

    [Desktop Action Profile1]
    Name=Run Firefox with profile 1
    Name[de]=Firefox mit Profil 1 starten
    Exec=firefox -P profile1 -no-remote
    OnlyShowIn=Unity;
    
    [Desktop Action Profile2]
    Name=Run Firefox with profile 2
    Name[de]=Firefox mit Profil 2 starten
    Exec=firefox -P profile2 -no-remote
    OnlyShowIn=Unity;
    
    [Desktop Action ProfileManager]
    Name=Open Firefox profile manager
    Name[de]=Firefox Profilmanager öffnen
    Exec=firefox -ProfileManager -no-remote
    OnlyShowIn=Unity;
    
    Run Code Online (Sandbox Code Playgroud)
  • 现在,如果您想在左键单击启动器图标时指定一个永久的默认配置文件(否则,您上次通过 ProfileManager 使用并勾选相应复选框的配置文件将被启动),您还必须编辑主Exec=行。它是最上面的,应该是这样的:

    Exec=firefox %u
    
    Run Code Online (Sandbox Code Playgroud)

    将其编辑为如下所示,可能替换profile1为您希望的正确默认配置文件名称。

    Exec=firefox -P profile1 %u
    
    Run Code Online (Sandbox Code Playgroud)
  • 在系统意识到您想要覆盖系统范围的firefox.desktop文件并使用您的个人和自定义文件之前,您必须重新启动(也许注销并重新登录也足够了?)。或者你可以使用命令

    desktop-file-install --dir=~/.local/share/applications ~/.local/share/applications/firefox.desktop
    
    Run Code Online (Sandbox Code Playgroud)

    重新启动启动器文件。之后,享受您的多个个人资料!

  • 这是完整的解决方案,但缺少一个小细节。如果您想同时启动不同的配置文件,可以使用“-no-remote”。否则,这就是我一直在寻找的答案。 (4认同)

Rob*_*edl 22

我认为 Firefox Profile Switcher 是您的答案!

您可以像这样在命令行上使用选项“ -P ”激活它

firefox -P
Run Code Online (Sandbox Code Playgroud)

然后,您可以为每个任务创建配置文件,所有这些都在同一个主文件夹中(如果必须的话)。

Firefox 配置文件

要让它们同时运行,您还需要添加--new-instance到命令中。

最后,您可以通过自定义菜单和工具栏选项选择预定义的主题之一:

打开自定义对话框,以免您看到主题为下拉菜单。

我想你必须为每个社交媒体帐户这样做。

您现在可以在启动器上放置一个图标来调用

firefox -P --new-instance
Run Code Online (Sandbox Code Playgroud)

或者编写一个小的包装脚本并替换符号链接。

sudo nano /usr/local/bin/firefox
Run Code Online (Sandbox Code Playgroud)

使用正确的路径输入以下内容

#!/bin/bash
/usr/lib/firefox/firefox -P --new-instance
Run Code Online (Sandbox Code Playgroud)

使其可执行

sudo chmod +x /usr/local/bin/firefox
Run Code Online (Sandbox Code Playgroud)

正如用户muru在下面的评论中指出的那样,没有必要像最初建议的那样替换原始链接

firefox 链接的路径可能因您的操作系统而异,您可以通过以下方式找到它

which firefox
Run Code Online (Sandbox Code Playgroud)

然后删除旧链接

sudo unlink /usr/bin/firefox
Run Code Online (Sandbox Code Playgroud)

将其链接到正确的路径

sudo ln -s /usr/local/bin/firefox /usr/bin/firefox
Run Code Online (Sandbox Code Playgroud)


Kro*_*tan 12

我建议使用Multi-Account Containers扩展,这是一个由 Mozilla 制作的官方插件。您描述的用例正是它存在的原因:

来自 AMO 的截图
(来源:mozilla.net

她可以为她的每个帐户集创建容器,并选择一种强调色。此强调色将显示在每个选项卡的标题下方,指示它位于哪个容器:

三个容器上的三个标签 (不要介意黑暗主题)

默认情况下,标签不会在容器中打开,您可以通过长按“新标签”按钮来创建它们。

不仅容器很容易识别,选项卡也只是普通选项卡,您可以将它们全部放在同一个窗口中。(对于多个配置文件,您将无法在一个窗口中包含 2 个配置文件的选项卡)。

此外,浏览器配置和安装的插件仍然相同(因为它只是一个浏览器),这减少了“WTF”因素。