Chromium

From ArchWiki
Revision as of 11:34, 5 July 2012 by Kynikos (Talk | contribs) (those packages are already mentioned at the proper place)

Jump to: navigation, search

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary link Template:Article summary link Differences from Google Chrome Template:Article summary heading Template:Article summary wiki Template:Article summary end

Chromium is an open source graphical web browser from Google, based on the WebKit rendering engine.

Installation

The stable version of Chromium can be installed from the official repositories via the chromium package.

There is also a development version which can be found in the AUR under the name of chromium-devAUR, as well as chromium-updateAUR which is an update script that installs or updates to the Chromium nightly builds. A binary version is chromium-browser-binAUR.

Note: Compiling chromium-beta or chromium-devAUR takes at least as long as compiling the Linux kernel.
Note: chromium-updateAUR installs nightly builds of Chromium which are pre-compiled by the Chromium Buildbot server.

There are also some packages in the AUR which provide the binary version of Google Chrome which can be found here.

See this article and this for an explanation of the differences between the three flavours, Chromium vs. Chrome, and the version numbers.

Configuration

File associations

Unlike Firefox, Chromium does not maintain its own database of mimetype-to-application associations. Instead, it relies on Xdg-open to open files and other mime types, for example, magnet links. See Xdg-open for more information.

There are exceptions to this rule though. In the case of mailto URIs chromium calls out to xdg-email which is similar to xdg-open. Other protocol handlers may have equivalent scripts so check /usr/bin/xdg*.

The behaviour of both is broken in places when used in an environment that is not one of the major four or five: gnome, kde, xfce and lxde. Usually this behaviour can be fixed by tricking them into thinking that they are operating in one of the supported desktop environments. Depending on your environment one may work and another won't so trying each is recommended. It has been reported that desktop environment can be set as an environment variable:

export DE=INSERT_DE_HERE

where the recognised DEs are: gnome, kde, xfce and lxde. Put it somewhere like ~/.xinitrc. This might impact on other things though.

An alternative is to edit the script: xdg-open or xdg-email to hardcode a useful DE. At the bottom of the file you will see something like this:

detectDE
if [ x"$DE" = x"" ]; then
   DE=generic
fi
# if BROWSER variable is not set, check some well known browsers instead
if [ x"$BROWSER" = x"" ]; then
   BROWSER=links2:links:lynx:w3m
   if [ -n "$DISPLAY" ]; then
       BROWSER=firefox:mozilla:epiphany:konqueror:chromium-browser:google-chrome:$BROWSER
   fi
fi
case "$DE" in
   kde)
   open_kde "$url"
   ;;
   gnome*)
   open_gnome "$url"
   ;;
   xfce)
   open_xfce "$url"
   ;;
   lxde)
   open_lxde "$url"
   ;;
   generic)
   open_generic "$url"
   ;;
   *)
   exit_failure_operation_impossible "no method available for opening '$url'"
   ;;
esac

change the 3rd line: DE=generic to one of the DEs eg DE=gnome.

An approach which is less useful is to place the required application in the default browser list:

   BROWSER=links2:links:lynx:w3m
   if [ -n "$DISPLAY" ]; then
       BROWSER=firefox:mozilla:epiphany:konqueror:chromium-browser:google-chrome:$BROWSER
   fi

Xdg-open and xdg-email fall back to this list of browsers and will use the first that they find to attempt to open the uri. You could add the name of the application to the beginning of the list. However there is no guarantee that the application will be called correctly to meet your needs eg your mail client will open but no compose window with the mailto address. Also it will only work for one application.

The problem with these approaches is that the changes are lost when these utilities are upgraded.

A fourth option is to make a softlink from your preferred application to one of the names on the browser list. This approach has the same problems as the previous work around. These ideas came from a [bbs discussion]

Font Rendering

Chromium is now supposed to use the settings in ~/.fonts.conf, though you may have to edit it manually (see Font Configuration). If the fonts are still rendered badly, you can use Xft settings as suggested here. Create ~/.Xresources if it does not exist and add in:

~/.Xresources
...

! Xft settings ---------------------------------------------------------------

Xft.dpi:        96
Xft.antialias:  true
Xft.rgba:       rgb
Xft.hinting:    true
Xft.hintstyle:  hintslight

...

Then update the X Resources database using:

xrdb -merge ~/.Xresources
Note: These settings will affect any application that uses X Resources for font settings; one example is rxvt-unicode.

Non-Latin characters

Install needed fonts to correctly display Chinese, Japanese, Korean characters. For example, Install ttf-arphic-uming, available in the Official Repositories.

For more, see the Font Packages for detailed instructions.

Default browser

The simplest way to make Chromium the default browser is to set variable $BROWSER=chromium in ~/.profile

if [ -n "$DISPLAY" ]; then
     BROWSER=chromium
fi

To test if this were conducted successfully, type this into your terminal:

$ xdg-open http://google.com

If everything went perfect, either a new tab inside Chromium, or a new window would open and display the Google homepage, depending on your settings.

Another option, when using mimeo, is to associate "http://" links with chromium:

~/.config/mimeo.conf
/usr/bin/chromium
  ^http://

If all of that still does not get it working, you can try adding the following to the [Added Associations] list in ~/.local/share/applications/mimeapps.list

x-scheme-handler/http=chromium.desktop

For more info, see Xdg-open.

Flash Player

All one needs to do is to install the flashplugin package and restart Chromium.

If you wish to use Flash Player using Pepper API, you can install chromium-pepper-flashAUR, chromium-pepper-flash-stableAUR or chrome-pepper-flashpluginAUR from AUR and enable only the flash plugin with location /usr/lib/PepperFlash/libpepflashplayer.so in chrome://plugins.

Open PDF files inside Chromium

There are two ways to do this: The first one by using Google Chrome's own PDF rendering plugin, the second by allowing Chromium access to e.g. Evince via the mozplugger plugin. KDE users can also choose KParts Plugin and use any installed KDE application as an embedded viewer.

libpdf.so

libpdf is Google's own implementation of a PDF renderer. While compatible, it is currently only part of Chrome releases, not Chromium ones.

The easiest way to add it to the latter is using one of the packages provided in the AUR — chromium-stable-libpdfAUR for the stable version of the browser, or for the dev version either chromium-libpdfAUR if your Chromium package installed to /usr/lib/chromium or chromium-browser-libpdfAUR if it installed to /opt/chromium-browser.

To do it manually, download a Google Chrome release that corresponds to the version of Chromium you use:

$ wget https://dl-ssl.google.com/linux/direct/google-chrome-stable_current_i386.deb
$ wget https://dl-ssl.google.com/linux/direct/google-chrome-unstable_current_i386.deb
$ wget https://dl-ssl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
$ wget https://dl-ssl.google.com/linux/direct/google-chrome-unstable_current_amd64.deb

Extract the deb file with

$ ar vx <deb-file>

Extract LZMA archive with

$ tar -xJf <lzma-file>

Move libpdf.so from opt/google/chrome/ to the appropriate directory as stated above. A change of its file permissions and ownership may be necessary (the permission of libpdf.so should be 755).

Start Chromium and open about:plugins. "Chrome PDF Viewer" should now view; it may need to be enabled.

Note: As a new version of Chromium will not update libpdf.so it may become incompatible. Thus and with respect to possible security fixes it is advisable to update both at the same time.

mozplugger

To use mozplugger, install mozplugger-chromiumAUR from AUR. Follow similar instructions as described in Firefox Tweaks to set up the PDF app you wish to use with mozplugger-chromium.

kpartsplugin

To use KParts Plugin, install kpartsplugin. The plugin should be able, among other things, to open PDF files inside Chromium using an embedded Okular instance.

Certificates

Chromium uses NSS for the certificate management. Certificates can be managed (including added) by going to Wrench -> Preferences -> Under the Hood -> Manage Certificates.

Tips and Tricks

This section has been distilled out into a discrete Chromium_Tips_and_Tweaks article.

Troubleshooting

Proxy Settings

Proxy settings do not work properly. Especially when used through the KDE interface. A good method as of now is to use the command line options like --proxy-pac-url and --proxy-server

Default profile

If you cannot get your default profile when you try to run chromium:

$ chromium
[2630:2630:485325611:FATAL:chrome/browser/browser_main.cc(755)] Check failed: profile. 
Cannot get default profile. Trace/breakpoint trap

Just correct the owner of the directory ~/.config/chromium, and it will work.

$sudo chown -R yourusername:yourusergroup /home/yourusername/.config/chromium

WebGL

Sometimes, Chromium will disable WebGL with certain graphics card configurations. This can generally be remedied by typing about:flags into the URL bar and enabling the the WebGL flag. You may also enable WebGL by passing the command line flag --enable-webgl to Chromium in the terminal.

There is also the possibility that your graphics card has been blacklisted by Chromium. To override this, pass the flag --ignore-gpu-blacklist to the chromium command.