You are not logged in.

#851 2012-04-08 14:14:44

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 455

Re: luakit browser framework (almost with jQuery!)

I'm trying to disable the status bar and show it only when the page is loading or if the mouse cursor is over the link. I changed 'link_hover_display' section in webview.lua to

link_hover_display = function (view, w)
        view:add_signal("link-hover", function (v, link)
            if w:is_current(v) and link then
                w:update_uri(v, nil, link)
            end
            w.sbar.ebox:show()
            w.sbar.hidden = false
        end)
        view:add_signal("link-unhover", function (v)
            if w:is_current(v) then
                w:update_uri(v)
            end
            w.sbar.ebox:hide()
            w.sbar.hidden = true
        end)
    end,

but it does nothing. In the terminal are these messages:

W: luakit: luaH_dofunction:104: error while running function
stack traceback:
error: /home/ok/.config/luakit/webview.lua:85: attempt to call method 'is_current' (a nil value)
W: luakit: luaH_dofunction:104: error while running function
stack traceback:
error: /home/ok/.config/luakit/webview.lua:92: attempt to call method 'is_current' (a nil value)

I also want to show scroll marker in the window title, but the wiki page http://redmine.luakit.org/projects/luak … ndow_Title seems to be outdated. Does anybody know how to do it?
Edit: in window.lua:

update_scroll = function (w)
        ...
        local title = w.view.title
        local uri = w.view.uri
        w.win.title = "[" .. w.sbar.r.scroll.text .. "] " .. (title or "luakit") .. ((uri and " - " .. uri) or "")
    end,

Last edited by OK100 (2012-04-09 06:37:19)

Offline

#852 2012-04-08 16:27:32

Stebalien
Member
Registered: 2010-04-27
Posts: 1,239
Website

Re: luakit browser framework (almost with jQuery!)

Update your webview.lua. 'w:is_current(v)' is now 'w.view == v' and 'w:update_uri' now only takes link as an argument.


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C

Offline

#853 2012-04-08 16:42:59

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 455

Re: luakit browser framework (almost with jQuery!)

Stebalien wrote:

Update your webview.lua. 'w:is_current(v)' is now 'w.view == v' and 'w:update_uri' now only takes link as an argument.

I changed it to

-- Display hovered link in statusbar
    link_hover_display = function (view, w)
        view:add_signal("link-hover", function (v)
            if w:view == v and link then
                w:update_uri(link)
            end
            w.sbar.ebox:show()
            w.sbar.hidden = false
        end)
        view:add_signal("link-unhover", function (v)
            if w:view == v then
                w:update_uri(v)
            end
            w.sbar.ebox:hide()
            w.sbar.hidden = true
        end)
    end,

but now I get this:

error loading module 'webview' from file '/home/ok/.config/luakit/webview.lua':
	/home/ok/.config/luakit/webview.lua:85: function arguments expected near '=='
E: luakit: main:184: no windows spawned by rc file, exiting

Offline

#854 2012-04-09 06:22:30

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 455

Re: luakit browser framework (almost with jQuery!)

Sorry, I got w:view instead of w.view smile. Thanks for your help.

Offline

#855 2012-04-09 19:46:12

phynix
Member
Registered: 2008-09-21
Posts: 28

Re: luakit browser framework (almost with jQuery!)

Trilby wrote:

Are you using luakit from [community] or a more recent version?

With the [community] version I don't have any problem viewing facebook pages - though clicking on a result in the search bar is another story.

I am using the git version.

Offline

#856 2012-04-10 06:23:17

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 455

Re: luakit browser framework (almost with jQuery!)

Is it possible, when I close a tab to activate a tab that was focused before (like the default behavior in opera)? It currently focus a tab on the right.

Offline

#857 2012-04-10 18:07:30

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 455

Re: luakit browser framework (almost with jQuery!)

I have problem with last.fm discover mode (http://www.last.fm/discover). It loads fine, but when I try to play something I can't hear anything and the progress bar on the bottom isn't moving.

Offline

#858 2012-04-12 21:07:26

mahatman2
Member
From: Baton Rouge, LA, USA
Registered: 2010-03-04
Posts: 46
Website

Re: luakit browser framework (almost with jQuery!)

@sonkei: sorry mate for not getting back but it works great! THanks smile


Clever Linux quote.

Offline

#859 2012-04-12 21:31:07

anti-destin
Member
Registered: 2009-02-14
Posts: 234

Re: luakit browser framework (almost with jQuery!)

i often open a bunch of pages quickly in succession, but sometimes focus is lost while i'm opening a new tab, and i have to click the command bar to start typing again. does anyone else have this issue?

Offline

#860 2012-04-15 03:06:36

rlevArch
Member
Registered: 2011-12-04
Posts: 35

Re: luakit browser framework (almost with jQuery!)

I'm having trouble with the script posted on the wiki to use cclive and mplayer to watch youtube vids.
I've put the following in my binds.lua:

    -- Grab video
    key({}, "v", function (w) 
        local view = w:get_current()
        local uri = view.hovered_uri or view.uri 
        if uri then
            luakit.spawn(string.format("urxvtc -e cclive -f best --filename-format '%%t.%%s' " .. "--output-dir %q --exec='mplayer \"%%f\"' %q",
        os.getenv("HOME"), uri)) 
        end
    end)

When I try to run it, I get an error in my "attempt to call 'get_current' (a nil value)".

I also tried using get_current().uri

I installed luakit yesterday or the day before using the git repo. Does anyone know what the proper code should be?

EDIT: I've been looking through the thread, and it seems like there is a way (theoretically) to get luakit to do this automatically on page load using something like this:

webview.init_funcs.youtube_appender = function (view, w)
    view:add_signal("navigation-request", function (v, uri)
        if string.match(uri, "youtube%.com/watch%?v=") and not string.match(uri, "&html5=1") then
            v.uri = uri .. "&html5=1"
            return false
        end
    end)
end

but I'm not familiar with lua, and I'd like to attach something like this to a key in bind.lua instead of having it done automatically in webview.lua. Any suggestions?

EDIT 2: [SOLVED] my own issue... took quite a bit of digging though. It looks like get_current() is no longer a function (I dunno if anyone can confirm that), so I got it working using the following:

    -- Grab video
    key({}, "v", function (w) 
        local uri = w.view.hovered_uri or w.view.uri 
        if uri then
            luakit.spawn(string.format("urxvtc -e cclive -f best --filename-format '%%t.%%s' " .. "--output-dir %q --exec='mplayer \"%%f\"' %q",
        os.getenv("HOME"), uri)) 
        end
    end)

The change is deleting the line that had get_current() before, and changing

local uri = view.hovered_uri or view.uri 

to

local uri = w.view.hovered_uri or w.view.uri 

on the next

Last edited by rlevArch (2012-04-15 16:49:50)

Offline

#861 2012-04-15 04:10:06

rlevArch
Member
Registered: 2011-12-04
Posts: 35

Re: luakit browser framework (almost with jQuery!)

I'm also finding that I have trouble seeing the follow hints sometimes... does anybody know how to change the opacity of the hints or somehow give the hints better contrast so I can see what they are?

Thanks

EDIT: Found my answer, thanks to Army for all these little tidbits of code earlier in the forum.
For anyone else who may need it, add this to theme.lua:

-- hints theming
theme.follow = {}
theme.follow.focus_bg = "#00ff00";
theme.follow.normal_bg = "#ffff99";
theme.follow.opacity = 0.3;
theme.follow.border = "1px dotted #000000";
theme.follow.frame_border = "2px solid #880000";
theme.follow.tick_frame_bg = "#880000";
theme.follow.tick_fg = "#ffffff";
theme.follow.tick_bg = "#000000";
theme.follow.tick_border = "2px dashed #000000";
theme.follow.tick_opacity = 0.35;
theme.follow.tick_font = "9px terminus";
theme.follow.vert_offset = 0;
theme.follow.horiz_offset = 0;

Last edited by rlevArch (2012-04-15 16:14:13)

Offline

#862 2012-04-18 23:48:11

rlevArch
Member
Registered: 2011-12-04
Posts: 35

Re: luakit browser framework (almost with jQuery!)

I've been noticing an issue with the focusing. I'm not sure where I saw it, but I noticed someone else also comment on it. After opening a link, a new tab will open but the focus will be in the previous tab, or something like that. It's a relatively minor issue but it can get annoying.

Is there anyone actively working on this project?? The IRC channel was pretty dead when I checked it out for the above questions, and this thread seems pretty quiet...

Offline

#863 2012-04-19 17:05:11

Draven94
Member
Registered: 2012-03-21
Posts: 11

Re: luakit browser framework (almost with jQuery!)

Draven94 wrote:

At this time Facebook doesn't work for me, I have tried various solutions but nothing...I hope in your help smile

UPDATE: I solved my problems witht Facebook...I have to change the global user agent from chrome user agent to opera user agent. Now the site works well. Now I am searching a FlashBlock but I think it is difficult to find it. Any ideas?

Offline

#864 2012-04-19 17:27:40

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

Re: luakit browser framework (almost with jQuery!)

Flashblock is built in in luakit! Here's what I have in my rc.lua

require "noscript"
noscript.enable_scripts = false
noscript.enable_plugins = false

This way plugins and javascript is disabled by default. To enable javascript for the current domain type ,ts and to enable plugins type ,tp
Sometimes I run into problems with this, e.g. if javascript from other domains is needed for the current webpage, but for those I use surf anyway, surf is my "all-allowed-browser" (and firefox my "all-allowed-and-doesn't-work-with-surf-browser")

Offline

#865 2012-04-20 16:39:10

Draven94
Member
Registered: 2012-03-21
Posts: 11

Re: luakit browser framework (almost with jQuery!)

Thanks Army. I know this method, but I prefer to block flash contents without noscript. Perhaps we need a script.
Today I have some crashes when I search in Facebook's bar. At this moment I have some issues also in Twitter sad

Last edited by Draven94 (2012-04-20 19:48:31)

Offline

#866 2012-04-21 11:01:22

Doomcide
Member
Registered: 2011-08-22
Posts: 221

Re: luakit browser framework (almost with jQuery!)

I think that hasbeen asked bevfore, but I'm unable to find an answer. I use a dark gtk-theme, but several input fields in luakit have a dark background and black font. How do I fix this? I guess I need to apply a custom css but I'm a complette noob regarding this, so could anyone provide one for me please? smile

Offline

#867 2012-04-21 14:56:54

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

Re: luakit browser framework (almost with jQuery!)

@Draven94, afaik there are userscripts which provide this funcionality? Luakit is able to handle userscripts, so you could take a look at http://www.userscripts.org

Offline

#868 2012-04-27 13:09:13

Draven94
Member
Registered: 2012-03-21
Posts: 11

Re: luakit browser framework (almost with jQuery!)

Army wrote:

@Draven94, afaik there are userscripts which provide this funcionality? Luakit is able to handle userscripts, so you could take a look at http://www.userscripts.org

Thanks.
This scripts (http://userscripts.org/scripts/show/46673) works well.

Offline

#869 2012-05-03 02:25:35

rlevArch
Member
Registered: 2011-12-04
Posts: 35

Re: luakit browser framework (almost with jQuery!)

I'm having another issue with luakit... youtube is very finnicky, and the vids only seem to work if there is an ad before the video. I can d/l it with cclive, but I don't always want to do that. Javascript and Plugins are both definitely enabled.

Also, is there anywhere else I can go for quicker help? The irc channel is always extremely quiet.

I'm also still having that issue with the focusing thing. Sometimes when a page loads or I open a new tab, none of the binds work because the page is not in focus and I have to click with the mouse.

Offline

#870 2012-05-04 10:32:20

flymster
Member
From: Russia:Germany
Registered: 2011-07-14
Posts: 3

Re: luakit browser framework (almost with jQuery!)

Since I've begun using luakit as my "light" browser I'm experiencing a painful issue. When I open an arbitrary download link, the "Save as..." dialog appears. However, the content of the dialog window is not being rendered, just the window frame fulfilled with gray is. How could I fix that?

The luakit configuration is default, the package version is 2012.03.25-2, the recent one. I use awesome WM as my WM.

Thanks for any hints!

Offline

#871 2012-05-05 00:57:11

rlevArch
Member
Registered: 2011-12-04
Posts: 35

Re: luakit browser framework (almost with jQuery!)

flymster wrote:

Since I've begun using luakit as my "light" browser I'm experiencing a painful issue. When I open an arbitrary download link, the "Save as..." dialog appears. However, the content of the dialog window is not being rendered, just the window frame fulfilled with gray is. How could I fix that?

The luakit configuration is default, the package version is 2012.03.25-2, the recent one. I use awesome WM as my WM.

Thanks for any hints!

I'm experiencing the same issue. The item will download if I just click enter, or cancel if I click esc, but the dialog window itself is grey and blank

Offline

#872 2012-05-05 06:34:16

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

Re: luakit browser framework (almost with jQuery!)

This bug is still there?! That's the reason why I changed the download behavior. Put this code into the ~/.config/luakit/rc.lua (somewhere below downloads.default_dir = os.getenv("HOME") .. "/Downloads") and luakit will immediately download the file to this directory.

downloads.add_signal("download-location", function (uri, file)
    if not file or file == "" then
        file = (string.match(uri, "/([^/]+)$")
        or string.match(uri, "^%w+://(.+)")
        or string.gsub(uri, "/", "_")
        or "untitled")
    end
    return downloads.default_dir .. "/" .. file
end)

Now I love this behavior, moving the files with ranger after the download is an easy and quick task.
Please file a bugreport for this (upstream, not on the archlinux bugtracker!), since it's really annoying! And now that I'm writing about it, luakit used to crash here after the download window appeared in grey and I hit Enter.

Last edited by Army (2012-05-05 06:34:40)

Offline

#873 2012-05-05 12:27:12

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

Re: luakit browser framework (almost with jQuery!)

Another workaround for the download 'bug' that I've found: When you get that grey box, it's because the link is a downloadable file not a url that can be opened.  If you press Esc, then right click on the item/link and select "download linked file" it works as expected giving a proper file dialog.


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

Online

#874 2012-05-06 06:30:07

rlevArch
Member
Registered: 2011-12-04
Posts: 35

Re: luakit browser framework (almost with jQuery!)

Army wrote:

Ok I'll try to make this youtube thingy work.

Hey Army, do you every get youtube links working with youtube-viewer? I just discovered this app, and if you did, I'd appreciate the code.

Thanks!

Offline

#875 2012-05-06 08:54:38

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

Re: luakit browser framework (almost with jQuery!)

Dude that quote is old big_smile No I didn't implement this, because it doesn't make sense anymore (my internet is too slow for youtube). But I know how it can be done, although it's not perfect.

webview.init_funcs.youtube_hook = function (view, w)
    view:add_signal("navigation-request", function (v, uri)
        if string.find(uri, "youtube%.com/watch") then
            luakit.spawn(string.format("youtube-viewer %q", uri))
            return false
        end 
    end)
end

Put this into the ~/.config/luakit/rc.lua, somewhere after the last "require" line (require "go_up").

Last edited by Army (2012-05-06 09:01:30)

Offline

Board footer

Powered by FluxBB