Fix styling according to CONTRIBUTING.md
This commit is contained in:
parent
ac86ebdb38
commit
b9c424c768
|
@ -1,4 +1,4 @@
|
||||||
# Changes in 2.4.0 (WIP)
|
# Changes in 2.4.0
|
||||||
|
|
||||||
IMPORTANT:
|
IMPORTANT:
|
||||||
|
|
||||||
|
@ -18,6 +18,9 @@ Added:
|
||||||
as a stand-alone library.
|
as a stand-alone library.
|
||||||
- `helpers.setcall` for registering functions as widget types.
|
- `helpers.setcall` for registering functions as widget types.
|
||||||
- `headergen` script for automatic generation of copyright notices.
|
- `headergen` script for automatic generation of copyright notices.
|
||||||
|
- `templates` for the ease of adding new widget types.
|
||||||
|
- `CONTRIBUTING.md` which guide contributors through the steps
|
||||||
|
of filing an issue or submitting a patch.
|
||||||
|
|
||||||
Fixed:
|
Fixed:
|
||||||
|
|
||||||
|
|
|
@ -864,6 +864,14 @@ mybattery:buttons(awful.util.table.join(
|
||||||
* [My first awesome](https://awesomewm.org/doc/api/documentation/07-my-first-awesome.md.html)
|
* [My first awesome](https://awesomewm.org/doc/api/documentation/07-my-first-awesome.md.html)
|
||||||
|
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
For details, see CONTRIBUTING.md. Vicious is licensed under GNU GPLv2+,
|
||||||
|
which require all code within the package to be released under
|
||||||
|
a compatible license. All contributors retain their copyright to their code,
|
||||||
|
so please make sure you add your name to the header of every file you touch.
|
||||||
|
|
||||||
|
|
||||||
## Authors
|
## Authors
|
||||||
|
|
||||||
Wicked was written by:
|
Wicked was written by:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env lua
|
#!/usr/bin/env lua
|
||||||
-- copyright header generator
|
-- copyright header generator
|
||||||
-- Copyright (C) 2019 Nguyễn Gia Phong
|
-- Copyright (C) 2019 Nguyễn Gia Phong <vn.mcsinyx@gmail.com>
|
||||||
--
|
--
|
||||||
-- This file is part of Vicious.
|
-- This file is part of Vicious.
|
||||||
--
|
--
|
||||||
|
|
|
@ -123,9 +123,9 @@ end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Set widget type's __call metamethod to given worker function
|
-- {{{ Set widget type's __call metamethod to given worker function
|
||||||
function helpers.setcall(wtype, worker)
|
function helpers.setcall(worker)
|
||||||
return setmetatable(
|
return setmetatable(
|
||||||
wtype, { __call = function(_, ...) return worker(...) end })
|
{}, { __call = function(_, ...) return worker(...) end })
|
||||||
end
|
end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
@ -285,5 +285,4 @@ end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers
|
return helpers
|
||||||
|
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
10
init.lua
10
init.lua
|
@ -35,7 +35,7 @@
|
||||||
local type = type
|
local type = type
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local tonumber = tonumber
|
local tonumber = tonumber
|
||||||
local timer = (type(timer) == 'table' and timer or require("gears.timer"))
|
local timer = type(timer) == "table" and timer or require("gears.timer")
|
||||||
local os = { time = os.time }
|
local os = { time = os.time }
|
||||||
local table = {
|
local table = {
|
||||||
insert = table.insert,
|
insert = table.insert,
|
||||||
|
@ -94,20 +94,22 @@ local function update(widget, reg, disablecache)
|
||||||
return ret or data
|
return ret or data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function topercent(e) return tonumber(e) and tonumber(e) / 100 end
|
||||||
|
|
||||||
local function update_value(data)
|
local function update_value(data)
|
||||||
local fmtd_data = format_data(data)
|
local fmtd_data = format_data(data)
|
||||||
if widget.add_value ~= nil then
|
if widget.add_value ~= nil then
|
||||||
if widget.get_stack ~= nil and widget:get_stack() then
|
if widget.get_stack ~= nil and widget:get_stack() then
|
||||||
for idx, _ in ipairs(widget:get_stack_colors()) do
|
for idx, _ in ipairs(widget:get_stack_colors()) do
|
||||||
if fmtd_data[idx] then
|
if fmtd_data[idx] then
|
||||||
widget:add_value(tonumber(fmtd_data[idx]) and tonumber(fmtd_data[idx]/100), idx)
|
widget:add_value(topercent(fmtd_data[idx]), idx)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
widget:add_value(tonumber(fmtd_data) and tonumber(fmtd_data)/100)
|
widget:add_value(topercent(fmtd_data))
|
||||||
end
|
end
|
||||||
elseif widget.set_value ~= nil then
|
elseif widget.set_value ~= nil then
|
||||||
widget:set_value(tonumber(fmtd_data) and tonumber(fmtd_data)/100)
|
widget:set_value(topercent(fmtd_data))
|
||||||
elseif widget.set_markup ~= nil then
|
elseif widget.set_markup ~= nil then
|
||||||
widget:set_markup(fmtd_data)
|
widget:set_markup(fmtd_data)
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-- template for asynchronous widet types
|
-- template for asynchronous widet types
|
||||||
-- Copyright (C) 2019 Nguyễn Gia Phong
|
-- Copyright (C) 2019 Nguyễn Gia Phong <vn.mcsinyx@gmail.com>
|
||||||
--
|
--
|
||||||
-- This file is part of Vicious.
|
-- This file is part of Vicious.
|
||||||
--
|
--
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-- template for synchronous widet types
|
-- template for synchronous widet types
|
||||||
-- Copyright (C) 2019 Nguyễn Gia Phong
|
-- Copyright (C) 2019 Nguyễn Gia Phong <vn.mcsinyx@gmail.com>
|
||||||
--
|
--
|
||||||
-- This file is part of Vicious.
|
-- This file is part of Vicious.
|
||||||
--
|
--
|
||||||
|
|
|
@ -31,12 +31,8 @@ local math = {
|
||||||
local helpers = require"vicious.helpers"
|
local helpers = require"vicious.helpers"
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- Bat: provides state, charge, remaining time, and wear for a requested battery
|
|
||||||
-- vicious.widgets.bat
|
|
||||||
local bat_linux = {}
|
|
||||||
|
|
||||||
-- {{{ Battery widget type
|
-- {{{ Battery widget type
|
||||||
local function worker(format, warg)
|
return helpers.setcall(function (format, warg)
|
||||||
if not warg then return end
|
if not warg then return end
|
||||||
|
|
||||||
local battery = helpers.pathtotable("/sys/class/power_supply/"..warg)
|
local battery = helpers.pathtotable("/sys/class/power_supply/"..warg)
|
||||||
|
@ -109,7 +105,5 @@ local function worker(format, warg)
|
||||||
end
|
end
|
||||||
|
|
||||||
return {state, percent, time, wear, curpower}
|
return {state, percent, time, wear, curpower}
|
||||||
end
|
end)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers.setcall(bat_linux, worker)
|
|
||||||
|
|
|
@ -32,17 +32,13 @@ local string = {
|
||||||
local helpers = require"vicious.helpers"
|
local helpers = require"vicious.helpers"
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- Cpu: provides CPU usage for all available CPUs/cores
|
|
||||||
-- vicious.widgets.cpu
|
|
||||||
local cpu_linux = {}
|
|
||||||
|
|
||||||
-- Initialize function tables
|
-- Initialize function tables
|
||||||
local cpu_usage = {}
|
local cpu_usage = {}
|
||||||
local cpu_total = {}
|
local cpu_total = {}
|
||||||
local cpu_active = {}
|
local cpu_active = {}
|
||||||
|
|
||||||
-- {{{ CPU widget type
|
-- {{{ CPU widget type
|
||||||
local function worker(format)
|
return helpers.setcall(function ()
|
||||||
local cpu_lines = {}
|
local cpu_lines = {}
|
||||||
|
|
||||||
-- Get CPU stats
|
-- Get CPU stats
|
||||||
|
@ -86,7 +82,5 @@ local function worker(format)
|
||||||
end
|
end
|
||||||
|
|
||||||
return cpu_usage
|
return cpu_usage
|
||||||
end
|
end)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers.setcall(cpu_linux, worker)
|
|
||||||
|
|
|
@ -22,10 +22,6 @@ local tonumber = tonumber
|
||||||
local helpers = require("vicious.helpers")
|
local helpers = require("vicious.helpers")
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- Cpufreq: provides freq, voltage and governor info for a requested CPU
|
|
||||||
-- vicious.widgets.cpufreq
|
|
||||||
local cpufreq_linux = {}
|
|
||||||
|
|
||||||
local GOVERNOR_STATE = {
|
local GOVERNOR_STATE = {
|
||||||
["ondemand\n"] = "↯",
|
["ondemand\n"] = "↯",
|
||||||
["powersave\n"] = "⌁",
|
["powersave\n"] = "⌁",
|
||||||
|
@ -35,7 +31,7 @@ local GOVERNOR_STATE = {
|
||||||
}
|
}
|
||||||
|
|
||||||
-- {{{ CPU frequency widget type
|
-- {{{ CPU frequency widget type
|
||||||
local function worker(format, warg)
|
return helpers.setcall(function (format, warg)
|
||||||
if not warg then return end
|
if not warg then return end
|
||||||
|
|
||||||
local _cpufreq = helpers.pathtotable(
|
local _cpufreq = helpers.pathtotable(
|
||||||
|
@ -68,7 +64,5 @@ local function worker(format, warg)
|
||||||
governor = GOVERNOR_STATE[governor] or governor or "N/A"
|
governor = GOVERNOR_STATE[governor] or governor or "N/A"
|
||||||
|
|
||||||
return {freqv.mhz, freqv.ghz, freqv.mv, freqv.v, governor}
|
return {freqv.mhz, freqv.ghz, freqv.mv, freqv.v, governor}
|
||||||
end
|
end)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers.setcall(cpufreq_linux, worker)
|
|
||||||
|
|
|
@ -24,12 +24,8 @@ local string = { gmatch = string.gmatch }
|
||||||
local helpers = require"vicious.helpers"
|
local helpers = require"vicious.helpers"
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- Cpuinf: provides speed and cache information for all available CPUs/cores
|
|
||||||
-- vicious.widgets.cpuinf
|
|
||||||
local cpuinf_linux = {}
|
|
||||||
|
|
||||||
-- {{{ CPU Information widget type
|
-- {{{ CPU Information widget type
|
||||||
local function worker(format)
|
return helpers.setcall(function ()
|
||||||
local id = nil
|
local id = nil
|
||||||
|
|
||||||
local cpu_info = {} -- Get CPU info
|
local cpu_info = {} -- Get CPU info
|
||||||
|
@ -50,7 +46,5 @@ local function worker(format)
|
||||||
end
|
end
|
||||||
|
|
||||||
return cpu_info
|
return cpu_info
|
||||||
end
|
end)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers.setcall(cpuinf_linux, worker)
|
|
||||||
|
|
|
@ -24,6 +24,6 @@ local os = { date = os.date, time = os.time }
|
||||||
local helpers = require"vicious.helpers"
|
local helpers = require"vicious.helpers"
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers.setcall({}, function (format, warg)
|
return helpers.setcall(function (format, warg)
|
||||||
return os.date(format or nil, warg and os.time()+warg or nil)
|
return os.date(format or nil, warg and os.time()+warg or nil)
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -26,10 +26,6 @@ local os = { time = os.time, difftime = os.difftime }
|
||||||
local helpers = require"vicious.helpers"
|
local helpers = require"vicious.helpers"
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- Disk I/O: provides I/O statistics for requested storage devices
|
|
||||||
-- vicious.widgets.dio
|
|
||||||
local dio_linux = {}
|
|
||||||
|
|
||||||
-- Initialize function tables
|
-- Initialize function tables
|
||||||
local disk_usage = {}
|
local disk_usage = {}
|
||||||
local disk_stats = {}
|
local disk_stats = {}
|
||||||
|
@ -39,7 +35,7 @@ local unit = { ["s"] = 1, ["kb"] = 2, ["mb"] = 2048 }
|
||||||
local time_unit = { ["ms"] = 1, ["s"] = 1000 }
|
local time_unit = { ["ms"] = 1, ["s"] = 1000 }
|
||||||
|
|
||||||
-- {{{ Disk I/O widget type
|
-- {{{ Disk I/O widget type
|
||||||
local function worker(format)
|
return helpers.setcall(function ()
|
||||||
local disk_lines = {}
|
local disk_lines = {}
|
||||||
|
|
||||||
for line in io.lines("/proc/diskstats") do
|
for line in io.lines("/proc/diskstats") do
|
||||||
|
@ -79,7 +75,5 @@ local function worker(format)
|
||||||
disk_stats = disk_lines
|
disk_stats = disk_lines
|
||||||
|
|
||||||
return disk_usage
|
return disk_usage
|
||||||
end
|
end)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers.setcall(dio_linux, worker)
|
|
||||||
|
|
|
@ -24,14 +24,11 @@ local io = { open = io.open }
|
||||||
local helpers = require("vicious.helpers")
|
local helpers = require("vicious.helpers")
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- vicious.widgets.mbox
|
|
||||||
local mbox_all = {}
|
|
||||||
|
|
||||||
-- Initialize variables
|
-- Initialize variables
|
||||||
local subject = "N/A"
|
local subject = "N/A"
|
||||||
|
|
||||||
-- {{{ Mailbox widget type
|
-- {{{ Mailbox widget type
|
||||||
local function worker(format, warg)
|
return helpers.setcall(function (format, warg)
|
||||||
if not warg then return end
|
if not warg then return end
|
||||||
|
|
||||||
local f = io.open(type(warg) == "table" and warg[1] or warg)
|
local f = io.open(type(warg) == "table" and warg[1] or warg)
|
||||||
|
@ -54,7 +51,5 @@ local function worker(format, warg)
|
||||||
end
|
end
|
||||||
|
|
||||||
return { subject }
|
return { subject }
|
||||||
end
|
end)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers.setcall(mbox_all, worker)
|
|
||||||
|
|
|
@ -22,11 +22,8 @@ local io = { open = io.open }
|
||||||
local helpers = require"vicious.helpers"
|
local helpers = require"vicious.helpers"
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- vicious.widgets.mboxc
|
|
||||||
local mboxc_all = {}
|
|
||||||
|
|
||||||
-- {{{ Mbox count widget type
|
-- {{{ Mbox count widget type
|
||||||
local function worker(format, warg)
|
return helpers.setcall(function (format, warg)
|
||||||
if not warg then return end
|
if not warg then return end
|
||||||
|
|
||||||
-- Initialize counters
|
-- Initialize counters
|
||||||
|
@ -62,7 +59,5 @@ local function worker(format, warg)
|
||||||
count.new = count.total - count.old
|
count.new = count.total - count.old
|
||||||
|
|
||||||
return {count.total, count.old, count.new}
|
return {count.total, count.old, count.new}
|
||||||
end
|
end)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers.setcall(mboxc_all, worker)
|
|
||||||
|
|
|
@ -26,12 +26,8 @@ local string = { gmatch = string.gmatch }
|
||||||
local helpers = require"vicious.helpers"
|
local helpers = require"vicious.helpers"
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- Mem: provides RAM and Swap usage statistics
|
|
||||||
-- vicious.widgets.mem
|
|
||||||
local mem_linux = {}
|
|
||||||
|
|
||||||
-- {{{ Memory widget type
|
-- {{{ Memory widget type
|
||||||
local function worker(format)
|
return helpers.setcall(function ()
|
||||||
local _mem = { buf = {}, swp = {} }
|
local _mem = { buf = {}, swp = {} }
|
||||||
|
|
||||||
-- Get MEM info
|
-- Get MEM info
|
||||||
|
@ -60,7 +56,5 @@ local function worker(format)
|
||||||
return {_mem.usep, _mem.inuse, _mem.total, _mem.free,
|
return {_mem.usep, _mem.inuse, _mem.total, _mem.free,
|
||||||
_mem.swp.usep, _mem.swp.inuse, _mem.swp.t, _mem.swp.f,
|
_mem.swp.usep, _mem.swp.inuse, _mem.swp.t, _mem.swp.f,
|
||||||
_mem.bcuse }
|
_mem.bcuse }
|
||||||
end
|
end)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers.setcall(mem_linux, worker)
|
|
||||||
|
|
|
@ -26,10 +26,6 @@ local string = { match = string.match }
|
||||||
local helpers = require("vicious.helpers")
|
local helpers = require("vicious.helpers")
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- Net: provides state and usage statistics of all network interfaces
|
|
||||||
-- vicious.widgets.net
|
|
||||||
local net_linux = {}
|
|
||||||
|
|
||||||
-- Initialize function tables
|
-- Initialize function tables
|
||||||
local nets = {}
|
local nets = {}
|
||||||
-- Variable definitions
|
-- Variable definitions
|
||||||
|
@ -38,7 +34,7 @@ local unit = { ["b"] = 1, ["kb"] = 1024,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- {{{ Net widget type
|
-- {{{ Net widget type
|
||||||
local function worker(format)
|
return helpers.setcall(function ()
|
||||||
local args = {}
|
local args = {}
|
||||||
|
|
||||||
-- Get NET stats
|
-- Get NET stats
|
||||||
|
@ -85,7 +81,5 @@ local function worker(format)
|
||||||
end
|
end
|
||||||
|
|
||||||
return args
|
return args
|
||||||
end
|
end)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers.setcall(net_linux, worker)
|
|
||||||
|
|
|
@ -24,12 +24,8 @@ local os = { time = os.time, date = os.date }
|
||||||
local helpers = require"vicious.helpers"
|
local helpers = require"vicious.helpers"
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- Org: provides agenda statistics for Emacs org-mode
|
|
||||||
-- vicious.widgets.org
|
|
||||||
local org_all = {}
|
|
||||||
|
|
||||||
-- {{{ OrgMode widget type
|
-- {{{ OrgMode widget type
|
||||||
local function worker(format, warg)
|
return helpers.setcall(function (format, warg)
|
||||||
if not warg then return end
|
if not warg then return end
|
||||||
|
|
||||||
-- Compute delays
|
-- Compute delays
|
||||||
|
@ -65,7 +61,5 @@ local function worker(format, warg)
|
||||||
end
|
end
|
||||||
|
|
||||||
return { count.past, count.today, count.soon, count.future }
|
return { count.past, count.today, count.soon, count.future }
|
||||||
end
|
end)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers.setcall(org_all, worker)
|
|
||||||
|
|
|
@ -28,12 +28,8 @@ local string = { gsub = string.gsub }
|
||||||
local helpers = require"vicious.helpers"
|
local helpers = require"vicious.helpers"
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- OS: provides operating system information
|
|
||||||
-- vicious.widgets.os
|
|
||||||
local os_linux = {}
|
|
||||||
|
|
||||||
-- {{{ Operating system widget type
|
-- {{{ Operating system widget type
|
||||||
local function worker(format)
|
return helpers.setcall(function ()
|
||||||
local system = {
|
local system = {
|
||||||
["ostype"] = "N/A",
|
["ostype"] = "N/A",
|
||||||
["hostname"] = "N/A",
|
["hostname"] = "N/A",
|
||||||
|
@ -66,7 +62,5 @@ local function worker(format)
|
||||||
|
|
||||||
return {system["ostype"], system["osrelease"], system["username"],
|
return {system["ostype"], system["osrelease"], system["username"],
|
||||||
system["hostname"], system["entropy"], system["entropy_p"]}
|
system["hostname"], system["entropy"], system["entropy_p"]}
|
||||||
end
|
end)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers.setcall(os_linux, worker)
|
|
||||||
|
|
|
@ -29,15 +29,11 @@ local string = {
|
||||||
local helpers = require"vicious.helpers"
|
local helpers = require"vicious.helpers"
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- Raid: provides state information for a requested RAID array
|
|
||||||
-- vicious.widgets.raid
|
|
||||||
local raid_linux = {}
|
|
||||||
|
|
||||||
-- Initialize function tables
|
-- Initialize function tables
|
||||||
local mddev = {}
|
local mddev = {}
|
||||||
|
|
||||||
-- {{{ RAID widget type
|
-- {{{ RAID widget type
|
||||||
local function worker(format, warg)
|
return helpers.setcall(function (format, warg)
|
||||||
if not warg then return end
|
if not warg then return end
|
||||||
mddev[warg] = {
|
mddev[warg] = {
|
||||||
["found"] = false,
|
["found"] = false,
|
||||||
|
@ -67,7 +63,5 @@ local function worker(format, warg)
|
||||||
f:close()
|
f:close()
|
||||||
|
|
||||||
return {mddev[warg]["assigned"], mddev[warg]["active"]}
|
return {mddev[warg]["assigned"], mddev[warg]["active"]}
|
||||||
end
|
end)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers.setcall(raid_linux, worker)
|
|
||||||
|
|
|
@ -25,12 +25,8 @@ local math = { floor = math.floor }
|
||||||
local helpers = require("vicious.helpers")
|
local helpers = require("vicious.helpers")
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- Thermal: provides temperature levels of ACPI and coretemp thermal zones
|
|
||||||
-- vicious.widgets.thermal
|
|
||||||
local thermal_linux = {}
|
|
||||||
|
|
||||||
-- {{{ Thermal widget type
|
-- {{{ Thermal widget type
|
||||||
local function worker(format, warg)
|
return helpers.setcall(function (format, warg)
|
||||||
if not warg then return end
|
if not warg then return end
|
||||||
|
|
||||||
local zone = { -- Known temperature data sources
|
local zone = { -- Known temperature data sources
|
||||||
|
@ -54,7 +50,5 @@ local function worker(format, warg)
|
||||||
end
|
end
|
||||||
|
|
||||||
return {0}
|
return {0}
|
||||||
end
|
end)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers.setcall(thermal_linux, worker)
|
|
||||||
|
|
|
@ -24,12 +24,8 @@ local string = { match = string.match }
|
||||||
local helpers = require("vicious.helpers")
|
local helpers = require("vicious.helpers")
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- Uptime: provides system uptime and load information
|
|
||||||
-- vicious.widgets.uptime
|
|
||||||
local uptime_linux = {}
|
|
||||||
|
|
||||||
-- {{{ Uptime widget type
|
-- {{{ Uptime widget type
|
||||||
local function worker(format)
|
return helpers.setcall(function ()
|
||||||
local proc = helpers.pathtotable("/proc")
|
local proc = helpers.pathtotable("/proc")
|
||||||
|
|
||||||
-- Get system uptime
|
-- Get system uptime
|
||||||
|
@ -41,7 +37,5 @@ local function worker(format)
|
||||||
local l1, l5, l15 = -- Get load averages for past 1, 5 and 15 minutes
|
local l1, l5, l15 = -- Get load averages for past 1, 5 and 15 minutes
|
||||||
string.match(proc.loadavg, "([%d%.]+)[%s]([%d%.]+)[%s]([%d%.]+)")
|
string.match(proc.loadavg, "([%d%.]+)[%s]([%d%.]+)[%s]([%d%.]+)")
|
||||||
return {up_d, up_h, up_m, l1, l5, l15}
|
return {up_d, up_h, up_m, l1, l5, l15}
|
||||||
end
|
end)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return helpers.setcall(uptime_linux, worker)
|
|
||||||
|
|
Loading…
Reference in New Issue