Difference between revisions of "Dwb"

From ArchWiki
Jump to: navigation, search
(Troubleshooting.)
(Extensions: the youtube_html5-extension does not exist anymore)
(18 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 
[[Category:Web Browser]]
 
[[Category:Web Browser]]
[[tr:DWB]]
+
{{Article summary start}}
 
+
{{Article summary text|This article addresses the steps necessary to run and configure dwb.}}
[http://portix.bitbucket.org/dwb/ DWB] is an extremely fast, lightweight and flexible web browser using the webkit engine.
+
{{Article summary end}}
 +
[[tr:dwb]]
 +
{{DISPLAYTITLE:dwb}}
 +
[http://portix.bitbucket.org/dwb/ dwb] is an extremely fast, lightweight and flexible web browser using the webkit engine.
 
It is customizable through  its web interface and fully usable with keyboard shortcuts.
 
It is customizable through  its web interface and fully usable with keyboard shortcuts.
  
 
== Installation ==
 
== Installation ==
 
The {{Pkg|dwb}} package can be found in the [[Official Repositories|official repositories]] and can be installed with [[pacman]].
 
The {{Pkg|dwb}} package can be found in the [[Official Repositories|official repositories]] and can be installed with [[pacman]].
 
+
# pacman -S dwb
There is also various development versions available in the AUR:
+
There are also other versions in the [[AUR]]: {{AUR|dwb-hg}}, {{AUR|dwb-gtk3}}, and {{AUR|dwb-gtk3-hg}}.
the [https://aur.archlinux.org/packages.php?ID=36050 development version],
+
the [https://aur.archlinux.org/packages.php?ID=51874 GTK3 version],
+
and the [https://aur.archlinux.org/packages.php?ID=59201 development GTK3 version].
+
  
 
== Basic usage ==
 
== Basic usage ==
Line 27: Line 27:
 
Almost everything can be configured from the ''Settings'' page. You can access it with {{keypress|S}}{{keypress|s}} by default.
 
Almost everything can be configured from the ''Settings'' page. You can access it with {{keypress|S}}{{keypress|s}} by default.
  
The configuration files are stored in {{ic|$XDG_CONFIG_HOME/dwb/}}.
+
The configuration files are stored in {{ic|$XDG_CONFIG_HOME/dwb/}} (usually {{ic| ~/.config/dwb/}}).
  
 
=== Search engines ===
 
=== Search engines ===
Line 37: Line 37:
 
The first entry in {{ic|$XDG_CONFIG_HOME/dwb/searchengines}} will be the default search engine.
 
The first entry in {{ic|$XDG_CONFIG_HOME/dwb/searchengines}} will be the default search engine.
  
{{Note|If you are always searching for ''undefined'' even with the {{ic|searchengine-submit-pattern}} option set, then you should edit {{ic|$XDG_CONFIG_HOME/dwb/searchengines}} and adapt the URIs to match your {{ic|searchengine-submit-pattern}}.}}
+
=== Custom keybinds ===
 +
 
 +
You can create custom key bindings by editing file {{ic|custom_keys}} in the profile directory. This is
 +
{{ic|~/.config/dwb/default}} by default. All keysyms which don't emit (multi)byte characters, must be enclosed in {{ic|@}}. One keybind can execute multiple dwb commands. These commands execute in same order as they are defined in bind, and must be separated by {{ic|;;}} separator. If the keybind's chord is already bound by dwb, it might be ignored (behaviour is not consistent). In such case one can try to check, whether there is collison with binds defined in {{ic|~/.config/dwb/keys}} and try to unbind the chord there (eg set it to nothing). Any running dwb instance will owerwrite {{ic|keys}} file on exit, so remember to do your modifications while dwb is not runing or use default dwb interface (''S k'').
 +
 
 +
{{hc|~/.config/dwb/default/custom_keys|<nowiki>
 +
Control w          :close_tab
 +
Control @Page_Up@  :focus_prev
 +
Control @Page_Down@ :focus_next
 +
</nowiki>}}
  
 
== Extensions ==
 
== Extensions ==
  
DWB features an extension manager as a separate executable, ''dwbem''.
+
dwb features an extension manager as a separate executable, ''dwbem''. To list all officially available extensions, use:
You can use it to install various extension. For example
+
  
  $ dwbem -i youtube_html5
+
  $ dwbem -a
  
will make DWB  play all Youtube videos using an HTML5 player instead of the Flash player.
+
Read the [[man page]] for more details.
  
Use
+
=== Adblock ===
  
$ dwbem -a
+
dwb features an Adblock extension. Install it with
  
to list all officially available extensions.
+
$ dwbem -i adblock_subscriptions
  
Read the man page for more details.
+
Restart dwb, use the ''adblock_subscribe'' command and choose your favorite lists of filters.
  
  $ man dwbem
+
== Userscripts ==
 +
dwb can execute .js or .sh scripts put in {{ic|~/.config/dwb/userscripts/}}. Make sure they are executable:
 +
  chmod +x ~/.config/dwb/userscripts/myscript.js
  
=== Adblock ===
+
Below are some example scripts:
 +
===startup-noautoreload===
 +
Prevents previously-opened tabs from reloading all at once after a restart.
 +
{{hc|~/.config/dwb/userscripts/startup-noautoreload.js|<nowiki>
 +
//!javascript
 +
// prevents previously-opened tabs from reloading all at once after a restart.
 +
execute("set load-on-focus true");
  
DWB features an Adblock extension. Install it with
+
var sigId = signals.connect("navigation", function(wv) {
 +
        if (wv == tabs.current)
 +
        {
 +
                    execute("set load-on-focus false");
 +
                            signals.disconnect(sigId);
 +
                                }
 +
});</nowiki>}}
  
$ dwbem -i adblock_subscriptions
+
===youtube-mplayer===
 +
Opens YouTube videos with mplayer (requires {{pkg|mplayer}} and {{pkg|youtube-dl}}).
 +
{{hc|~/.config/dwb/userscripts/youtube-mplayer.js|<nowiki>
 +
//!javascript
 +
// opens YouTube videos with mplayer.
 +
var regex = new RegExp("http(.*)://www.youtube.com/watch\\?(.*&)*v=.*");
  
Restart DWB, use the ''adblock_subscribe'' command and choose your favorite lists of filters.
+
signals.connect("navigation", function (wv, frame, request) {
 +
  if (wv.mainFrame == frame && regex.test(request.uri))
 +
    system.spawn("sh -c 'mplayer \"$(youtube-dl -g " + request.uri + ")\"'");
 +
  return false;
 +
});</nowiki>}}
 +
 
 +
==Stylesheets==
 +
Stylesheets can be defined in the Settings page under '''user-stylesheet-uri'''<nowiki>
 +
file:///home/tux/.config/dwb/stylesheet.css</nowiki>
  
 
== Troubleshooting ==
 
== Troubleshooting ==
Line 71: Line 106:
  
 
Make sure you have the following GStreamer packages installed:
 
Make sure you have the following GStreamer packages installed:
{{bc|
+
# pacman -S --needed gstreamer0.10 gstreamer0.10-bad gstreamer0.10-bad-plugins gstreamer0.10-base gstreamer0.10-base-plugins gstreamer0.10-good gstreamer0.10-good-plugins gstreamer0.10-ugly gstreamer0.10-ugly-plugins
gstreamer0.10
+
 
gstreamer0.10-bad
+
=== Search engines always search for ''undefined'' ===
gstreamer0.10-bad-plugins
+
 
gstreamer0.10-base
+
If you are always searching for ''undefined'' even with the {{ic|searchengine-submit-pattern}} option set, then you should edit {{ic|$XDG_CONFIG_HOME/dwb/searchengines}} and adapt the URIs to match your {{ic|searchengine-submit-pattern}}.
gstreamer0.10-base-plugins
+
 
gstreamer0.10-good
+
=== Fuzzy font in Github ===
gstreamer0.10-good-plugins
+
 
gstreamer0.10-ugly
+
Add this in your ~/.config/fontconfig/fonts.conf inside the fontconfig-tags:
gstreamer0.10-ugly-plugins}}
+
 
 +
  <selectfont>
 +
    <rejectfont>
 +
      <pattern>
 +
        <patelt name="family">
 +
          <string>Clean</string>
 +
        </patelt>
 +
      </pattern>
 +
    </rejectfont>
 +
  </selectfont>

Revision as of 16:25, 28 April 2013

Template:Article summary start Template:Article summary text Template:Article summary end

dwb is an extremely fast, lightweight and flexible web browser using the webkit engine. It is customizable through its web interface and fully usable with keyboard shortcuts.

Installation

The dwb package can be found in the official repositories and can be installed with pacman.

# pacman -S dwb

There are also other versions in the AUR: dwb-hgAUR, dwb-gtk3AUR, and dwb-gtk3-hgAUR.

Basic usage

Starting from a fresh configuration, use Template:KeypressTemplate:Keypress to open the Keys page. As you can see from there, most bindings are borrowed from Vim and Emacs.

Use Template:Keypress to access the command prompt. You can use Template:Keypress to auto-complete.

Read the man page for more details.

$ man dwb

Configuration

Almost everything can be configured from the Settings page. You can access it with Template:KeypressTemplate:Keypress by default.

The configuration files are stored in $XDG_CONFIG_HOME/dwb/ (usually ~/.config/dwb/).

Search engines

Use Template:KeypressTemplate:Keypress to create a search engine from the first input field on the web page. Use Template:Keypress to switch between fields. Then enter a keyword.

Now you can use the keyword in the URI prompt to search directly on the corresponding website.

The first entry in $XDG_CONFIG_HOME/dwb/searchengines will be the default search engine.

Custom keybinds

You can create custom key bindings by editing file custom_keys in the profile directory. This is ~/.config/dwb/default by default. All keysyms which don't emit (multi)byte characters, must be enclosed in @. One keybind can execute multiple dwb commands. These commands execute in same order as they are defined in bind, and must be separated by ;; separator. If the keybind's chord is already bound by dwb, it might be ignored (behaviour is not consistent). In such case one can try to check, whether there is collison with binds defined in ~/.config/dwb/keys and try to unbind the chord there (eg set it to nothing). Any running dwb instance will owerwrite keys file on exit, so remember to do your modifications while dwb is not runing or use default dwb interface (S k).

~/.config/dwb/default/custom_keys
Control w           :close_tab
Control @Page_Up@   :focus_prev
Control @Page_Down@ :focus_next

Extensions

dwb features an extension manager as a separate executable, dwbem. To list all officially available extensions, use:

$ dwbem -a

Read the man page for more details.

Adblock

dwb features an Adblock extension. Install it with

$ dwbem -i adblock_subscriptions

Restart dwb, use the adblock_subscribe command and choose your favorite lists of filters.

Userscripts

dwb can execute .js or .sh scripts put in ~/.config/dwb/userscripts/. Make sure they are executable:

chmod +x ~/.config/dwb/userscripts/myscript.js

Below are some example scripts:

startup-noautoreload

Prevents previously-opened tabs from reloading all at once after a restart.

~/.config/dwb/userscripts/startup-noautoreload.js
//!javascript
// prevents previously-opened tabs from reloading all at once after a restart.
execute("set load-on-focus true");

var sigId = signals.connect("navigation", function(wv) {
        if (wv == tabs.current)
        {
                    execute("set load-on-focus false");
                            signals.disconnect(sigId);
                                }
});

youtube-mplayer

Opens YouTube videos with mplayer (requires mplayer and youtube-dl).

~/.config/dwb/userscripts/youtube-mplayer.js
//!javascript 
// opens YouTube videos with mplayer.
var regex = new RegExp("http(.*)://www.youtube.com/watch\\?(.*&)*v=.*");

signals.connect("navigation", function (wv, frame, request) {
  if (wv.mainFrame == frame && regex.test(request.uri)) 
    system.spawn("sh -c 'mplayer \"$(youtube-dl -g " + request.uri + ")\"'");
  return false;
});

Stylesheets

Stylesheets can be defined in the Settings page under user-stylesheet-uri file:///home/tux/.config/dwb/stylesheet.css

Troubleshooting

HTML5 audio and video does not work

Make sure you have the following GStreamer packages installed:

# pacman -S --needed gstreamer0.10 gstreamer0.10-bad gstreamer0.10-bad-plugins gstreamer0.10-base gstreamer0.10-base-plugins gstreamer0.10-good gstreamer0.10-good-plugins gstreamer0.10-ugly gstreamer0.10-ugly-plugins

Search engines always search for undefined

If you are always searching for undefined even with the searchengine-submit-pattern option set, then you should edit $XDG_CONFIG_HOME/dwb/searchengines and adapt the URIs to match your searchengine-submit-pattern.

Fuzzy font in Github

Add this in your ~/.config/fontconfig/fonts.conf inside the fontconfig-tags:

 <selectfont>
   <rejectfont>
     <pattern>
       <patelt name="family">
         <string>Clean</string>
       </patelt>
     </pattern>
   </rejectfont>
 </selectfont>