You are not logged in.

#1 2010-02-12 22:58:47

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

[SOLVED] Follow links in new window/tab in Uzbl

I've just ditched Conkeror for uzbl as my default browser -- nothing wrong with Conkeror per se, just seemed odd to be using Vim-like keybindings for most applications except my browser; also a good opportunity to support an Arch product...

Anyway, it all works great except for following links in new tabs (I'm using uzbl-tabbed). I have the follow_numbers_new_window.js script and in my config I have:

@bind    f*       = script @scripts_dir/follow.js '@follow_hint_keys %s'
@bind    F*       = script @scripts_dir/follow_Numbers_New_Window.js %s

However, entering F doesn't highlight any links. Any ideas?

#edit Also, if anyone knows how to get Google Reader keyboard shortcuts to pass through, that would be appreciated...

Last edited by jasonwryan (2010-02-13 20:37:35)


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#2 2010-02-13 02:54:21

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Follow links in new window/tab in Uzbl

Still no luck with following links in a new tab: tried jelly's follow_NumbersTab script, but to no avail...

Worked out the Google Reader thing: just a case of remaining in Insert mode.

'O' loads the current uri into the cmd line for editing, is there anyway to copy it?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2010-02-13 05:55:10

JackH79
Member
From: Australia
Registered: 2009-06-18
Posts: 663
Website

Re: [SOLVED] Follow links in new window/tab in Uzbl

Funnily enough, I tried exactly the same yesterday night and it didn't work either for me - although I wasn't really surprised, as the "follow_numbers" isn't used any more.

As I have absolutely no clue about coding and can't fix this myself, I guess we'll have to wait for someone nice to get this updated.

Minor thing though. Still loving uzbl.

Last edited by JackH79 (2010-02-13 05:58:52)

Offline

#4 2010-02-13 07:53:27

TaylanUB
Member
Registered: 2009-09-16
Posts: 150

Re: [SOLVED] Follow links in new window/tab in Uzbl

That script you use, follow in new window, is not working since the 'Uzbl.run' javascript thingy is disabled for security reasons.
(edit: You see it's a modified version of the "follow numbers" script, which doesn't work either. You might want to try and make a modified version of the working "follow.js" script.)

Currently i think there's no script that makes you follow links in a new instance.

You might want to read around a bit in the Uzbl frontpage, for news and all.

Last edited by TaylanUB (2010-02-13 07:55:20)


``Common sense is nothing more than a deposit of prejudices laid down by the mind before you reach eighteen.''
~ Albert Einstein

Offline

#5 2010-02-13 09:09:59

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Follow links in new window/tab in Uzbl

I had read the front page:

uzbl hompage wrote:

2010.02.02: Uzbl-tabbed and linkfollowing back from the dead
First the awesome news:
- Uzbl-tabbed is working again...
- We have a new link follower script (follow.js). Not only brings this back
linkfollowing after it broke in 2010.01.05 (this one doesn't depend on the
Uzbl object), but you can actually configure which keys you want to use for
hinting. Hence we dropped follow_Numbers.js and follow_Numbers_Strings.js.

I interpreted "dropping" as superseding, ie., replacing with follow.js. Nowhere does it say that the *Numbers scripts no longer function (at least as far as I could see).

But thanks for the heads-up.

Last edited by jasonwryan (2010-02-13 09:10:15)


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2010-02-13 09:18:38

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,001
Website

Re: [SOLVED] Follow links in new window/tab in Uzbl

You guys are right. opening in new window is also broken because of disabling the Uzbl JS object.  I'm told it can be done without the object but noone has bothered to patch it. (and i'm not sure how it would/should work).  Feel free to explore the scripts and try to make it work.


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#7 2010-02-13 09:23:50

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Follow links in new window/tab in Uzbl

Thanks Dieter@be - I'll have a crack at it.

Any ideas on copying the current uri?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#8 2010-02-13 09:34:13

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,001
Website

Re: [SOLVED] Follow links in new window/tab in Uzbl

jasonwryan wrote:

Thanks Dieter@be - I'll have a crack at it.

Any ideas on copying the current uri?

to where? there are some from/to clipboard bindings in the default config.


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#9 2010-02-13 09:37:43

TaylanUB
Member
Registered: 2009-09-16
Posts: 150

Re: [SOLVED] Follow links in new window/tab in Uzbl

To clipboard, yes?

This is my yank&paste section from the conf:

# --- Yanking & pasting binds ---
@cbind  yy  = sh 'echo -n $6 | xclip'
@cbind  YY  = sh 'echo -n $6 | xclip -selection clipboard'
@cbind  yt  = sh 'echo -n $7 | xclip'
@cbind  YT  = sh 'echo -n $7 | xclip -selection clipboard'
@cbind  p   = sh 'echo "set uri = `xclip -o`" > $4'
@cbind  P   = sh 'echo "set uri = `xclip -selection clipboard -o`" > $4'
@cbind  'p  = sh 'exec uzbl-browser --uri $(xclip -o)'
@cbind  'P  = sh 'exec uzbl-browser --uri $(xclip -selection clipboard -o)'

You might want to look into `man xclip` if you don't already know it well.
It's pretty straight forward.

The Uzbl documentation is highly encouraged if you don't know much about it already.
(Like what `$4` and such is for...)


``Common sense is nothing more than a deposit of prejudices laid down by the mind before you reach eighteen.''
~ Albert Einstein

Offline

#10 2010-02-13 18:24:59

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Follow links in new window/tab in Uzbl

Thanks Dieter@be and TaylanUB.

Sorry, I wasn't specific enough. My problem is that I haven't figured out how to select the current uri so I am then able to yank it to the clipboard... Trivial, I know, but irritating nonetheless.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#11 2010-02-13 20:31:56

TaylanUB
Member
Registered: 2009-09-16
Posts: 150

Re: [SOLVED] Follow links in new window/tab in Uzbl

You mean highlighting it without the mouse, like when you do Shift+right/left in a textfield? I don't know if that's doable, but the keybind examples i've given already copy the whole URI into any clipboard you like. (There's "primary" (default), which is normally where text goes when you've highlighted it with the mouse; and "clipboard" (you see `xclip -selection clipboard`), which is where text goes when you, for example, do a Ctrl+c from within your browser.)


``Common sense is nothing more than a deposit of prejudices laid down by the mind before you reach eighteen.''
~ Albert Einstein

Offline

#12 2010-02-13 20:37:14

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Follow links in new window/tab in Uzbl

Thanks TaylanUB: I think I have sorted it (by a combination of accident and your helpful binds). I really need to get my head around the clipboard concept...

For anyone else, in my (default config):

@cbind yu = sh 'echo -n $6 | xclip'

copies the current uri to the clipboard for pasting.

#edit Marked solved on the basis that the follow in new tab functionality is currently in-development...

Last edited by jasonwryan (2010-02-13 20:38:33)


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#13 2010-02-13 21:39:48

TaylanUB
Member
Registered: 2009-09-16
Posts: 150

Re: [SOLVED] Follow links in new window/tab in Uzbl

Yes, the clipboard is a bit tricky. There's two of them, mainly:

The code you gave there will copy the URI of the current page into a place called "primary selection" or something. (It's the default option for xclip, it's also expressed with `xclip -selection primary`.) It will get overwritten immediately when you use your mouse to highlight something (yes, only highlight, nothing else), and the usual Ctrl+v won't work to paste it (middle mouse button should do, or Shift+Insert in Vim, for example).

The "real" clipboard is accessed via `xclip -selection clipboard`. This "clipboard selection", or whatever it's called, is where text goes when you do a Windows-style Ctrl+c, and where text comes from when you use Ctrl+v.

Other than these, there is, for example, Vim's own clipboards (called registries). But if you have gvim installed (recommended, it's just a small addition to the normal Vim package, and you can use the normal Vim with more features, like: ), you can use the special registries "*" and "+" to access the "primary" and "clipboard" selections of X11, respectively. (I figured this out recently myself, installed gvim just today.)


``Common sense is nothing more than a deposit of prejudices laid down by the mind before you reach eighteen.''
~ Albert Einstein

Offline

#14 2010-02-13 22:08:43

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Follow links in new window/tab in Uzbl

Nice: that's one of the most succinct summaries of the clipboard I have read.

I installed gvim over vim for that reason and have been using "+y and "+p quite happily. So far with uzbl, I have only been able to copy out of uzbl and into vim with shift-delete/shift-insert which is sub-optimal, particularly when pasting indented code.

Thanks for the pointers.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#15 2010-02-14 10:57:22

TaylanUB
Member
Registered: 2009-09-16
Posts: 150

Re: [SOLVED] Follow links in new window/tab in Uzbl

Shift+Delete deletes the text and puts it into the "clipboard" selection; it's the same as Ctrl+x (Windows style). And Shift+Insert is the same as Ctrl+v; it pastes text from the "clipboard" selection. These are accessed in Vim via "+.

(By the way you CAN use Ctrl+{z,x,c,v} when writing in a textfield in your browser. To be technically correct, you need to be in insert mode. For that reason, Ctrl+c usually appears to be not working when you select text from a place that's not a writable textfield. You can map Ctrl+c to `xclip -o | xclip -selection clipboard` in Uzbl's config, to get Ctrl+c working while not in insert mode.)

``... particularly when pasting indented code.''

Do you mean the issue with Vim adding even more indents, causing a funny stair-like increatingly indented text?
That's caused by Vim's auto-indentation. For a proper paste, disable autoindent for a moment (`:set noai`), paste, and re-enable it (`:set ai`).

Actually ... i just tried it with "*p and "+p (the registry "* is "primary selection") and both work perfectly, with autoindent enabled. I guess Shift+Insert makes X insert the text into Vim as if manually typed, but Vim's own pasting from the special registries * and + works.

Last edited by TaylanUB (2010-02-14 11:03:19)


``Common sense is nothing more than a deposit of prejudices laid down by the mind before you reach eighteen.''
~ Albert Einstein

Offline

#16 2010-02-15 00:16:13

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Follow links in new window/tab in Uzbl

Thanks for the help TaylanUB; I have pretty much got it working exactly as I would like now.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB