Difference between revisions of "Chromium"
m (Certificates can be added via browser preferences.)
(→Tips and tricks: Added Cache in tmpfs)
|Line 189:||Line 189:|
# pacman -S gnome-icon-theme
# pacman -S gnome-icon-theme
=== Profile in tmpfs ===
=== Profile in tmpfs ===
Revision as of 11:38, 9 August 2011
Chromium is an open source graphical web browser from Google, based on the WebKit rendering engine.
- 1 Installation
- 2 Configuration
- 3 Tips and tricks
- 4 Troubleshooting
- 5 Resources
The stable version of chromium can be installed from the official repository by:
# pacman -S chromium
There are also some packages in the AUR which provide the binary version of Google Chrome.
See this article for an explanation of the differences between the three flavours, Chromium vs. Chrome, and the version numbers.
Displaying various non-latin scripts
To correctly display Chinese, Japanese, Korean... etc characters, see here for detailed instructions to install various TrueType fonts.
Using chromium with no desktop environment
Unlike Firefox, chromium does not maintain its own database of mimetype-to-application associations. Instead, it relies on Template:Filename (part of extra/xdg-utils) to open files and, for example, magnet links.
Inside a desktop environment (e.g. Gnome, or Kde, or Xfce), Template:Filename simply passes the arguments to that desktop environment's file-opener application (Template:Filename, Template:Filename, or Template:Filename, respectively), which means that the associations are left up to the desktop environment.
However, when no desktop environment is detected (for example when one runs a standalone window manager, e.g. Openbox), Template:Filename's behaviour becomes rather strange and annoying: many filetypes opened in firefox or chromium itself, no support for magnet links, etc.
There are a number of possible solutions to this problem, outlined below.
- Improve xdg-open, make it smarter (aka "patches welcome" :P )
- Use part of a desktop environment, specifically, the part which includes the file opener; for gnome, that would be 'libgnome' (and its dependencies), for xfce, 'exo'. The $DE environment variable needs to be exported before starting the window manager. For example:
- Use mimeo (written by an arch (trusted) user) and xdg-utils-mimeo, which replaces extra/xdg-utils and contains a Template:Filename script patched to make use of Template:Filename the same way Template:Filename would be used. Mimetype<->application associations can then be customised easily in Template:Filename or Template:Filename
- Use pcmanfm file associations (eg. for lxde desktop enviroment users). Change:
or modify your .profile
- When using openbox and no Desktop Environment (=DE) like KDE, GNOME or XFCE do following:
Attention: Do not export any DE environment variable !
Then, you basically have to fill the ~/.local/share/applications/defaults.list file with default associations. As this can be painful, some utilities are available:
- xdg-mime: not that intuitive; e.g. to use xpdf as default pdf viewer:
$ xdg-mime default xpdf.desktop application/pdf
- mimetype (perl-file-mimeinfo package): more intuitive; e.g. to select default application for a given extension (you need a sample file):
$ mimetype -d file.extension
This should create an entry in your local mime database:
Restart chromium and your pdf files should be opened with xpdf now. For me it only worked as normal user - as root I had problems cause no directories for the local mime times were created. See also this thread .
You could also try installing perl-file-mimeinfo
Chromium is now supposed to use the settings in Template:Filename, 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. Just create Template:Filename if it doesn't exist and add in:
! Xft settings --------------------------------------------------------------- Xft.dpi: 96 Xft.antialias: true Xft.rgba: rgb Xft.hinting: true Xft.hintstyle: hintslight
The simpliest way to make chromium the default browser is to set variable $BROWSER=chromium in ~/.profile
if [ -n "$DISPLAY" ]; then BROWSER=chromium fi
The other way is to edit the xdg-open script.
$ sudo $YOUR_EDITOR /usr/bin/xdg-open
At almost the bottom on the file, is a long horizontal list of browsers:
if [ x"$DE" = x"" ]; then # 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 DE=generic fi
Add chromium: (mind the colon which separates the entries) before firefox:mozilla: ... and save. 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: Template:File
If all of that still doesn't get it working, you can try adding the following to the "[Added Associations]" list in ~/.local/share/applications/mimeapps.list
If running i686 Arch Linux, all one needs to do is to install the flash plugin and restart chromium:
# pacman -S flashplugin
For x86_64, one needs to enable the new [multilib] repository.
# pacman -S flashplugin
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. Adobe Reader via the mozplugger plugin. KDE users can also choose KParts Plugin and use any installed KDE application as an embedded viewer.
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-libpdf for the stable version of the browser, or for the dev version either chromium-libpdf if your Chromium package installed to Template:Filename or chromium-browser-libpdf if it installed to Template:Filename.
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>
Move the file 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.
To use KParts Plugin, install kpartsplugin from AUR. The plugin should be able, among other things, to open PDF files inside Chromium using an embedded Okular instance.
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
Controlling Memory Usage
- Chromium offers some command-line options to help control how efficient it is with system memory, by determining how often it should release memory back to the operating system. It is done with the flag --memory-model=X, where X is either high, medium, or low. Setting it to high makes chromium never release memory. Medium makes it reduce its working set of the memory when switching tabs, and low makes it reduce its working set when switching tabs and when the browser is not actively being used. In my experience, running chromium with --memory-model=low can actually improve performance as well, though your mileage may vary. --Falcata 06:07, 26 November 2010 (EST)
Icons not shown in download tab
You may find that Chromium shows icon placeholders (icons representing broken documents) instead of appropriate icons in its download tab. The likely cause is that you have not installed a desktop environment.
Remedy this by installing Gnome icons:
# pacman -S gnome-icon-theme
Cache in tmpfs
For SSD users, it is nice to have the cache of chromium in a tmpfs, but there is no need to have the whole profile in a tmpfs (see below). Someone posted here a solution for this.
Close Chromium before starting! Replace your_user with your username.
Add following to /etc/fstab:
cache-chromium /home/your_user/.cache/chromium tmpfs defaults,noatime,mode=1777 0 0
Then delete & recreate the cache folder of chromium:
rm -r /home/your_user/.cache/chromium mkdir /home/your_user/.cache/chromium
Restart your machine or do sudo mount -a
Afterwards Chromium's cache should be in ram. You can check that with df -h.
There is also a commandline parameter for placing the cache somewhere else:
This could be another solution, if /tmp is in ram for example.
Profile in tmpfs
The default Chromium profile is located in Template:Filename. This profile can be relocated to an available tmpfs filesystem, including /tmp, or /dev/shm for improvements in application response as the the entire profile is now stored in RAM. Another benefit is a reduction in disk read and write operations, of which SSDs benefit the most.
Simple bash script to automate the process
Use the following bash script to automatically move your chromium profile to /dev/shm and keep it sync'ed.
#!/bin/bash STATIC=$HOME/.config/chromium-backup LINK=$HOME/.config/chromium VOLATILE=/dev/shm/.chromium [[ ! -d $VOLATILE/cache ]] && mkdir -p $VOLATILE/cache [[ ! -h $HOME/.cache/chromium ]] && ln -s $VOLATILE/cache $HOME/.cache/chromium [[ -r $VOLATILE ]] || install -dm755 $VOLATILE if [[ `readlink $LINK` != $VOLATILE ]]; then mv $LINK $STATIC ln -s $VOLATILE $LINK fi if [[ -e $LINK/.flagged ]]; then rsync -a --delete --exclude .flagged $LINK/ $STATIC/ else rsync -a $STATIC/ $LINK/ touch $LINK/.flagged fi
Don't forget to make it executable:
$ chmod +x $HOME/bin/sync-chromium
Call the script at login by copying the following to your $HOME/.config/autostart
[Desktop Entry] Type=Application Exec=$HOME/bin/sync-chromium Hidden=false Name=ff-sync
Add a cron job to keep it updated
$ crontab -e
Add a line to start the script every 30 minutes,
*/30 * * * * ~/bin/sync-chromium
or add the following to do so every 2 hours:
0 */2 * * * ~/bin/sync-chromium
Add an entry to /etc/rc.local.shutdown
Finally, a line to Template:Filename will keep your profile sync'ed when the machine is shutdown.
# echo "su user -c /home/user/bin/sync-chromium" >> /etc/rc.local.shutdown
Enabling experimental features
To enable experimental features of Chromium like WebGL and rendering webpages through GPU, type "about:flags" in Chromium address bar and enable features you want.
You can make sites like wiki.archlinux.org and wikipedia.org easily searchable by first executing a search on those pages, then going to Options>Preferences>Basics and clicking "Manage" in the "Default Search" section. You can then, for example, "Edit" the Wikipedia entry and change its keyword to "w". Then, you can search Wikipedia for "Arch Linux" from the address bar by simply entering "w arch linux". "?" is a hard-coded keyword for Google search (it will behave differently from the other keywords). It allows you to easily search for things like "/bin/bash".
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 Template:Filename, and it will work.
$sudo chown -R yourusername:yourusergroup /home/yourusername/.config/chromium