Cleanup widgets that use pathtotable helper
This commit is contained in:
parent
76942d17a4
commit
1d0cfd3aed
6
bat.lua
6
bat.lua
|
@ -21,11 +21,7 @@ module("vicious.bat")
|
||||||
|
|
||||||
-- {{{ Battery widget type
|
-- {{{ Battery widget type
|
||||||
local function worker(format, batid)
|
local function worker(format, batid)
|
||||||
local battery = setmetatable(
|
local battery = helpers.pathtotable("/sys/class/power_supply/" .. batid)
|
||||||
{ _path = "/sys/class/power_supply/" .. batid },
|
|
||||||
helpers.pathtotable
|
|
||||||
)
|
|
||||||
|
|
||||||
local battery_state = {
|
local battery_state = {
|
||||||
["Full\n"] = "↯",
|
["Full\n"] = "↯",
|
||||||
["Unknown\n"] = "⌁",
|
["Unknown\n"] = "⌁",
|
||||||
|
|
|
@ -17,11 +17,7 @@ module("vicious.cpufreq")
|
||||||
|
|
||||||
-- {{{ CPU frequency widget type
|
-- {{{ CPU frequency widget type
|
||||||
local function worker(format, cpuid)
|
local function worker(format, cpuid)
|
||||||
local cpufreq = setmetatable(
|
local cpufreq = helpers.pathtotable("/sys/devices/system/cpu/"..cpuid.."/cpufreq")
|
||||||
{ _path = "/sys/devices/system/cpu/"..cpuid.."/cpufreq"},
|
|
||||||
helpers.pathtotable
|
|
||||||
)
|
|
||||||
|
|
||||||
local governor_state = {
|
local governor_state = {
|
||||||
["ondemand\n"] = "↯",
|
["ondemand\n"] = "↯",
|
||||||
["powersave\n"] = "⌁",
|
["powersave\n"] = "⌁",
|
||||||
|
|
5
dio.lua
5
dio.lua
|
@ -27,10 +27,7 @@ local disk_total = {}
|
||||||
-- {{{ Disk I/O widget type
|
-- {{{ Disk I/O widget type
|
||||||
local function worker(format, disk)
|
local function worker(format, disk)
|
||||||
local disk_lines = {}
|
local disk_lines = {}
|
||||||
local disk_stats = setmetatable(
|
local disk_stats = helpers.pathtotable("/sys/block/" .. disk)
|
||||||
{ _path = "/sys/block/" .. disk },
|
|
||||||
helpers.pathtotable
|
|
||||||
)
|
|
||||||
|
|
||||||
if disk_stats.stat then
|
if disk_stats.stat then
|
||||||
local match = string.gmatch(disk_stats.stat, "[%s]+([%d]+)")
|
local match = string.gmatch(disk_stats.stat, "[%s]+([%d]+)")
|
||||||
|
|
|
@ -17,10 +17,7 @@ module("vicious.entropy")
|
||||||
|
|
||||||
-- {{{ Entropy widget type
|
-- {{{ Entropy widget type
|
||||||
local function worker(format)
|
local function worker(format)
|
||||||
local random = setmetatable(
|
local random = helpers.pathtotable("/proc/sys/kernel/random")
|
||||||
{ _path = "/proc/sys/kernel/random"},
|
|
||||||
helpers.pathtotable
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Linux 2.6 has a default entropy pool of 4096-bits
|
-- Linux 2.6 has a default entropy pool of 4096-bits
|
||||||
local poolsize = tonumber(random.poolsize)
|
local poolsize = tonumber(random.poolsize)
|
||||||
|
|
|
@ -15,10 +15,7 @@ module("vicious.thermal")
|
||||||
|
|
||||||
-- {{{ Thermal widget type
|
-- {{{ Thermal widget type
|
||||||
local function worker(format, thermal_zone)
|
local function worker(format, thermal_zone)
|
||||||
local thermal = setmetatable(
|
local thermal = helpers.pathtotable("/sys/class/thermal/"..thermal_zone)
|
||||||
{ _path = "/sys/class/thermal/" .. thermal_zone },
|
|
||||||
helpers.pathtotable
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Get ACPI thermal zone
|
-- Get ACPI thermal zone
|
||||||
if thermal.temp then
|
if thermal.temp then
|
||||||
|
|
|
@ -18,10 +18,7 @@ module("vicious.uptime")
|
||||||
|
|
||||||
-- {{{ Uptime widget type
|
-- {{{ Uptime widget type
|
||||||
local function worker(format)
|
local function worker(format)
|
||||||
local proc = setmetatable(
|
local proc = helpers.pathtotable("/proc")
|
||||||
{ _path = "/proc" },
|
|
||||||
helpers.pathtotable
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Get system uptime
|
-- Get system uptime
|
||||||
local up_t = math.floor(string.match(proc.uptime, "[%d]+"))
|
local up_t = math.floor(string.match(proc.uptime, "[%d]+"))
|
||||||
|
|
Loading…
Reference in New Issue