On Tue, 19 Apr 2011 20:31:08 +0200, "Adrian C." <[email protected]> wrote:
> On Tue, 19 Apr 2011, Pieter Praet wrote:
>
> > > > vicious.register(memwidget, vicious.widgets.mem, "" .. colwhi .. "swap
> > >
> > > You mean swapwidget, right?
> >
> > Nope, he does mean memwidget.
>
> No.
Yes. :)
$ file src/vicious/widgets/{swap,swp,mem}.lua
src/vicious/widgets/swap.lua: ERROR: cannot open `src/vicious/widgets/swap.lua'
(No such file or directory)
src/vicious/widgets/swp.lua: ERROR: cannot open `src/vicious/widgets/swp.lua'
(No such file or directory)
src/vicious/widgets/mem.lua: ASCII English text
$ cat -n src/vicious/widgets/mem.lua | sed -n '23,34p'
23 -- Get MEM info
24 for line in io.lines("/proc/meminfo") do
25 for k, v in string.gmatch(line, "([%a]+):[%s]+([%d]+).+") do
26 if k == "MemTotal" then mem.total = math.floor(v/1024)
27 elseif k == "MemFree" then mem.buf.f = math.floor(v/1024)
28 elseif k == "Buffers" then mem.buf.b = math.floor(v/1024)
29 elseif k == "Cached" then mem.buf.c = math.floor(v/1024)
30 elseif k == "SwapTotal" then mem.swp.t = math.floor(v/1024)
31 elseif k == "SwapFree" then mem.swp.f = math.floor(v/1024)
32 end
33 end
34 end
> --
> Adrian C. (anrxc) | anrxc..sysphere.org | PGP ID: D20A0618
> PGP FP: 02A5 628A D8EE 2A93 996E 929F D5CB 31B7 D20A 0618
>
> --
> To unsubscribe, send mail to [email protected].
Peace
-Pieter
--
To unsubscribe, send mail to [email protected].