Update some copyright headers along with style change

Additionall introduce helpers.setcall to replace the cumbersome setmetatable
at the end of most synchronous widget types
This commit is contained in:
Nguyễn Gia Phong 2019-09-05 12:41:38 +07:00
parent 08170d67ff
commit f54f1a7d8e
19 changed files with 358 additions and 122 deletions

View File

@ -16,6 +16,7 @@ Added:
- `helpers.setasyncall` to avoid writing redundant workers for asynchronous
widget types. Note that these workers are only needed in case Vicious is used
as a stand-alone library.
- `helpers.setcall` for registering functions as widget types.
- `headergen` script for automatic generation of copyright notices.
Fixed:

View File

@ -122,6 +122,13 @@ function helpers.wrequire(collection, key)
end
-- }}}
-- {{{ Set widget type's __call metamethod to given worker function
function helpers.setcall(wtype, worker)
return setmetatable(
wtype, { __call = function(_, ...) return worker(...) end })
end
-- }}}
-- {{{ Set __call metamethod to widget type table having async key
function helpers.setasyncall(wtype)
local function worker(format, warg)

View File

@ -1,3 +1,22 @@
-- battery widget type for FreeBSD
-- Copyright (C) 2017-2019 mutlusun <mutlusun@github.com>
-- Copyright (C) 2019 Nguyễn Gia Phong <vn.mcsinyx@gmail.com>
--
-- This file is part of Vicious.
--
-- Vicious is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 2 of the
-- License, or (at your option) any later version.
--
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- {{{ Grab environment
local tonumber = tonumber
local math = { floor = math.floor }

View File

@ -1,26 +1,40 @@
---------------------------------------------------
-- Licensed under the GNU General Public License v2
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
-- * (c) 2013, NormalRa <normalrawr@gmail.com>
---------------------------------------------------
-- battery widget type for GNU/Linux
-- Copyright (C) 2010 Adrian C. <anrxc@sysphere.org>
-- Copyright (C) 2013 NormalRa <normalrawr@gmail.com>
-- Copyright (C) 2017 David Udelson <dru5@cornell.edu>
-- Copyright (C) 2017 Roberto <empijei@users.noreply.github.com>
-- Copyright (C) 2017 mutlusun <mutlusun@github.com>
--
-- This file is part of Vicious.
--
-- Vicious is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 2 of the
-- License, or (at your option) any later version.
--
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- {{{ Grab environment
local tonumber = tonumber
local setmetatable = setmetatable
local string = { format = string.format }
local helpers = require("vicious.helpers")
local math = {
min = math.min,
floor = math.floor
}
-- }}}
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
local function worker(format, warg)
if not warg then return end
@ -45,11 +59,11 @@ local function worker(format, warg)
return {battery_state["Unknown\n"], 0, "N/A", 0, curpower}
end
-- Get state information
local state = battery_state[battery.status] or battery_state["Unknown\n"]
-- Get capacity information
local remaining, capacity, capacity_design
if battery.charge_now then
remaining, capacity = battery.charge_now, battery.charge_full
capacity_design = battery.charge_full_design or capacity
@ -64,8 +78,8 @@ local function worker(format, warg)
local percent = math.min(math.floor(remaining / capacity * 100), 100)
local wear = math.floor(100 - capacity / capacity_design * 100)
-- Get charge information
local rate
if battery.current_now then
rate = tonumber(battery.current_now)
elseif battery.power_now then
@ -78,8 +92,9 @@ local function worker(format, warg)
local time = "N/A"
if rate ~= nil and rate ~= 0 then
local timeleft
if state == "+" then
timeleft = (tonumber(capacity) - tonumber(remaining)) / tonumber(rate)
timeleft = (tonumber(capacity)-tonumber(remaining)) / tonumber(rate)
elseif state == "-" then
timeleft = tonumber(remaining) / tonumber(rate)
else
@ -97,4 +112,4 @@ local function worker(format, warg)
end
-- }}}
return setmetatable(bat_linux, { __call = function(_, ...) return worker(...) end })
return helpers.setcall(bat_linux, worker)

View File

@ -1,6 +1,6 @@
-- bat_openbsd.lua - provide battery information on OpenBSD
-- Copyright (C) 2019 Enric Morales
-- Copyright (C) 2019 Nguyễn Gia Phong
-- battery widget type for OpenBSD
-- Copyright (C) 2019 Enric Morales <me@enric.me>
-- Copyright (C) 2019 Nguyễn Gia Phong <vn.mcsinyx@gmail.com>
--
-- This file is part of Vicious.
--
@ -12,9 +12,9 @@
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU Affero General Public License for more details.
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU Affero General Public License
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- {{{ Grab environment

View File

@ -1,7 +1,22 @@
-----------------------------------------------------------
-- Licensed under the GNU General Public License v2
-- * (c) 2017, JuanKman94 <juan.carlos.menonita@gmail.com>
-----------------------------------------------------------
-- cmus music player widget type
-- Copyright (C) 2017 JuanKman94 <juan.carlos.menonita@gmail.com>
-- Copyright (C) 2017 Joerg Thalheim <joerg@thalheim.io>
-- Copyright (C) 2018-2019 Nguyễn Gia Phong <vn.mcsinyx@gmail.com>
--
-- This file is part of Vicious.
--
-- Vicious is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 2 of the
-- License, or (at your option) any later version.
--
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- {{{ Grab environment
local type = type

View File

@ -1,3 +1,22 @@
-- CPU usage widget type for FreeBSD
-- Copyright (C) 2017,2019 mutlusun <mutlusun@github.com>
-- Copyright (C) 2019 Nguyễn Gia Phong <vn.mcsinyx@gmail.com>
--
-- This file is part of Vicious.
--
-- Vicious is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 2 of the
-- License, or (at your option) any later version.
--
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- {{{ Grab environment
local math = { floor = math.floor }
local string = { gmatch = string.gmatch }
@ -5,7 +24,6 @@ local string = { gmatch = string.gmatch }
local helpers = require("vicious.helpers")
-- }}}
-- Cpu: provides CPU usage for all available CPUs/cores
-- vicious.widgets.cpu_freebsd
local cpu_freebsd = {}

View File

@ -1,28 +1,41 @@
---------------------------------------------------
-- Licensed under the GNU General Public License v2
-- * (c) 2011, Adrian C. <anrxc@sysphere.org>
-- * (c) 2009, Lucas de Vries <lucas@glacicle.com>
-- * (c) 2011, Jörg Thalheim <jthalheim@gmail.com>
---------------------------------------------------
-- CPU usage widget type for GNU/Linux
-- Copyright (C) 2009 Lucas de Vries <lucas@glacicle.com>
-- Copyright (C) 2011 Adrian C. <anrxc@sysphere.org>
-- Copyright (C) 2011 Jörg Thalheim <jthalheim@gmail.com>
-- Copyright (C) 2017 mutlusun <mutlusun@github.com>
--
-- This file is part of Vicious.
--
-- Vicious is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 2 of the
-- License, or (at your option) any later version.
--
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- {{{ Grab environment
local ipairs = ipairs
local io = { open = io.open }
local setmetatable = setmetatable
local math = { floor = math.floor }
local table = { insert = table.insert }
local string = {
sub = string.sub,
gmatch = string.gmatch
}
-- }}}
local helpers = require"vicious.helpers"
-- }}}
-- Cpu: provides CPU usage for all available CPUs/cores
-- vicious.widgets.cpu
local cpu_linux = {}
-- Initialize function tables
local cpu_usage = {}
local cpu_total = {}
@ -52,7 +65,6 @@ local function worker(format)
cpu_active[i] = 0
end
for i, v in ipairs(cpu_lines) do
-- Calculate totals
local total_new = 0
@ -77,4 +89,4 @@ local function worker(format)
end
-- }}}
return setmetatable(cpu_linux, { __call = function(_, ...) return worker(...) end })
return helpers.setcall(cpu_linux, worker)

View File

@ -1,14 +1,31 @@
-- CPU frequency widget type for FreeBSD
-- Copyright (C) 2017,2019 mutlusun <mutlusun@github.com>
-- Copyright (C) 2019 Nguyễn Gia Phong <vn.mcsinyx@gmail.com>
--
-- This file is part of Vicious.
--
-- Vicious is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 2 of the
-- License, or (at your option) any later version.
--
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- {{{ Grab environment
local tonumber = tonumber
local helpers = require("vicious.helpers")
-- }}}
-- Cpufreq: provides freq, voltage and governor info for a requested CPU
-- vicious.widgets.cpufreq
local cpufreq_freebsd = {}
-- {{{ CPU frequency widget type
function cpufreq_freebsd.async(format, warg, callback)
if not warg then return callback({}) end

View File

@ -1,33 +1,45 @@
---------------------------------------------------
-- Licensed under the GNU General Public License v2
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
---------------------------------------------------
-- CPU frequency widget type for GNU/Linux
-- Copyright (C) 2010 Adrian C. <anrxc@sysphere.org>
-- Copyright (C) 2017 mutlusun <mutlusun@github.com>
--
-- This file is part of Vicious.
--
-- Vicious is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 2 of the
-- License, or (at your option) any later version.
--
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- {{{ Grab environment
local tonumber = tonumber
local setmetatable = setmetatable
local string = { match = string.match }
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 = {
["ondemand\n"] = "",
["powersave\n"] = "",
["userspace\n"] = "¤",
["performance\n"] = "",
["conservative\n"] = ""
}
-- {{{ CPU frequency widget type
local function worker(format, warg)
if not warg then return end
local _cpufreq = helpers.pathtotable("/sys/devices/system/cpu/"..warg.."/cpufreq")
local governor_state = {
["ondemand\n"] = "",
["powersave\n"] = "",
["userspace\n"] = "¤",
["performance\n"] = "",
["conservative\n"] = ""
}
local _cpufreq = helpers.pathtotable(
("/sys/devices/system/cpu/%s/cpufreq"):format(warg))
-- Default frequency and voltage values
local freqv = {
["mhz"] = "N/A", ["ghz"] = "N/A",
@ -43,7 +55,8 @@ local function worker(format, warg)
-- Get the current voltage
if _cpufreq.scaling_voltages then
freqv.mv = tonumber(string.match(_cpufreq.scaling_voltages, freq.."[%s]([%d]+)"))
freqv.mv = tonumber(
_cpufreq.scaling_voltages:match(freq .. "[%s]([%d]+)"))
-- Calculate voltage from mV
freqv.v = freqv.mv / 1000
end
@ -52,10 +65,10 @@ local function worker(format, warg)
-- Get the current governor
local governor = _cpufreq.scaling_governor
-- Represent the governor as a symbol
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}
end
-- }}}
return setmetatable(cpufreq_linux, { __call = function(_, ...) return worker(...) end })
return helpers.setcall(cpufreq_linux, worker)

View File

@ -1,21 +1,33 @@
---------------------------------------------------
-- Licensed under the GNU General Public License v2
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
---------------------------------------------------
-- CPU information widget type for GNU/Linux
-- Copyright (C) 2010 Adrian C. <anrxc@sysphere.org>
-- Copyright (C) 2017 mutlusun <mutlusun@github.com>
--
-- This file is part of Vicious.
--
-- Vicious is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 2 of the
-- License, or (at your option) any later version.
--
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- {{{ Grab environment
local tonumber = tonumber
local io = { lines = io.lines }
local setmetatable = setmetatable
local string = { gmatch = string.gmatch }
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
local function worker(format)
local id = nil
@ -41,4 +53,4 @@ local function worker(format)
end
-- }}}
return setmetatable(cpuinf_linux, { __call = function(_, ...) return worker(...) end })
return helpers.setcall(cpuinf_linux, worker)

View File

@ -1,27 +1,29 @@
---------------------------------------------------
-- Licensed under the GNU General Public License v2
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
-- * (c) 2009, Lucas de Vries <lucas@glacicle.com>
---------------------------------------------------
-- date and time widget type using os.date with optional time formatting
-- Copyright (C) 2009 Lucas de Vries <lucas@glacicle.com>
-- Copyright (C) 2010 Adrian C. <anrxc@sysphere.org>
-- Copyright (C) 2017 mutlusun <mutlusun@github.com>
-- Copyright (C) 2019 Nguyễn Gia Phong <vn.mcsinyx@gmail.com>
--
-- This file is part of Vicious.
--
-- Vicious is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 2 of the
-- License, or (at your option) any later version.
--
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- {{{ Grab environment
local setmetatable = setmetatable
local os = {
date = os.date,
time = os.time
}
local os = { date = os.date, time = os.time }
local helpers = require"vicious.helpers"
-- }}}
-- Date: provides access to os.date with optional time formatting
-- vicious.widgets.date
local date_all = {}
-- {{{ Date widget type
local function worker(format, warg)
return helpers.setcall({}, function (format, warg)
return os.date(format or nil, warg and os.time()+warg or nil)
end
-- }}}
return setmetatable(date_all, { __call = function(_, ...) return worker(...) end })
end)

View File

@ -1,26 +1,35 @@
---------------------------------------------------
-- Licensed under the GNU General Public License v2
-- * (c) 2011, Jörg T. <jthalheim@gmail.com>
---------------------------------------------------
-- disk I/O widget type for GNU/Linux
-- Copyright (C) 2011 Jörg T. <jthalheim@gmail.com>
-- Copyright (C) 2017 Elric Milon <whirm@gmx.com>
-- Copyright (C) 2017 mutlusun <mutlusun@github.com>
--
-- This file is part of Vicious.
--
-- Vicious is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 2 of the
-- License, or (at your option) any later version.
--
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- {{{ Grab environment
local pairs = pairs
local io = { lines = io.lines }
local setmetatable = setmetatable
local string = { match = string.match }
local helpers = require("vicious.helpers")
local os = {
time = os.time,
difftime = os.difftime
}
-- }}}
local os = { time = os.time, difftime = os.difftime }
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
local disk_usage = {}
local disk_stats = {}
@ -36,7 +45,7 @@ local function worker(format)
for line in io.lines("/proc/diskstats") do
local device, read, write, iotime =
-- Linux kernel documentation: Documentation/iostats.txt
string.match(line, "([^%s]+) %d+ %d+ (%d+) %d+ %d+ %d+ (%d+) %d+ %d+ (%d+)")
line:match"([^%s]+) %d+ %d+ (%d+) %d+ %d+ %d+ (%d+) %d+ %d+ (%d+)"
disk_lines[device] = { read, write, iotime }
end
@ -50,7 +59,7 @@ local function worker(format)
-- Check for overflows and counter resets (> 2^32)
if stats[1] < last_stats[1] or stats[2] < last_stats[2] then
last_stats[1], last_stats[2], last_stats[3] = stats[1], stats[2], stats[3]
for i = 1,3 do last_stats[i] = stats[i] end
end
-- Diskstats are absolute, substract our last reading
@ -73,4 +82,4 @@ local function worker(format)
end
-- }}}
return setmetatable(dio_linux, { __call = function(_, ...) return worker(...) end })
return helpers.setcall(dio_linux, worker)

View File

@ -1,3 +1,22 @@
-- fan speed widget type for FreeBSD
-- Copyright (C) 2017,2019 mutlusun <mutlusun@github.com>
-- Copyright (C) 2019 Nguyễn Gia Phong <vn.mcsinyx@gmail.com>
--
-- This file is part of Vicious.
--
-- Vicious is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 2 of the
-- License, or (at your option) any later version.
--
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- {{{ Grab environment
local tonumber = tonumber
local type = type
@ -5,7 +24,6 @@ local type = type
local helpers = require("vicious.helpers")
-- }}}
-- fanspeed: provides speed level of fans
-- vicious.widgets.fanspeed
--

View File

@ -1,8 +1,24 @@
---------------------------------------------------
-- Licensed under the GNU General Public License v2
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
-- * (c) 2009, Lucas de Vries <lucas@glacicle.com>
---------------------------------------------------
-- filesystem widget type
-- Copyright (C) 2009 Lucas de Vries <lucas@glacicle.com>
-- Copyright (C) 2010 Adrian C. <anrxc@sysphere.org>
-- Copyright (C) 2017 Joerg Thalheim <joerg@thalheim.io>
-- Copyright (C) 2017 mutlusun <mutlusun@github.com>
-- Copyright (C) 2019 Nguyễn Gia Phong <vn.mcsinyx@gmail.com>
--
-- This file is part of Vicious.
--
-- Vicious is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 2 of the
-- License, or (at your option) any later version.
--
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- {{{ Grab environment
local tonumber = tonumber

View File

@ -1,7 +1,23 @@
---------------------------------------------------
-- Licensed under the GNU General Public License v2
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
---------------------------------------------------
-- new e-mails count and last e-mail subject on Gmail
-- Copyright (C) 2010 Adrian C. <anrxc@sysphere.org>
-- Copyright (C) 2017 mutlusun <mutlusun@github.com>
-- Copyright (C) 2017 starenka <starenka0@gmail.com>
-- Copyright (C) 2018-2019 Nguyễn Gia Phong <vn.mcsinyx@gmail.com>
--
-- This file is part of Vicious.
--
-- Vicious is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 2 of the
-- License, or (at your option) any later version.
--
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- {{{ Grab environment
local type = type
@ -12,7 +28,6 @@ local helpers = require("vicious.helpers")
local spawn = require("vicious.spawn")
-- }}}
-- Gmail: provides count of new and subject of last e-mail on Gmail
-- vicious.widgets.gmail
local gmail_all = {}

View File

@ -1,7 +1,22 @@
---------------------------------------------------
-- Licensed under the GNU General Public License v2
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
---------------------------------------------------
-- hard drive temperatures widget type using hddtemp daemon
-- Copyright (C) 2010 Adrian C. <anrxc@sysphere.org>
-- Copyright (C) 2017 mutlusun <mutlusun@github.com>
-- Copyright (C) 2019 Nguyễn Gia Phong <vn.mcsinyx@gmail.com>
--
-- This file is part of Vicious.
--
-- Vicious is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 2 of the
-- License, or (at your option) any later version.
--
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- {{{ Grab environment
local tonumber = tonumber
@ -10,7 +25,6 @@ local helpers = require"vicious.helpers"
local spawn = require"vicious.spawn"
-- }}}
-- Hddtemp: provides hard drive temperatures using the hddtemp daemon
-- vicious.widgets.hddtemp
return helpers.setasyncall{

View File

@ -1,7 +1,21 @@
----------------------------------------------------------------
-- Licensed under the GNU General Public License v2
-- (C) 2019, Alexander Koch <lynix47@gmail.com>
----------------------------------------------------------------
-- widget type providing name-indexed temperatures from /sys/class/hwmon
-- Copyright (C) 2019 Alexander Koch <lynix47@gmail.com>
-- Copyright (C) 2019 Nguyễn Gia Phong <vn.mcsinyx@gmail.com>
--
-- This file is part of Vicious.
--
-- Vicious is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 2 of the
-- License, or (at your option) any later version.
--
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- environment
local type = type

View File

@ -1,5 +1,24 @@
-- widget types initialization
-- Copyright (C) 2010 Adrian C. (anrxc) <anrxc@sysphere.org>
-- Copyright (C) 2011,2012 Jörg Thalheim <jthalheim@gmail.com>
-- Copyright (C) 2012 Arvydas Sidorenko <asido4@gmail.com>
--
-- This file is part of Vicious.
--
-- Vicious is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 2 of the
-- License, or (at your option) any later version.
--
-- Vicious is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
local setmetatable = setmetatable
local wrequire = require("vicious.helpers").wrequire
widgets = { _NAME = "vicious.widgets" }
return setmetatable(widgets, {__index = wrequire})
return setmetatable({ _NAME = "vicious.widgets" }, { __index = wrequire })