diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-09-14 20:55:53 +0200 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-09-14 20:55:53 +0200 |
commit | 549c8bc5ba8bba9501915c2ba1303955a44de0be (patch) | |
tree | 7c98b90d2f846bf711d7331aa4acdd1f4a5b76a1 /fs.lua | |
parent | 2a5126f4f0c0a3e073becb98f49499363072643d (diff) | |
download | vicious-legacy-549c8bc5ba8bba9501915c2ba1303955a44de0be.tar.xz |
Remote file systems in fs widget are optional
By default only local file systems are included now. In case a mounted
NFS share dissapears from the network the widget would be left hanging
there and has the potential to block everything else (including
awesome it self). File system widget now takes an optional argument
which, if true, will include remote file systems.
Diffstat (limited to 'fs.lua')
-rw-r--r-- | fs.lua | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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 |