From 7dc611585a68f6934c9f417869cfd53b830d9c17 Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Thu, 24 Sep 2009 15:36:49 +0200 Subject: Backported 'remote file systems in fs widget are optional' --- fs.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'fs.lua') diff --git a/fs.lua b/fs.lua index 01b74e5..46757ad 100644 --- a/fs.lua +++ b/fs.lua @@ -15,17 +15,18 @@ module("vicious.fs") -- {{{ Filesystem widget type -local function worker(format) +local function worker(format, nfs) + -- Fallback to listing only local file systems + if nfs then nfs = "" else nfs = "--local" end + -- Get data from df - local f = io.popen("LANG=C df -hP") + local f = io.popen("LANG=C df -hP " .. nfs) local fs_info = {} for line in f:lines() do if not line:match("^Filesystem.*") then - -- Format helper can't deal with matrices, so don't setup a - -- table for each mount point, with gmatch local size, used, avail, usep, mount = - -- Instead match all at once, including network file systems + -- Match all at once, including network file systems line:match("^[%w%p]+[%s]+([%d%.]+)[%a]?[%s]+([%d%.]+)[%a]?[%s]+([%d%.]+)[%a]?[%s]+([%d]+)%%[%s]+([%w%p]+)$") fs_info["{"..mount.." size}"] = size -- cgit v1.2.3