Guest User

Untitled

a guest
Apr 18th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.13 KB | None | 0 0
  1.  
  2.  
  3. -- conky lua script to display mounted drives and of the sort.
  4. -- made by Dre k West, !GGGentooDY
  5. function trim(s)
  6.   return (s:gsub("^%s*(.-)%s*$", "%1"))
  7. end
  8.  
  9. function conky_filesystemlist(size)
  10.  
  11.     local rtvar = ""
  12.     local df_output = io.popen("df")
  13.  
  14.     for line in df_output:lines() do
  15.        
  16.         --we find where its mounted:
  17.         p = string.find(line,"%",1,true) --plain search
  18.         p = p+2 -- we want to get past the "% "
  19.  
  20.         dir = trim(string.sub(line,p))
  21.         --print( dir)
  22.         local exclude_dirs = { "/","/dev","/dev/shm", "/lib64/rc/init.d", "/home"  }
  23.        
  24.         if not ( dir == "Mounted on" or
  25.             dir == "/" or
  26.             dir == "/dev" or
  27.             dir == "/dev/shm" or
  28.             dir == "/lib64/rc/init.d" or
  29.             dir == "/home") then
  30.            
  31.             rtvar = rtvar .. "${fs_bar "..size.." " .. dir .."}\n"
  32.             rtvar = rtvar .. dir .. " $alignr ${fs_used " .. dir .."} / ${fs_size " .. dir .. "}\n\n"
  33.         end
  34.         --print( p)    
  35.         --return_str = return_str .. "${fs_bar 4 " .. line
  36.     end
  37.     io.close(df_output)
  38.     return rtvar
  39.  
  40. end
  41.  
  42. function conky_kernellog()
  43.     local rtvar = ""
  44.  
  45.     for line in io.popen("dmesg | tail")do
  46.         rtvar = rtvar .. line
  47.     end
  48.     return rtvar
  49. end
Add Comment
Please, Sign In to add comment