From 1685f541154e97b08eb03d7f8fa6426f6a4d7317 Mon Sep 17 00:00:00 2001 From: Mutzi Date: Mon, 17 Mar 2025 16:59:33 +0100 Subject: [PATCH] Removed a few filesystem types from lain fs widget --- lib/lain/widget/fs.lua | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/lain/widget/fs.lua b/lib/lain/widget/fs.lua index 10e830f..39c2294 100644 --- a/lib/lain/widget/fs.lua +++ b/lib/lain/widget/fs.lua @@ -84,9 +84,13 @@ local function factory(args) local notifypaths = {} for _, mount in ipairs(Gio.unix_mounts_get()) do - local path = Gio.unix_mount_get_mount_path(mount) - local root = Gio.File.new_for_path(path) - local info = root:query_filesystem_info(query) + local info, path + local fs_ty = Gio.unix_mount_get_fs_type(mount) + if fs_ty ~= 'autofs' and fs_ty ~= 'efivarfs' and fs_ty ~= 'tmpfs' then + path = Gio.unix_mount_get_mount_path(mount) + local root = Gio.File.new_for_path(path) + info = root:query_filesystem_info(query) + end if info then local size = info:get_attribute_uint64(query_size) @@ -94,7 +98,7 @@ local function factory(args) local free = info:get_attribute_uint64(query_free) if size > 0 then - local units = math.floor(math.log(size) / math.log(1024)) + local units = math.floor(math.log(size / 5) / math.log(1024)) fs_now[path] = { units = fs.units[units], @@ -131,9 +135,9 @@ local function factory(args) end end - local fmt = '%-' .. tostring(pathlen) .. 's %4s\t%6s\t%6s\n' + local fmt = '%-' .. tostring(pathlen) .. 's %4s\t%7s\t%7s\n' local notifytable = { [1] = string.format(fmt, 'path', 'used', 'free', 'size') } - fmt = '\n%-' .. tostring(pathlen) .. 's %3s%%\t%6.2f\t%6.2f %s' + fmt = '\n%-' .. tostring(pathlen) .. 's %3s%%\t%7.2f\t%7.2f %s' for _, path in ipairs(notifypaths) do notifytable[#notifytable + 1] = string.format( fmt,