How do I set a default Chrome Person (user) to open URLs as?

Ubuntu Unity Desktop uses *.desktop files set the default programs for file types. In order to achieve what you desire you can create a custom *.desktop file for google-chrome just for your user.

This will take a couple of steps:


1. Verify Default Program

Verify that google-chrome.desktop is your default program for opening links:

In Terminal enter: cat ~/.local/share/applications/mimeapps.list.

Output should be something like this:

[Default Applications] text/html=google-chrome.desktop x-scheme-handler/http=google-chrome.desktop x-scheme-handler/https=google-chrome.desktop x-scheme-handler/about=google-chrome.desktop x-scheme-handler/unknown=google-chrome.desktop x-scheme-handler/mailto=google-chrome.desktop text/x-c++src=gedit.desktop

[Added Associations] text/x-c++src=gedit.desktop;

If like in the example google-chrome.desktop is handling the web links then proceed as described. If not you need to set the default program first.


2. Create Custom *.desktop File

Creating a custom google-chrome.desktop file at ~/.local/share/applications/ based on the original /usr/share/applications/google-chrome.desktop file.

In Terminal enter:

cp /usr/share/applications/google-chrome.desktop ~/.local/share/applications/

  • Doing this you will only change the settings for your user and not all users in the machine.

  • If a *.desktop file name from /usr/share/applications/ is duplicated at ~/.local/share/applications/ then the local one takes priority.


3. Edit new *.desktop file

This file will contain many lines for names of options in different languages. We will need to edit all lines starting with Exec=.

Example from my computer at: /usr/share/applications/google-chrome.desktop

Exec=/usr/bin/google-chrome-stable %U

Exec=/usr/bin/google-chrome-stable

Exec=/usr/bin/google-chrome-stable --incognito

In the new file at ~/.local/share/applications/ change these lines by adding the option --profile-directory=Default.

Exec=/usr/bin/google-chrome-stable --profile-directory=Default %U

Exec=/usr/bin/google-chrome-stable --profile-directory=Default

Exec=/usr/bin/google-chrome-stable --profile-directory=Default --incognito

This will make it so every time you open a link it will be opened by the Default user.


Different User

The option --profile-directory= can be set to the name of anyone folder at ~/.config/google-chrome/ that holds user configuration. Examples:

  • Default
  • Profile 1
  • Profile 2
  • etc...

Example:

Exec=/usr/bin/google-chrome-stable --profile-directory=Profile\ 1 %U

Exec=/usr/bin/google-chrome-stable --profile-directory=Profile\ 1

Exec=/usr/bin/google-chrome-stable --profile-directory=Profile\ 1 --incognito

Observe the backslash\ in Profile\ 1 to indicate the folder name includes a space.