How to set CLI flags for Google Chrome?
Solution 1
Look in /opt/google/chrome/google-chrome.desktop
or /usr/share/applications/google-chrome.desktop
for the following line:
Exec=/opt/google/chrome/google-chrome %U
Add the flag you need in there, save it, then run Chrome again and pin it to your launcher, that should do the trick.
Solution 2
A way is to set flags in the environment variable CHROMIUM_USER_FLAGS
:
export CHROMIUM_USER_FLAGS="insert_content_here"
Solution 3
For xubuntu/xfce4, though it might work similarly elsewhere:
cp /usr/share/applications/google-chrome.desktop ~/.local/share/applications/google-chrome.desktop
and modify the three Exec=
lines in ~/.local/share/applications/google-chrome.desktop
to include the arguments you want. Because it has the same filename, xfce4-whiskermenu will pick up only your modified google-chrome.desktop
.
If Chrome is your default browser, another application opening a URL will still cause Chrome to launch without your arguments. To fix this, create a new file ~/bin/google-chrome
with these contents:
/usr/bin/google-chrome YOUR_EXTRA_ARGS "$@"
and chmod +x ~/bin/google-chrome
. Then, in Preferred Applications, set your Web Browser to Other... and enter:
/home/YOUR_USERNAME/bin/google-chrome "%s"
Also, to avoid having to change the arguments in four places in the future, you can point the Exec=
lines in google-chrome.desktop
to your /home/YOUR_USERNAME/bin/google-chrome
.
Solution 4
I'm running Xubuntu and I was trying to figure this one out as well. I tried the solution to edit the .desktop file. I haven't updated, but I have the same concern as you (will it get overwritten). I tried a different option where I added an alias to my .bashrc file.
alias chromium-browser="/usr/bin/chromium-browser [FLAGS]"
Solution 5
For chromium, you can create a script in /etc/chromium-browser/customizations
For instance i have a script with one line
CHROMIUM_FLAGS="${CHROMIUM_FLAGS} --enable_hidpi=1 --process-per-site"
I imagine chrome has something similar.
Related videos on Youtube
Admin
Updated on September 18, 2022Comments
-
Admin over 1 year
Where can I set CLI flags for Google Chrome on Unity?
-
Simon over 12 yearsDo you mean how to set command line options for Chrome?
-
-
Guilherme over 12 yearsI want the flag to be used every time I open Google Chrome from launcher.
-
Guilherme over 12 yearsIsn't there just a .desktop file somewhere that I can edit?
-
Aaron Hill over 12 yearsI am not currently aware of a .desktop file you can edit. I would suggest you use Unity Launcher Editor as explained above to add CLI flags to the Google Chrome Launcher icon.
-
Vaibhav Mishra over 11 yearssome problem with the project, answer need to be updated
-
Dragon warrior about 11 years...just until the next upgrade overwrites it :(
-
user.dz over 8 yearsThis could be flagged as low quality. It will better if you can add a reference for this?
-
David Foerster over 8 yearsWelcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.)
-
Ivan Kozik over 8 yearsThis makes dpkg error out on upgrades of Chrome.
unable to make backup link of './usr/share/applications/google-chrome.desktop' before installing new version: Operation not permitted
followed bydpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
-
Ivan Kozik over 8 years
CHROMIUM_USER_FLAGS
seems to have no effect on Chrome 46. -
matt2000 over 8 yearsRun
sudo chattr -a /usr/share/applications/google-chrome.desktop
then do the dpkg update, then re-do the steps above. -
jesjimher about 6 yearsThis should be the accepted answer. It persists between package updates and doesn't involve any desktop file hackery.
-
Rick James almost 3 yearsInstall
menulibre
as a way to get to the "launcher".