You are not logged in.
I actually ran into it while searching for "lua docs" as there is a search engine "luakit" to search luakit.org. Thanks again Mason.
Offline
On the suggestion of a user (thats you alparo) in the IRC channel I've added a really nice and easy to implement following bind `;m`
http://github.com/mason-larobina/luakit … w.lua#L443
`;m` follows links in a background tab and then clears the users input & reloads the hints. This is useful for browsing forums whereby you can follow as many numbers/links as you like without having to press `F` after each one.
It's fast becoming my most used following bind and I wonder how long until vimperator picks up on something similar
Edit: Whoops, it appears vimperator already does this. I've renamed the bind to `;F` to match the same mode in vimperator.
Last edited by mason.larobina (2010-09-18 10:30:54)
Offline
Vimperator has ;F which does exactly this.
Ogion
(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant
Offline
Berticus wrote:@quigybo: it's never been a problem for me since I only store the keyword I'd use. So I do wiki instead of wikipedia, ddg/dukgo for duckduckgo, sp for startpage. So haven't, and probably never will, run into that bug. Be that as it may, no partial matching would be prefered.
The verdict is in, partial matching will be removed.
Berticus wrote:---Edit---
also, which link follow script are people using? I personally really like the default way vimperator and vimprobable2 does it. However, I've noticed with the scirpt (may be old?) when I type part of the link, I can't hit enter to follow it, tab to switch to the next hint, or even type the number of the hint.The latest following script is really nice and fully supports partial link name matching, <Tab> & <S-Tab> scrolling through followables and <Enter> to follow currently highlighted followable.
And it supports the whole array of follow options that vimperator does. Have a look, its really nifty:
Oh, I was using luakit-git. Guess I'll be switching over to the develop branch now then.
---Edit---
Follow lib works great! There was a problem with the search_open function though.
the return line originally was:
return ({string.gsub(search_engines[engine], "{%d}", string.gsub(terms, "%%", "%%%%"))})[1]
I think it should be:
return ({string.gsub(search_engines[engine], "{%d}", string.gsub(terms, "^%s*(.-)%s*$", "%1"))})[1]
---Edit---
Hmm... my fix doesn't work with multiple keywords.
Last edited by Berticus (2010-09-17 19:38:51)
Offline
I've looked through the LUAs, but I can't seem to figure out where :tabopen, the right click "open link in new window," and ";t" are defined. I would like to change these to open the tab in the background ala the middle click. I've found kind of what I want to do with the mouse button 2 binding (w:newtab(.., false)), but I'm not sure how to stick that in with enter_cmd(":tabopen").
Thanks
Offline
mason.larobina wrote:Berticus wrote:@quigybo: it's never been a problem for me since I only store the keyword I'd use. So I do wiki instead of wikipedia, ddg/dukgo for duckduckgo, sp for startpage. So haven't, and probably never will, run into that bug. Be that as it may, no partial matching would be prefered.
The verdict is in, partial matching will be removed.
Berticus wrote:---Edit---
also, which link follow script are people using? I personally really like the default way vimperator and vimprobable2 does it. However, I've noticed with the scirpt (may be old?) when I type part of the link, I can't hit enter to follow it, tab to switch to the next hint, or even type the number of the hint.The latest following script is really nice and fully supports partial link name matching, <Tab> & <S-Tab> scrolling through followables and <Enter> to follow currently highlighted followable.
And it supports the whole array of follow options that vimperator does. Have a look, its really nifty:
Oh, I was using luakit-git. Guess I'll be switching over to the develop branch now then.
---Edit---
Follow lib works great! There was a problem with the search_open function though.the return line originally was:
return ({string.gsub(search_engines[engine], "{%d}", string.gsub(terms, "%%", "%%%%"))})[1]
I think it should be:
return ({string.gsub(search_engines[engine], "{%d}", string.gsub(terms, "^%s*(.-)%s*$", "%1"))})[1]
---Edit---
Hmm... my fix doesn't work with multiple keywords.
I found and fixed the problem that was causing the search_open issues, it turned out that I needed to put a ({..})[1] around the second gsub call to make sure it only returned the first value (otherwise it will mess with the main gsub).
The fix is in the develop branch.
Offline
I've looked through the LUAs, but I can't seem to figure out where :tabopen, the right click "open link in new window," and ";t" are defined. I would like to change these to open the tab in the background ala the middle click. I've found kind of what I want to do with the mouse button 2 binding (w:newtab(.., false)), but I'm not sure how to stick that in with enter_cmd(":tabopen").
Thanks
The `:tabopen` and all other commands can be found in the `config/binds.lua` file under the mode_binds table.
The `;t` binding is added to the normal mode binds table from inside `lib/follow.lua` (close to the end).
Also I don't know how to replace the "open link in new window" context menu item with a custom item but what we can do is control its behaviour inside the "new-window-decision" signal which is attached in `config/webview.lua`.
And I don't quite get your meaning with the mouse button 2 binding, what are you trying to do?
Offline
Mouse 2 is the middle click, when I middle click a link, it goes into a tab that does not get focused. I would like to do the same with ;t and :tabopen.
If I change the false in
w:new_tab(w:search_open(uri), false)
to true, it focuses the new tab on middle click. If I keep it false, the tab does not get focused. I would like to replicate that functionality ;t and :tabopen, since the new tabs they make currently get focused.
I guess I would like to change the functionality of :tabopen, but I can't find where that functionality is defined (only the reference to the command in binds.lua).
Edit: Well, I see tab creation stuff in window.lua, but I have no idea what I'm doing... I'll attempt this again when I'm awake later. Might have a better chance of understanding this then.
Last edited by sugardeath (2010-09-18 11:29:19)
Offline
it would be great if it indicated when wget was done. Trying to figure out how that would be done...
Alternatively, does anybody know a daemon download manager I can just check up on and supports multiple downloads? It'd just look like multiple wgets (in the case where there are multiple downloads happening). It would of course need to support cookies
Last edited by Berticus (2010-09-19 14:50:37)
Offline
Ok now I'm willing to give luakit the chance to replace jumanji from being my default browser, because I have the feeling it's already superior and the development is much more active. Please keep it up mason!!
But there's only one thing left that I like more about jumanji, which is the order of new tabs. Luakit throws all new tabs to the end (or if this is better to understand, new tabs are always opened on the right side of the tab bar). I prefer jumanji's way of placing new tabs right to the current one. I don't say you should make this the default behaviour of luakit (although I would of course like it), but what about implementing both ways to handle tabs and let the user decide? In case you don't want to implement it, what do I have to do to get this behaviour with luakit?
And there's a second question I have, is it possible to make luakit open links to youtube videos (links that include http://www.youtube.com/watch?v=) with an external program (for my part youtube-viewer would be that external program)? That would be super awesome! In case that's possible I'd also make ftp links being opened in an external ftp client, because luakit and all other webkit browsers (with the exception of chromium of course) can't handle ftp.
Last edited by Army (2010-09-20 12:10:20)
Offline
Ok now I'm willing to give luakit the chance to replace jumanji from being my default browser, because I have the feeling it's already superior and the development is much more active. Please keep it up mason!!
But there's only one thing left that I like more about jumanji, which is the order of new tabs. Luakit throws all new tabs to the end (or if this is better to understand, new tabs are always opened on the right side of the tab bar). I prefer jumanji's way of placing new tabs right to the current one. I don't say you should make this the default behaviour of luakit (although I would of course like it), but what about implementing both ways to handle tabs and let the user decide? In case you don't want to implement it, what do I have to do to get this behaviour with luakit?
This is just a simple matter of saving the current index and reordering the new tab after the saved index.
local i = w.tabs:current()
local view = w:new_tab(uri)
w.tabs:reorder(view, i+1)
Or something like that
I'll have a look tonight and make that the default behaviour.
And there's a second question I have, is it possible to make luakit open links to youtube videos (links that include http://www.youtube.com/watch?v=) with an external program (for my part youtube-viewer would be that external program)? That would be super awesome! In case that's possible I'd also make ftp links being opened in an external ftp client, because luakit and all other webkit browsers (with the exception of chromium of course) can't handle ftp.
Yeah its just a simple matter of adding some logic in the 'mime-type-decision' signal and launch an external app when the uri matches your youtube uri. The great thing about the 'mime-type-decision' signal is that you can return false to stop the loading (indicating you've blocked it or handling it manually through some other means).
You can do this a few ways without having to modify webview.lua, you can override the `webview.init_funcs.mime_decision` function or add another function to the `webview.init_funcs` table to add another 'mime-type-decision' signal handler.
Have fun, you might also be able to get some help in our IRC channel (#luakit on irc.oftc.net)
Offline
Ok I'll try to make this youtube thingy work.
I'll have a look tonight and make that the default behaviour.
Actually there's even a better way (imho). The way Chromium does it (and Firefox as well since a couple of releases ago iirc) is a little bit different (and I guess harder to implement, but maybe you like it )
Let's say I start luakit and open bbs.archlinux.org. Then I open another site in a new tab, let's say google. Then it looks like this
(bbs.archlinux.org) (google.com)
Then I go back to the bbs and start opening tabs. The way Jumanji and e.g. Midori etc handle tabs it will look like this (after opening 3 different threads as new tabs)
(bbs.archlinux.org) (3rd thread) (2nd thread) (1st thread) (google.com)
The way Chromium would handle it would look like this
(bbs.archlinux.org) (1st thread) (2nd thread) (3rd thread) (google.com)
Going a little further, if the 2nd thread contains e.g. 2 links I like and open them as new tabs, it would look like this in Chromium
(bbs.archlinux.org) (1st thread) (2nd thread) (1st link) (2nd link) (3rd thread) (google.com)
You see, the order stays intact, our way of reading goes from left to right, so it's very logical to have tabs opened in that order while remaining next to the parent tab.
I just wanted to mention this even better (remember, just my opinion, I'm sure there are many people out there who hate it the way Chromium does it) method in case you like it and want to implement it in luakit.
Last edited by Army (2010-09-20 13:56:07)
Offline
quigybo wrote:One more: when a link is focussed using "Ff"/";;" can the uri of that link be printed somewhere temporarily? I used this a lot in vimperator to check the validity of a link before following it. I had a quick play but follow.evaluators["focus"] returns "{root,form}-active" instead of a uri, but wasn't too sure if I could change that...
I suggest creating a custom set of following binds using the "uri" follow mode (which returns the uri of the "followed" element) then use the uri given to the callback function however you wish. For example:
buf("^f$", function (w) w:start_follow("uri", "check open", function (uri) if check_uri(uri) then w:navigate(uri) return "root-active" end end) end),
To accomplish this I would need to create a new mode, where it asks the user if the link should be followed or not while displaying the uri somewhere. All I originally had in mind was something like this, but then with the element also being focussed, so that the user only has to press <Enter> to follow the link:
buf("^;;$", function (w,b,m) w:start_follow("uri", "display uri", function (uri) w:update_uri(nil, nil, uri) return "root-active" end) end),
@Army: I like your method of tab ordering on creation, as firefox/vimperator also does it that way (like chromium). To do this I guess you would need to keep track of whether you have switched tabs or not in between following links. A simpler solution may be just to let w:new_tab() accept an optional parameter to pack the new tab next to the current one instead of at the end (jumanji/midori style). Unfortunately as you say it is not as nice as the chromium/firefox way.
One question, I had a look in window.lua but couldn't figure out how to define the size of the window on creation?
Another question, currently `;i` will follow the source of an image, displaying an image which is quite often only a thumbnail. I wonder if it is possible to instead follow its href attribute? This would be really handy when a page has both text and images as followable elements, as text links can be easily selected by typing a few letters, while image links require a (usually high) number. On a page with many text links and only a few image links this would be especially useful.
One last question, in vimperator I had a key bound to the javascript below, allowing me to toggle the zoom of an image mouselessly. What I mean is when you are viewing an image directly, not in a html document, by clicking on the image you can toggle between actual size and scaled to fit. I tried translating this to javascript webkit understands but failed. Anybody know how it should be done?
window.content.document.toggleImageSize();
Offline
Offline
Wow, now it displaces Jumanji for me (somehow it's sad...). It's the best webbrowser I've ever seen.
Only one question: How is it possible to autocomplete the "open-dialog" with my bookmarks, history etc?
Offline
should the follow theme colors in lib/follow.lua be placed in theme.lua instead?
Offline
should the follow theme colors in lib/follow.lua be placed in theme.lua instead?
We can but the difference is link following doesn't work without these defined. It's already possible to redefine them from your theme.lua though.
Check out:
http://github.com/mason-larobina/luakit … w.lua#L352
This merges a `theme.follow` table (if you have one) with the default theme table.
Offline
oh, sorry, missed that. Thanks!
I'm trying to figure out how to get it so when I search for text, and the first hit is a link, I don't want to follow it after hitting Enter. A little help would be much appreciated.
Offline
I'm trying to figure out how to get it so when I search for text, and the first hit is a link, I don't want to follow it after hitting Enter.
I agree with you that this behaviour is a little counter-intuitive, luckily changing it is easy (which is what I love about luakit the most ). All you need to do is add a bind in the search mode to the "Return" key. For example to make it more vim[perator] like you can bind it to a function that exits the search mode:
diff --git a/config/binds.lua b/config/binds.lua
index ebe6fbd..c5599fe 100644
--- a/config/binds.lua
+++ b/config/binds.lua
@@ -207,6 +207,7 @@ binds.mode_binds = {
search = {
key({"Control"}, "j", function (w) w:search(nil, true) end),
key({"Control"}, "k", function (w) w:search(nil, false) end),
+ key({}, "Return", function (w) w:set_mode() end),
},
insert = { },
}
Offline
yeah, it's great you can change things so easily, but I haven't learned lua yet... So far, I've jsut been trying to figure things out on my own.
Oh, and thanks for the patch.
Last edited by Berticus (2010-09-28 20:49:22)
Offline
Berticus wrote:I'm trying to figure out how to get it so when I search for text, and the first hit is a link, I don't want to follow it after hitting Enter.
I agree with you that this behaviour is a little counter-intuitive, luckily changing it is easy (which is what I love about luakit the most ). All you need to do is add a bind in the search mode to the "Return" key. For example to make it more vim[perator] like you can bind it to a function that exits the search mode:
diff --git a/config/binds.lua b/config/binds.lua index ebe6fbd..c5599fe 100644 --- a/config/binds.lua +++ b/config/binds.lua @@ -207,6 +207,7 @@ binds.mode_binds = { search = { key({"Control"}, "j", function (w) w:search(nil, true) end), key({"Control"}, "k", function (w) w:search(nil, false) end), + key({}, "Return", function (w) w:set_mode() end), }, insert = { }, }
That or this:
diff --git a/config/rc.lua b/config/rc.lua
index 6c1935c..762b682 100644
--- a/config/rc.lua
+++ b/config/rc.lua
@@ -39,7 +39,6 @@ require "binds"
require "follow"
require "formfiller"
require "go_input"
-require "follow_selected"
require "go_next_prev"
require "go_up"
require "session"
Also this is a great place to learn lua for beginners, any knowledge counts:
Offline
@mason: I actually prefer just disabling enter in search mode, as follow_selected is still handy when searching for text.
ie. Instead of searching for the text, using C-j or C-k to highlight the correct link, then pressing enter, I prefer searching for the text, leaving search mode, then using n or N to find the link and then pressing enter to follow the link. It feels more intuitive/vim-like.
Offline
@mason: I actually prefer just disabling enter in search mode, as follow_selected is still handy when searching for text.
ie. Instead of searching for the text, using C-j or C-k to highlight the correct link, then pressing enter, I prefer searching for the text, leaving search mode, then using n or N to find the link and then pressing enter to follow the link. It feels more intuitive/vim-like.
That is a much better use case. I like this also and I'll make this the default action.
Offline
quigybo wrote:@mason: I actually prefer just disabling enter in search mode, as follow_selected is still handy when searching for text.
ie. Instead of searching for the text, using C-j or C-k to highlight the correct link, then pressing enter, I prefer searching for the text, leaving search mode, then using n or N to find the link and then pressing enter to follow the link. It feels more intuitive/vim-like.
That is a much better use case. I like this also and I'll make this the default action.
Nice, thanks. One thing I just noticed though, on exiting search mode the "leave" function will reset the scroll position - something you don't really expect when pressing <Return>, only on pressing <Esc>. So something like this may be better:
diff --git a/config/binds.lua b/config/binds.lua
index ebe6fbd..93b0ba5 100644
--- a/config/binds.lua
+++ b/config/binds.lua
@@ -207,6 +207,10 @@ binds.mode_binds = {
search = {
key({"Control"}, "j", function (w) w:search(nil, true) end),
key({"Control"}, "k", function (w) w:search(nil, false) end),
+ key({}, "Return", function (w)
+ w.search_state.marker = nil
+ w:set_mode()
+ end),
},
insert = { },
}
Offline
Currently I'm looking for a lightweight browser and so far I think luakit suits me well. Thanks for it. One thing I'd like to know and I hope this isn't just a dumb question because I don't know how easy or hard it is:
Is it possible to use some filter lists for ad blocking?
Last edited by Barghest (2010-10-02 15:00:46)
Offline