You are not logged in.

#476 2012-01-10 15:46:23

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: dwb - a webkit web browser

Grabbing https://easylist-downloads.adblockplus.org/easylist.txt
Removed 128 unsupported of 16558 filters.

.. Just gotta say that this browser just blows my mind, and also when thinking about that it's a 1 man project! smile

Thank you portix; you rock!

Offline

#477 2012-01-11 16:33:59

portix
Member
Registered: 2009-01-13
Posts: 757

Re: dwb - a webkit web browser

There are some changes in the latest revision, that probably need manual intervention. Some of the command names have changed, for user defined shortcuts it is necessary to modify the names in ~/.config/dwb/keys otherwise the shortcuts will be overwritten with the default ones. I created a script that does the conversion. Also the pass-through mode has been removed, insert mode now acts exactly like pass-through before and the syntax for shortcuts has slightly changed. Non printable keys must now be surrounded by @, e.g.

Control @F11@

and @ and \ must be escaped with \.

Offline

#478 2012-01-11 17:14:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: dwb - a webkit web browser

mhertz wrote:

... and also when thinking about that it's a 1 man project! smile

$ man 2 dwb
No manual entry for dwb in section 2

Yes, it would seem it is wink

Sorry, couldn't resist.  But I also love dwb - great work.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#479 2012-01-11 17:41:18

bloom
Member
Registered: 2010-08-18
Posts: 749
Website

Re: dwb - a webkit web browser

Great work!

A few observations:

If I go to the settings page and search for 'cookies' for example (or anything with a match in the value of one of the variables), when I reach the match inside a text entry, hitting 'n' doesn't lead me to the next match, but replaces the match by 'n' instead (and throws me out of Normal mode).

';F' don't seem to honor 'background-tabs': maybe it should?

I've set

#define HINT_SEARCH_SUBMIT "%s"

in dwb.h and it seems to work fine.

'space' works as 'C-f' without having to define a custom command now: that's great but can you give me a reference to the list of built-in webkit bindings?

It seems there is three different 'fg/bg' tab colors (even / odd normal and active?) but I only see an 'active' and a 'normal' setting and the 'normal' setting don't stick.

The only thing still preventing me from switching is the lack of user styles support (aka custom CSS): I like to be able to hide certain page elements and it seems the adblocking rules can't perform that (besides I'm already using an enhanced '/etc/hosts').

I'm thinking of using something like uzbl-ab instead but I'm not sure I'll be able to make it apply as early as a stylesheet?

Last edited by bloom (2012-01-11 17:53:02)


gh · da · ds

Offline

#480 2012-01-11 18:33:53

portix
Member
Registered: 2009-01-13
Posts: 757

Re: dwb - a webkit web browser

bloom wrote:

Great work!

A few observations:

If I go to the settings page and search for 'cookies' for example (or anything with a match in the value of one of the variables), when I reach the match inside a text entry, hitting 'n' doesn't lead me to the next match, but replaces the match by 'n' instead (and throws me out of Normal mode).

I will have a look into it.

bloom wrote:

';F' don't seem to honor 'background-tabs': maybe it should?

I think you are right, i will change it.

bloom wrote:

'space' works as 'C-f' without having to define a custom command now: that's great but can you give me a reference to the list of built-in webkit bindings?

I don't have a reference, most shortcuts are the default gtk shortcuts.

bloom wrote:

It seems there is three different 'fg/bg' tab colors (even / odd normal and active?) but I only see an 'active' and a 'normal' setting and the 'normal' setting don't stick.

I have added them to the settings page in the latest revision.
I'm not sure if the per site stylesheets will be implemented but i will think about it.

Edit: if you only want to hide elements with custom stylesheets, why not using the adblocker? You can only use element hiding rules in you filterlist and use /etc/hosts anyway.

Last edited by portix (2012-01-11 18:50:59)

Offline

#481 2012-01-11 20:37:48

bloom
Member
Registered: 2010-08-18
Posts: 749
Website

Re: dwb - a webkit web browser

I didn't know about CSS element hiding through adblock rules. I'll inspect.

Minor suggestion:

I wanted to remove the brackets around the tabs number in the tab bar and I think I found the relevant piece of code:

  char *escaped = g_markup_printf_escaped("[<span foreground='%s'>%d</span>]%c<span foreground='%s'>%s</span>%c %s%s", 
      dwb.color.tab_number_color,
      g_list_position(dwb.state.views, gl) + 1, 
      sep1,
      dwb.color.tab_protected_color,
      buf, 
      sep2,
      progress,
      uri ? uri : "about:blank");

?

But in my opinion, the color of the tab number is a sufficient visual distinction and I'd prefer to have the protected tab color applied to the tab number instead of having a '[p]' notification appended.

Last edited by bloom (2012-01-11 20:38:24)


gh · da · ds

Offline

#482 2012-01-11 21:46:40

portix
Member
Registered: 2009-01-13
Posts: 757

Re: dwb - a webkit web browser

bloom wrote:

I didn't know about CSS element hiding through adblock rules. I'll inspect.

dwb accepts adblock+ compatible filter rules. The syntax for element hiding rules is quite simple, it is described here.

bloom wrote:

Minor suggestion:

I wanted to remove the brackets around the tabs number in the tab bar and I think I found the relevant piece of code:

  char *escaped = g_markup_printf_escaped("[<span foreground='%s'>%d</span>]%c<span foreground='%s'>%s</span>%c %s%s", 
      dwb.color.tab_number_color,
      g_list_position(dwb.state.views, gl) + 1, 
      sep1,
      dwb.color.tab_protected_color,
      buf, 
      sep2,
      progress,
      uri ? uri : "about:blank");

?

But in my opinion, the color of the tab number is a sufficient visual distinction and I'd prefer to have the protected tab color applied to the tab number instead of having a '[p]' notification appended.

I'm not really satisfied with the tablabels now and i would prefer to make it fully customizable but i have no idea how this could be easily done.

Offline

#483 2012-01-11 23:11:54

portix
Member
Registered: 2009-01-13
Posts: 757

Re: dwb - a webkit web browser

bloom wrote:

But in my opinion, the color of the tab number is a sufficient visual distinction and I'd prefer to have the protected tab color applied to the tab number instead of having a '[p]' notification appended.

Protected tabs were indicated exactly in that way when they were introduced. It
was changed because it is also possible to lock an url and a domain for a tab
and this is indicated in the same way but maybe it makes more sense to indicate
the locked status in the statusbar.

Offline

#484 2012-01-12 16:03:49

bloom
Member
Registered: 2010-08-18
Posts: 749
Website

Re: dwb - a webkit web browser

portix wrote:

If you only want to hide elements with custom stylesheets, why not using the adblocker?

That's perfect!
I'll be switching soon.

— Tab label: maybe you could use something like '%i %n %t', where the %i represents the favicon, %n the tab number and %t the title. Hence anyone can decide what must be seen, in which order, using which separators, etc.

— New tab position: you might want to add a setting where one can choose from 'left, right, leftmost or rightmost'.

— Focus after tab deletion: once a tab is deleted, the focus might move to the previously selected tab, or to the nearest non visited tab, you might want to add a setting for this.

— I think I'll prefer to see the current URL left-aligned and maybe a setting for the color of the pointed URL is needed.

— How can I bind 'C-j' to 'return' and 'C-g' to 'esc' in the status/input bar?

— I generated an adblock list with the 'grab_adblocker' and I'm getting three warning regarding non supported 'background' and 'frame' rules.

— Could you add a setting to prevent flash content from loading if the related tab has not been focused yet (e.g. to prevent youtube videos from playing in the background)?

Last edited by bloom (2012-01-12 16:05:01)


gh · da · ds

Offline

#485 2012-01-12 16:41:13

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: dwb - a webkit web browser

The only thing I personally would love added to dwb, is the opera fast-forward/backwards option, which uses heuristics to find the next/previous links of a page.

I've heard mention of it being included in luakit, and so I hoped it was simply a userscript, that I could use in dwb, but I now see that it's a lua file, and I have no experience with lua whatsoever...

If anybody with the time and motivation could maybe translate the following lua file into a standard userscript, then I, and i'm guessing many others, would really appreciate it!

----------------------------------------------------------------
-- Follow "next" or "prev" links on a page                    --
-- © 2009 Aldrik Dunbar  (n30n)                               --
-- © 2010 Mason Larobina (mason-l) <mason.larobina@gmail.com> --
----------------------------------------------------------------

local go_next = [=[
(function() {
    var el = document.querySelector("[rel='next']");
    if (el) { // Wow a developer that knows what he's doing!
        location = el.href;
    }
    else { // Search from the bottom of the page up for a next link.
        var els = document.getElementsByTagName("a");
        var i = els.length;
        while ((el = els[--i])) {
            if (el.text.search(/(\bnext\b|^>$|^(>>|»)$|^(>|»)|(>|»)$|\bmore\b)/i) > -1) {
                location = el.href;
                break;
            }
        }
    }
})();
]=]

local go_prev = [=[
(function() {
    var el = document.querySelector("[rel='prev']");
    if (el) {
        location = el.href;
    }
    else {
        var els = document.getElementsByTagName("a");
        var i = els.length;
        while ((el = els[--i])) {
            if (el.text.search(/(\b(prev|previous)\b|^<$|^(<<|«)$|^(<|«)|(<|«)$)/i) > -1) {
                location = el.href;
                break;
            }
        }
    }
})();
]=]

-- Add `[[` & `]]` bindings to the normal mode.
local buf = lousy.bind.buf
add_binds("normal", {
    buf("^%]%]$", function (w) w:eval_js(go_next) end),
    buf("^%[%[$", function (w) w:eval_js(go_prev) end),
})

-- vim: et:sw=4:ts=8:sts=4:tw=80

Offline

#486 2012-01-12 17:05:49

bloom
Member
Registered: 2010-08-18
Posts: 749
Website

Re: dwb - a webkit web browser

mhertz wrote:

The only thing I personally would love added to dwb, is the opera fast-forward/backwards option, which uses heuristics to find the next/previous links of a page.

That's pretty straightforward: put this in $XDG_CONFIG_HOME/dwb/scripts/

function go_next() {
    var el = document.querySelector("[rel='next']");
    if (el) { // Wow a developer that knows what he's doing!
        location = el.href;
    }
    else { // Search from the bottom of the page up for a next link.
        var els = document.getElementsByTagName("a");
        var i = els.length;
        while ((el = els[--i])) {
            if (el.text.search(/(\bnext\b|^>$|^(>>|»)$|^(>|»)|(>|»)$|\bmore\b)/i) > -1) {
                location = el.href;
                break;
            }
        }
    }
}

function go_prev() {
    var el = document.querySelector("[rel='prev']");
    if (el) {
        location = el.href;
    }
    else {
        var els = document.getElementsByTagName("a");
        var i = els.length;
        while ((el = els[--i])) {
            if (el.text.search(/(\b(prev|previous)\b|^<$|^(<<|«)$|^(<|«)|(<|«)$)/i) > -1) {
                location = el.href;
                break;
            }
        }
    }
}

And then, put two shell scripts in $XDG_CONFIG_HOME/dwb/userscripts/:

#! /bin/bash
# dwb: ]]

echo 'open javascript:go_next()'
#! /bin/bash
# dwb: [[

echo 'open javascript:go_prev()'

Last edited by bloom (2012-01-12 17:08:02)


gh · da · ds

Offline

#487 2012-01-12 17:14:45

portix
Member
Registered: 2009-01-13
Posts: 757

Re: dwb - a webkit web browser

You can also use a custom command, when trying this i realised that this didn't work with javascript since the seperator for custom commands was a semicolon, custom commands must no be seperated with two semicolons. With this fix you can bind it with

]]:exja (function() {var el = document.querySelector("[rel='next']"); if (el) { location = el.href; } else { var els = document.getElementsByTagName("a"); var i = els.length; while ((el = els[--i])) { if (el.text.search(/(\bnext\b|^>$|^(>>|»)$|^(>|»)|(>|»)$|\bmore\b)/i) > -1) { location = el.href; break; } } }})();

You must only remove all newlines and all comments.

Edit or with blooms solution you can also define

]]:exja go_next();
[[:exja go_prev();

Edit2: A shorter version with removed whitespaces that uses ] and [ instead of ]] and [[

]:exja (function(){var e=document.querySelector("[rel='next']");if(e){location=e.href;}else{var f=document.getElementsByTagName("a");var i=f.length;while((e=f[--i])){if(e.text.search(/(\bnext\b|^>$|^(>>|»)$|^(>|»)|(>|»)$|\bmore\b)/i)>-1){location=e.href; break;}}}})();
[:exja (function(){var e=document.querySelector("[rel='prev']");if(e){location=e.href;}else{var f=document.getElementsByTagName("a");var i=f.length;while((e=f[--i])){if(e.text.search(/(\b(prev|previous)\b|^<$|^(<<|«)$|^(<|«)|(<|«)$)/i)>-1){location=e.href;break;}}}})();

Last edited by portix (2012-01-12 17:30:13)

Offline

#488 2012-01-12 18:18:20

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: dwb - a webkit web browser

Thanks alot bloom and portix; I really appreciate it!

Unfortunetly, it seems im a complete moron, as I cannot get either of your suggestions to work...

Hmm, gonna try to see if I can find out what i'm missing..

Offline

#489 2012-01-12 18:26:42

portix
Member
Registered: 2009-01-13
Posts: 757

Re: dwb - a webkit web browser

You need the latest revision of to get my suggestion to work as there were two bugs, the one concerning the semicolon as i said, the other was that some keyboard combinations weren't recognized but both are fixed. Just copy it to the text area in dwb://keys and save it.

Last edited by portix (2012-01-12 18:29:26)

Offline

#490 2012-01-12 19:18:10

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: dwb - a webkit web browser

Thanks portix!

However, i'm using latest rev. and I still cannot get it to work...

I can see that the command isn't even mapped, since when I press ] in normal mode, then the char is printed still in a textbox...

When I paste the custom command into the textfield, and select 'save custom', then there's no indication of anything being saved, no matter how many times I press it, and it seems it isn't sticking?

Offline

#491 2012-01-12 19:28:34

portix
Member
Registered: 2009-01-13
Posts: 757

Re: dwb - a webkit web browser

mhertz wrote:

When I paste the custom command into the textfield, and select 'save custom', then there's no indication of anything being saved, no matter how many times I press it, and it seems it isn't sticking?

Then you don't have the latest revision, tip is number 966.

Offline

#492 2012-01-12 19:30:26

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: dwb - a webkit web browser

-> Version found: 966
==> Making package: dwb-hg 966-1 (Thu Jan 12 20:08:34 CET 2012)

Offline

#493 2012-01-12 19:41:15

portix
Member
Registered: 2009-01-13
Posts: 757

Re: dwb - a webkit web browser

Oh, i see, the custom_keys file must be created, otherwise nothing will be saved, I will fix this.

Offline

#494 2012-01-12 20:01:10

portix
Member
Registered: 2009-01-13
Posts: 757

Re: dwb - a webkit web browser

Should be fixed now.

Offline

#495 2012-01-12 22:45:53

bloom
Member
Registered: 2010-08-18
Posts: 749
Website

Re: dwb - a webkit web browser

I'm trying the formfiller script: works well in most cases, problems arise when variables and/or values contain non alphanumeric characters:
For example, the following name:

data[user][username]

makes the javascript injected code fails because of this:

COMMAND+="var ${NAME}=

If a value contains '%', e.g.

foo%bar

it leads to alterations since '%ba' is interpreted as an HTML character?


gh · da · ds

Offline

#496 2012-01-12 23:27:34

portix
Member
Registered: 2009-01-13
Posts: 757

Re: dwb - a webkit web browser

bloom wrote:

I'm trying the formfiller script: works well in most cases, problems arise when variables and/or values contain non alphanumeric characters:
For example, the following name:

data[user][username]

makes the javascript injected code fails because of this:

COMMAND+="var ${NAME}=

If a value contains '%', e.g.

foo%bar

it leads to alterations since '%ba' is interpreted as an HTML character?

I don't know, also i'm not using the formfiller script anymore but if you have a fix for it i would include it in the source. But i'm still planning to implement a builtin formfiller without javascript.

Offline

#497 2012-01-13 05:03:10

stryder
Member
Registered: 2009-02-28
Posts: 500

Re: dwb - a webkit web browser

Portix, thanks for dwb. I'm beginning to explore the options. While I'm committed to reading through the 20 pages that this thread has, I'd appreciate a quick pointer as to how I can assign 2 or more keys to actions. Eg I have assigned "[" and "]" to history_back and history_forward but I would like to also assign "z" and "x" to do the same for the times when my right hand is on the mouse.

Offline

#498 2012-01-13 07:25:15

portix
Member
Registered: 2009-01-13
Posts: 757

Re: dwb - a webkit web browser

stryder wrote:

Portix, thanks for dwb. I'm beginning to explore the options. While I'm committed to reading through the 20 pages that this thread has, I'd appreciate a quick pointer as to how I can assign 2 or more keys to actions. Eg I have assigned "[" and "]" to history_back and history_forward but I would like to also assign "z" and "x" to do the same for the times when my right hand is on the mouse.

You can map them in the custom commands textarea:

x:back
z:forward

but if you map x there are some default keybindings that won't work anymore (xd, xu, xt, xx, xb, xv).

Last edited by portix (2012-01-13 07:26:45)

Offline

#499 2012-01-13 07:59:39

stryder
Member
Registered: 2009-02-28
Posts: 500

Re: dwb - a webkit web browser

Thanks. That worked! I don't think I'll ever need the functions that are called by "x?" so I have just added an A in front of all of them.

Offline

#500 2012-01-13 09:24:40

bloom
Member
Registered: 2010-08-18
Posts: 749
Website

Re: dwb - a webkit web browser

I need the title of the page in one of my script: could you provide it as $3?
(Maybe you can remove the '[n]' numeric key mechanism now that you implemented custom commands?)


gh · da · ds

Offline

Board footer

Powered by FluxBB