You are not logged in.

#1026 2012-09-11 17:25:50

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

Re: dwb - a webkit web browser

This extension uses chromiums javascript api, there is no equivalent for dwb and
it's not possible to modify the PREF cookie value, however you can achieve the
same result without modifying the cookie, just put the following script into
~/.config/dwb/userscripts/

#!javascript

signals.connect("navigation", function(wv, frame, request) {
  if (frame == wv.mainFrame && !(/&html5=True/).test(request.uri) && 
      util.domainFromHost(request.message.uri.host) == "youtube.com")
  {
    wv.loadUri(request.uri + "&html5=True");
    return true;
  }
});

You only must take care that the file starts with #!javascript, there must not
be whitespaces before the shebang.

Offline

#1027 2012-09-11 20:18:40

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: dwb - a webkit web browser

Hi, did something change with the scripts support? I have this file

% cat .config/dwb/userscripts/handler.js
#!javascript
signals.connect("navigation", function(wv, frame, request) {
	if (/^magnet:.*/|.*\.torrent$/.test(request.uri)) {
		system.spawn("transmission-remote -a " + request.uri);
		return true;
	}
	if (/^mailto:.*/.test(request.uri)) {
		system.spawn("urxvt -title mutt -e mutt " + request.uri);
		return true;
	}
	if (/^ftp/.test(request.uri)) {
		system.spawn("urxvt -e ncftp " + request.uri);
		return true;
	}
});

which used to work, but doesn't work anymore, dwb tries to open those urls, which of course fails.

Offline

#1028 2012-09-11 20:25:02

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

Re: dwb - a webkit web browser

Are you sure that this script ever worked? There is syntax error in line 2. Btw. there is an extension contenthandler which runs commands based on uri-scheme mimetype or filename-extension, you can install it with

dwbem -i contenthandler

Edit: The error is in your first regular expression, you could change it to

	if (/^magnet:.*|.*\.torrent$/.test(request.uri)) {

Last edited by portix (2012-09-11 20:28:19)

Offline

#1029 2012-09-11 20:28:45

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: dwb - a webkit web browser

Oh right, yes that error shouldn't be there, this happened while I tried to "fix" it wink

I've already seen this extension, guess now it's time to use it.

And now I see what dwbem is smile

Offline

#1030 2012-09-13 13:54:16

bslackr
Member
Registered: 2012-01-27
Posts: 131

Re: dwb - a webkit web browser

portix wrote:

This extension uses chromiums javascript api, there is no equivalent for dwb and
it's not possible to modify the PREF cookie value, however you can achieve the
same result without modifying the cookie, just put the following script into
~/.config/dwb/userscripts/

#!javascript

signals.connect("navigation", function(wv, frame, request) {
  if (frame == wv.mainFrame && !(/&html5=True/).test(request.uri) && 
      util.domainFromHost(request.message.uri.host) == "youtube.com")
  {
    wv.loadUri(request.uri + "&html5=True");
    return true;
  }
});

You only must take care that the file starts with #!javascript, there must not
be whitespaces before the shebang.

Cool, thanks. One more thing, if a website won't load and I have to kill dwb, who should I report this to? It is clearly a webkit problem, as I tried it with luakit and surf with the same results (mlb.com).

Offline

#1031 2012-09-14 09:03:53

Šaran
Member
From: Bosnia
Registered: 2011-09-03
Posts: 407

Re: dwb - a webkit web browser

Can anybody help me replicate this:

gnomeye wrote:

few week ago I realized I could map my youtube video download funcitons I type everytime in rxvt into pentadactyl with a simple line in the config file.

now, when I am on a youtube video - pressing <A-y> will download automatically the vid. <A-m> will open the yt-stream directly into mplayer.

made me go "oooh nice" +1 pentadactyl.

Thanks.

Offline

#1032 2012-09-14 12:59:09

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

Re: dwb - a webkit web browser

You could use youtube-dl and some simple userscripts. A script for playing videos with mplayer:

#!/bin/bash
# dwb:Mod1 m

mplayer $(youtube-dl -g $DWB_URI) 

A script for downloading videos:

#!/bin/bash
# dwb:Mod1 y

youtube-dl $DWB_URI 

And a script that does both:

#!javascript 

bind("Mod1 m", function () { 
  system.spawn("sh -c 'mplayer $(youtube-dl -g " + tabs.current.uri + ")'"); 
});
bind("Mod1 y", function () { 
  system.spawn("youtube-dl " + tabs.current.uri); 
});

Offline

#1033 2012-09-15 12:00:52

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

Re: dwb - a webkit web browser

@portix

I have defined: 'cookies-accept-policy=always' and 'cookies-store-policy=persistent', but still I have to relogin to gmail and archforum every time I start dwb?

I have a 46k cookies file under '~/.config/dwb/default/cookies'...

Have there been some new config-option added or something that i've missed that needs enabling? Btw, i'm using dwb-hg.

Thanks in advance.

Offline

#1034 2012-09-15 19:59:24

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

Re: dwb - a webkit web browser

No, there is no new cookie-option. I can reproduce it on gmail but cannot reproduce it on other sites. The cookie is also saved on gmail. I don't know why it doesn't work on gmail anymore, but i'll create a ticket for this issue.

Offline

#1035 2012-09-15 20:50:44

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

Re: dwb - a webkit web browser

Hmm...

Thanks for the gmail ticket, but I just don't get why you don't get the same behaviour as me on the arch-forum?

I've just deleted my cookies file with dwb closed, and then started dwb and logging on to the arch-forum and selected "remember me" and closing dwb afterwards.

I then see a new cookies file generated, but it's completelly empty?

I redid the operation and still the same, and I had just did a dwb update before...

Please give a shout-out if you get to think about something "wrong" on my end, thanks!

CU, Martin.

Last edited by mhertz (2012-09-15 20:52:19)

Offline

#1036 2012-09-15 21:22:27

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

Re: dwb - a webkit web browser

mhertz wrote:

Hmm...

Thanks for the gmail ticket, but I just don't get why you don't get the same behaviour as me on the arch-forum?

I've just deleted my cookies file with dwb closed, and then started dwb and logging on to the arch-forum and selected "remember me" and closing dwb afterwards.

I then see a new cookies file generated, but it's completelly empty?

I redid the operation and still the same, and I had just did a dwb update before...

Please give a shout-out if you get to think about something "wrong" on my end, thanks!

CU, Martin.

I think your issue is caused by the change of the sync-files setting. You could check if sync-files is set to a correct value. I could reproduce it if sync-files isn't set.

Offline

#1037 2012-09-15 22:14:40

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

Re: dwb - a webkit web browser

Ahh, you nailed it! Thank you so much, mate!

I'm embaressed about not having seen that option previously, and as you said, then it was unset on my end!

Btw, it now also works on gmail!

Again sorry, and many thanks!

Offline

#1038 2012-09-15 22:27:01

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

Re: dwb - a webkit web browser

mhertz wrote:

Ahh, you nailed it! Thank you so much, mate!

I'm embaressed about not having seen that option previously, and as you said, then it was unset on my end!

Btw, it now also works on gmail!

Again sorry, and many thanks!

It wasn't a mistake on your end, sync-history previously was an integer setting, now it is a string setting and it isn't set to a default value if it's invalid, so it's a mistake on my end but i'll fix it soon.

Offline

#1039 2012-09-16 15:42:12

Šaran
Member
From: Bosnia
Registered: 2011-09-03
Posts: 407

Re: dwb - a webkit web browser

portix wrote:

You could use youtube-dl and some simple userscripts. A script for playing videos with mplayer:

Thank you.

I can also confirm cookies issue.

Offline

#1040 2012-09-16 18:04:39

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

Re: dwb - a webkit web browser

I already posted a solution but i will also fix it in dwb.

Offline

#1041 2012-09-17 07:43:34

bslackr
Member
Registered: 2012-01-27
Posts: 131

Re: dwb - a webkit web browser

chneukirchen wrote:

Also, I think I found a bug, but I'm not sure it's in dwb or dwm... it only happens when I use both together.

I use mozplugger to embed mupdf to display PDF files. Reparenting works fine, and I can use the mouse to scroll, but key events are not passed to the inner window.

However, mupdf in dwb works e.g. with cwm or fvwm.

But it doesn't appear to be a dwm bug solely, because mupdf works e.g. in tabbed or Firefox in dwm.

Unfortunately, I have no idea how to debug this.

How did you get mozplugger to work with dwb?

Edit: Nevermind, I figured it out.

Last edited by bslackr (2012-09-17 10:37:26)

Offline

#1042 2012-09-17 16:01:35

hellomynameisphil
Member
From: /home/phil/Vancouver
Registered: 2009-10-02
Posts: 257
Website

Re: dwb - a webkit web browser

portix wrote:
hellomynameisphil wrote:

Sorry if this has been asked before, but is there any way to hide the tab bar if there is only one tab open?

There isn't a native setting for it anymore, you can try it with the following script:

#!javascript

signals.connect("closeTab", function () {
  if (tabs.length == 2) 
    execute("set widget-packing Twds");
});
signals.connect("createTab", function () {
  if (tabs.length == 2) 
    execute("set widget-packing twds");
});

Thanks. This was working really well until just recently. I copied the script to the userscripts directory and set it to executable (not sure whether that's necessary), but now I see the tabbar at all times.

Offline

#1043 2012-09-17 16:49:26

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

Re: dwb - a webkit web browser

hellomynameisphil wrote:

Thanks. This was working really well until just recently. I copied the script to the userscripts directory and set it to executable (not sure whether that's necessary), but now I see the tabbar at all times.

Doesn't it work in general or only for the first tab? Here is an updated version that works with latest hg.

#!javascript

execute("set widget-packing Twds");
signals.connect("closeTab", function () {
  if (tabs.length == 2) 
    execute("set widget-packing Twds");
});
signals.connect("createTab", function () {
  if (tabs.length == 2) 
    execute("set widget-packing twds");
});

You should also update to the latest hg-version if you use this, otherwise you might get a segfault. Javascript-scripts don't need to be executable, only scripts in other languages must be executable.

Edit: i think i'll reintroduce an option to hide the tabbar if only one tab is open.

Last edited by portix (2012-09-17 16:52:56)

Offline

#1044 2012-09-17 19:18:34

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

Re: dwb - a webkit web browser

@hellomynameisphil: i created an option 'show-single-tab', with latest hg you don't need a userscript.

Offline

#1045 2012-09-17 19:25:55

Shinryuu
Member
From: /dev/urandom
Registered: 2010-02-27
Posts: 339

Re: dwb - a webkit web browser

portix wrote:

@hellomynameisphil: i created an option 'show-single-tab', with latest hg you don't need a userscript.

Oh, that was fast. I just copied your javascript in order to do the same.. gotta update!

Offline

#1046 2012-09-17 19:28:30

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: dwb - a webkit web browser

Shinryuu wrote:
portix wrote:

@hellomynameisphil: i created an option 'show-single-tab', with latest hg you don't need a userscript.

Oh, that was fast. I just copied your javascript in order to do the same.. gotta update!

As I did. Updating as well.

Offline

#1047 2012-09-19 23:25:07

chneukirchen
Member
Registered: 2010-02-11
Posts: 100

Re: dwb - a webkit web browser

I noticed that when Flash crashes, it takes down the whole browser... how difficult is it to run the plugins in seperate processes?

Offline

#1048 2012-09-19 23:45:43

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

Re: dwb - a webkit web browser

chneukirchen wrote:

I noticed that when Flash crashes, it takes down the whole browser... how difficult is it to run the plugins in seperate processes?

I'm not a webkitgtk-developer, so for me it is impossible. You should address this to the webkitgtk bugtracker but i don't think that they are interested in separating flash in a new process. libwebkit3 doesn't even support flash because flash is linked against gtk2.

Offline

#1049 2012-09-19 23:49:38

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: dwb - a webkit web browser

portix wrote:

libwebkit3 doesn't even support flash because flash is linked against gtk2.

A bit OT: does it support pepper or what do I have to use to view flash content?

Offline

#1050 2012-09-20 00:04:06

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

Re: dwb - a webkit web browser

If you're on i686, then you can still use flash with the gtk3/webkit3 version: https://alderaan.archlinux.org/viewtopi … 2#p1012532

For x86-64 I dunno, sorry...

Offline

Board footer

Powered by FluxBB