Skip to main content
Added the "action" option; aligned terminology to the official specifications
Source Link
fra-san
  • 10.9k
  • 2
  • 27
  • 45

Most likely, your attempt at editing google-chrome.desktop didn't work because that file has more than one Exec directiveentry, and the one you changed wasn't the one that is actually used.

Using the Chrome package for Debian from Google's repositoryChrome package for Debian from Google's repository, google-chrome.desktop shows three Exec directivesentries in three distinct sections (groups, in freedesktop.org's nomenclature):

The one with the --incognito option—likely the one you edited—is only executed when you select "New Incognito Window" from a context menu (e.g. the application menuafter right clicking on Chrome's icon in GNOME Activities).

And then edit the Exec directiveentry, at least in the [Desktop Entry] sectiongroup (you may want to keep the other Exec directivesentries aligned to ensure Chrome will behave the same way no matter what menu entry you useused to start it):

Adjust proxyURL and proxyPORT as needed; don't forget to set proxyURL for both the --proxy-server and --host-resolver-rules options.

If you want the default opening action to run Chrome without setting any proxy, you may leave the main [Desktop Entry]'s Exec entry untouched and add an action instead. It requires you to

  1. add a name for a new action to the Actions key in the [Desktop Entry] group;
  2. add a new action group.
[Desktop Entry] ... Actions=new-window;new-private-window;new-proxied-window; ... [Desktop Action new-proxied-window] Name=New Proxied Window Exec=/usr/bin/google-chrome-stable --proxy-server="socks5://proxyURL:proxyPORT" --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE proxyURL" %U 

"New Proxied Window" will then appear as an option when you right click on Chrome's icon (it may require a logout/login). Note that all the concurrently running instances of Chrome will share the same proxy settings of the first one you opened, unless you start them with the --user-data-dir option.

Most likely, your attempt at editing google-chrome.desktop didn't work because that file has more than one Exec directive, and the one you changed wasn't the one that is actually used.

Using the Chrome package for Debian from Google's repository, google-chrome.desktop shows three Exec directives in three distinct sections:

The one with the --incognito option—likely the one you edited—is only executed when you select "New Incognito Window" from a context menu (e.g. the application menu).

And then edit the Exec directive, at least in the [Desktop Entry] section (you may want to keep the other Exec directives aligned to ensure Chrome will behave the same way no matter what menu entry you use to start it):

Adjust proxyURL and proxyPORT as needed; don't forget to set proxyURL for both the --proxy-server and --host-resolver-rules options.

Most likely, your attempt at editing google-chrome.desktop didn't work because that file has more than one Exec entry, and the one you changed wasn't the one that is actually used.

Using the Chrome package for Debian from Google's repository, google-chrome.desktop shows three Exec entries in three distinct sections (groups, in freedesktop.org's nomenclature):

The one with the --incognito option—likely the one you edited—is only executed when you select "New Incognito Window" from a context menu (e.g. after right clicking on Chrome's icon in GNOME Activities).

And then edit the Exec entry, at least in the [Desktop Entry] group (you may want to keep the other Exec entries aligned to ensure Chrome will behave the same way no matter what menu entry you used to start it):

Adjust proxyURL and proxyPORT as needed; don't forget to set proxyURL for both the --proxy-server and --host-resolver-rules options.

If you want the default opening action to run Chrome without setting any proxy, you may leave the main [Desktop Entry]'s Exec entry untouched and add an action instead. It requires you to

  1. add a name for a new action to the Actions key in the [Desktop Entry] group;
  2. add a new action group.
[Desktop Entry] ... Actions=new-window;new-private-window;new-proxied-window; ... [Desktop Action new-proxied-window] Name=New Proxied Window Exec=/usr/bin/google-chrome-stable --proxy-server="socks5://proxyURL:proxyPORT" --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE proxyURL" %U 

"New Proxied Window" will then appear as an option when you right click on Chrome's icon (it may require a logout/login). Note that all the concurrently running instances of Chrome will share the same proxy settings of the first one you opened, unless you start them with the --user-data-dir option.

Apparently, talking about desktop files gave me some fixation on "directives"
Source Link
fra-san
  • 10.9k
  • 2
  • 27
  • 45

Most likely, your attempt at editing google-chrome.desktop didn't work because that file has more than one Exec directive, and the one you changed wasn't the one that is actually used.

Using the Chrome package for Debian from Google's repository, google-chrome.desktop shows three Exec directives in three distinct sections:

$ grep -E '^Exec|^\[|^Name=' /usr/share/applications/google-chrome.desktop [Desktop Entry] Name=Google Chrome Exec=/usr/bin/google-chrome-stable %U [Desktop Action new-window] Name=New Window Exec=/usr/bin/google-chrome-stable [Desktop Action new-private-window] Name=New Incognito Window Exec=/usr/bin/google-chrome-stable --incognito 

The one with the --incognito option—likely the one you edited—is only executed when you select "New Incognito Window" from a context menu (e.g. the application menu).

Unless your goal was to change the configuration for every user on your system, I suggest you to create your own, customized version of google-chrome.desktop:

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

And then edit the Exec directive, at least in the [Desktop Entry] section (you may want to keep the other Exec directives aligned to ensure Chrome will behave the same way no matter what menu entry you use to start it):

Exec=/usr/bin/google-chrome-stable --proxy-server="socks5://proxyURL:proxyPORT" --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE proxyURL" %U 

As noted by Dominik Matis in a comment, you may want to add the --host-resolver-rules directiveoption to prevent Chrome's DNS prefetcher from circumventing your proxy settings, as explained in the Chromium documentation.

Adjust proxyURL and proxyPORT as needed; don't forget to set proxyURL infor both the --proxy-server and --host-resolver-rules directivesoptions.

Most likely, your attempt at editing google-chrome.desktop didn't work because that file has more than one Exec directive, and the one you changed wasn't the one that is actually used.

Using the Chrome package for Debian from Google's repository, google-chrome.desktop shows three Exec directives in three distinct sections:

$ grep -E '^Exec|^\[|^Name=' /usr/share/applications/google-chrome.desktop [Desktop Entry] Name=Google Chrome Exec=/usr/bin/google-chrome-stable %U [Desktop Action new-window] Name=New Window Exec=/usr/bin/google-chrome-stable [Desktop Action new-private-window] Name=New Incognito Window Exec=/usr/bin/google-chrome-stable --incognito 

The one with the --incognito option—likely the one you edited—is only executed when you select "New Incognito Window" from a context menu (e.g. the application menu).

Unless your goal was to change the configuration for every user on your system, I suggest you to create your own, customized version of google-chrome.desktop:

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

And then edit the Exec directive, at least in the [Desktop Entry] section (you may want to keep the other Exec directives aligned to ensure Chrome will behave the same way no matter what menu entry you use to start it):

Exec=/usr/bin/google-chrome-stable --proxy-server="socks5://proxyURL:proxyPORT" --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE proxyURL" %U 

As noted by Dominik Matis in a comment, you may want to add the --host-resolver-rules directive to prevent Chrome's DNS prefetcher from circumventing your proxy settings, as explained in the Chromium documentation.

Adjust proxyURL and proxyPORT as needed; don't forget to set proxyURL in both the --proxy-server and --host-resolver-rules directives.

Most likely, your attempt at editing google-chrome.desktop didn't work because that file has more than one Exec directive, and the one you changed wasn't the one that is actually used.

Using the Chrome package for Debian from Google's repository, google-chrome.desktop shows three Exec directives in three distinct sections:

$ grep -E '^Exec|^\[|^Name=' /usr/share/applications/google-chrome.desktop [Desktop Entry] Name=Google Chrome Exec=/usr/bin/google-chrome-stable %U [Desktop Action new-window] Name=New Window Exec=/usr/bin/google-chrome-stable [Desktop Action new-private-window] Name=New Incognito Window Exec=/usr/bin/google-chrome-stable --incognito 

The one with the --incognito option—likely the one you edited—is only executed when you select "New Incognito Window" from a context menu (e.g. the application menu).

Unless your goal was to change the configuration for every user on your system, I suggest you to create your own, customized version of google-chrome.desktop:

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

And then edit the Exec directive, at least in the [Desktop Entry] section (you may want to keep the other Exec directives aligned to ensure Chrome will behave the same way no matter what menu entry you use to start it):

Exec=/usr/bin/google-chrome-stable --proxy-server="socks5://proxyURL:proxyPORT" --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE proxyURL" %U 

As noted by Dominik Matis in a comment, you may want to add the --host-resolver-rules option to prevent Chrome's DNS prefetcher from circumventing your proxy settings, as explained in the Chromium documentation.

Adjust proxyURL and proxyPORT as needed; don't forget to set proxyURL for both the --proxy-server and --host-resolver-rules options.

Source Link
fra-san
  • 10.9k
  • 2
  • 27
  • 45

Most likely, your attempt at editing google-chrome.desktop didn't work because that file has more than one Exec directive, and the one you changed wasn't the one that is actually used.

Using the Chrome package for Debian from Google's repository, google-chrome.desktop shows three Exec directives in three distinct sections:

$ grep -E '^Exec|^\[|^Name=' /usr/share/applications/google-chrome.desktop [Desktop Entry] Name=Google Chrome Exec=/usr/bin/google-chrome-stable %U [Desktop Action new-window] Name=New Window Exec=/usr/bin/google-chrome-stable [Desktop Action new-private-window] Name=New Incognito Window Exec=/usr/bin/google-chrome-stable --incognito 

The one with the --incognito option—likely the one you edited—is only executed when you select "New Incognito Window" from a context menu (e.g. the application menu).

Unless your goal was to change the configuration for every user on your system, I suggest you to create your own, customized version of google-chrome.desktop:

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

And then edit the Exec directive, at least in the [Desktop Entry] section (you may want to keep the other Exec directives aligned to ensure Chrome will behave the same way no matter what menu entry you use to start it):

Exec=/usr/bin/google-chrome-stable --proxy-server="socks5://proxyURL:proxyPORT" --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE proxyURL" %U 

As noted by Dominik Matis in a comment, you may want to add the --host-resolver-rules directive to prevent Chrome's DNS prefetcher from circumventing your proxy settings, as explained in the Chromium documentation.

Adjust proxyURL and proxyPORT as needed; don't forget to set proxyURL in both the --proxy-server and --host-resolver-rules directives.