diff --git a/Changes.md b/Changes.md index ee03d38..a027dd4 100644 --- a/Changes.md +++ b/Changes.md @@ -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: diff --git a/helpers.lua b/helpers.lua index 523e73a..9598a12 100644 --- a/helpers.lua +++ b/helpers.lua @@ -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) diff --git a/widgets/bat_freebsd.lua b/widgets/bat_freebsd.lua index c6e743c..384f643 100644 --- a/widgets/bat_freebsd.lua +++ b/widgets/bat_freebsd.lua @@ -1,3 +1,22 @@ +-- battery widget type for FreeBSD +-- Copyright (C) 2017-2019 mutlusun +-- Copyright (C) 2019 Nguyễn Gia Phong +-- +-- 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 . + -- {{{ Grab environment local tonumber = tonumber local math = { floor = math.floor } diff --git a/widgets/bat_linux.lua b/widgets/bat_linux.lua index db81961..39352b4 100644 --- a/widgets/bat_linux.lua +++ b/widgets/bat_linux.lua @@ -1,26 +1,40 @@ ---------------------------------------------------- --- Licensed under the GNU General Public License v2 --- * (c) 2010, Adrian C. --- * (c) 2013, NormalRa ---------------------------------------------------- +-- battery widget type for GNU/Linux +-- Copyright (C) 2010 Adrian C. +-- Copyright (C) 2013 NormalRa +-- Copyright (C) 2017 David Udelson +-- Copyright (C) 2017 Roberto +-- Copyright (C) 2017 mutlusun +-- +-- 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 . -- {{{ 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) diff --git a/widgets/bat_openbsd.lua b/widgets/bat_openbsd.lua index ced83d8..689e836 100644 --- a/widgets/bat_openbsd.lua +++ b/widgets/bat_openbsd.lua @@ -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 +-- Copyright (C) 2019 Nguyễn Gia Phong -- -- 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 . -- {{{ Grab environment diff --git a/widgets/cmus_all.lua b/widgets/cmus_all.lua index 25c1a9a..e0b046e 100644 --- a/widgets/cmus_all.lua +++ b/widgets/cmus_all.lua @@ -1,7 +1,22 @@ ------------------------------------------------------------ --- Licensed under the GNU General Public License v2 --- * (c) 2017, JuanKman94 ------------------------------------------------------------ +-- cmus music player widget type +-- Copyright (C) 2017 JuanKman94 +-- Copyright (C) 2017 Joerg Thalheim +-- Copyright (C) 2018-2019 Nguyễn Gia Phong +-- +-- 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 . -- {{{ Grab environment local type = type diff --git a/widgets/cpu_freebsd.lua b/widgets/cpu_freebsd.lua index 972eca0..63809e9 100644 --- a/widgets/cpu_freebsd.lua +++ b/widgets/cpu_freebsd.lua @@ -1,3 +1,22 @@ +-- CPU usage widget type for FreeBSD +-- Copyright (C) 2017,2019 mutlusun +-- Copyright (C) 2019 Nguyễn Gia Phong +-- +-- 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 . + -- {{{ 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 = {} diff --git a/widgets/cpu_linux.lua b/widgets/cpu_linux.lua index 99ec1b2..3ac8734 100644 --- a/widgets/cpu_linux.lua +++ b/widgets/cpu_linux.lua @@ -1,28 +1,41 @@ ---------------------------------------------------- --- Licensed under the GNU General Public License v2 --- * (c) 2011, Adrian C. --- * (c) 2009, Lucas de Vries --- * (c) 2011, Jörg Thalheim ---------------------------------------------------- +-- CPU usage widget type for GNU/Linux +-- Copyright (C) 2009 Lucas de Vries +-- Copyright (C) 2011 Adrian C. +-- Copyright (C) 2011 Jörg Thalheim +-- Copyright (C) 2017 mutlusun +-- +-- 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 . -- {{{ 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) diff --git a/widgets/cpufreq_freebsd.lua b/widgets/cpufreq_freebsd.lua index 6acf2f0..ea20663 100644 --- a/widgets/cpufreq_freebsd.lua +++ b/widgets/cpufreq_freebsd.lua @@ -1,14 +1,31 @@ +-- CPU frequency widget type for FreeBSD +-- Copyright (C) 2017,2019 mutlusun +-- Copyright (C) 2019 Nguyễn Gia Phong +-- +-- 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 . + -- {{{ 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 diff --git a/widgets/cpufreq_linux.lua b/widgets/cpufreq_linux.lua index 4cac998..b956bf3 100644 --- a/widgets/cpufreq_linux.lua +++ b/widgets/cpufreq_linux.lua @@ -1,33 +1,45 @@ ---------------------------------------------------- --- Licensed under the GNU General Public License v2 --- * (c) 2010, Adrian C. ---------------------------------------------------- +-- CPU frequency widget type for GNU/Linux +-- Copyright (C) 2010 Adrian C. +-- Copyright (C) 2017 mutlusun +-- +-- 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 . -- {{{ 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) diff --git a/widgets/cpuinf_linux.lua b/widgets/cpuinf_linux.lua index 11a7012..afb5ce2 100644 --- a/widgets/cpuinf_linux.lua +++ b/widgets/cpuinf_linux.lua @@ -1,21 +1,33 @@ ---------------------------------------------------- --- Licensed under the GNU General Public License v2 --- * (c) 2010, Adrian C. ---------------------------------------------------- +-- CPU information widget type for GNU/Linux +-- Copyright (C) 2010 Adrian C. +-- Copyright (C) 2017 mutlusun +-- +-- 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 . -- {{{ 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) diff --git a/widgets/date_all.lua b/widgets/date_all.lua index afcf085..0c29c80 100644 --- a/widgets/date_all.lua +++ b/widgets/date_all.lua @@ -1,27 +1,29 @@ ---------------------------------------------------- --- Licensed under the GNU General Public License v2 --- * (c) 2010, Adrian C. --- * (c) 2009, Lucas de Vries ---------------------------------------------------- +-- date and time widget type using os.date with optional time formatting +-- Copyright (C) 2009 Lucas de Vries +-- Copyright (C) 2010 Adrian C. +-- Copyright (C) 2017 mutlusun +-- Copyright (C) 2019 Nguyễn Gia Phong +-- +-- 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 . -- {{{ 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) diff --git a/widgets/dio_linux.lua b/widgets/dio_linux.lua index 82fa50f..25d2578 100644 --- a/widgets/dio_linux.lua +++ b/widgets/dio_linux.lua @@ -1,26 +1,35 @@ ---------------------------------------------------- --- Licensed under the GNU General Public License v2 --- * (c) 2011, Jörg T. ---------------------------------------------------- +-- disk I/O widget type for GNU/Linux +-- Copyright (C) 2011 Jörg T. +-- Copyright (C) 2017 Elric Milon +-- Copyright (C) 2017 mutlusun +-- +-- 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 . -- {{{ 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) diff --git a/widgets/fanspeed_freebsd.lua b/widgets/fanspeed_freebsd.lua index a60b272..818a4ba 100644 --- a/widgets/fanspeed_freebsd.lua +++ b/widgets/fanspeed_freebsd.lua @@ -1,3 +1,22 @@ +-- fan speed widget type for FreeBSD +-- Copyright (C) 2017,2019 mutlusun +-- Copyright (C) 2019 Nguyễn Gia Phong +-- +-- 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 . + -- {{{ 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 -- diff --git a/widgets/fs_all.lua b/widgets/fs_all.lua index 9c4e5d0..e1c672d 100644 --- a/widgets/fs_all.lua +++ b/widgets/fs_all.lua @@ -1,8 +1,24 @@ ---------------------------------------------------- --- Licensed under the GNU General Public License v2 --- * (c) 2010, Adrian C. --- * (c) 2009, Lucas de Vries ---------------------------------------------------- +-- filesystem widget type +-- Copyright (C) 2009 Lucas de Vries +-- Copyright (C) 2010 Adrian C. +-- Copyright (C) 2017 Joerg Thalheim +-- Copyright (C) 2017 mutlusun +-- Copyright (C) 2019 Nguyễn Gia Phong +-- +-- 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 . -- {{{ Grab environment local tonumber = tonumber diff --git a/widgets/gmail_all.lua b/widgets/gmail_all.lua index 7e897b8..f885104 100644 --- a/widgets/gmail_all.lua +++ b/widgets/gmail_all.lua @@ -1,7 +1,23 @@ ---------------------------------------------------- --- Licensed under the GNU General Public License v2 --- * (c) 2010, Adrian C. ---------------------------------------------------- +-- new e-mails count and last e-mail subject on Gmail +-- Copyright (C) 2010 Adrian C. +-- Copyright (C) 2017 mutlusun +-- Copyright (C) 2017 starenka +-- Copyright (C) 2018-2019 Nguyễn Gia Phong +-- +-- 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 . -- {{{ 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 = {} diff --git a/widgets/hddtemp_linux.lua b/widgets/hddtemp_linux.lua index b381f2f..f3a11df 100644 --- a/widgets/hddtemp_linux.lua +++ b/widgets/hddtemp_linux.lua @@ -1,7 +1,22 @@ ---------------------------------------------------- --- Licensed under the GNU General Public License v2 --- * (c) 2010, Adrian C. ---------------------------------------------------- +-- hard drive temperatures widget type using hddtemp daemon +-- Copyright (C) 2010 Adrian C. +-- Copyright (C) 2017 mutlusun +-- Copyright (C) 2019 Nguyễn Gia Phong +-- +-- 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 . -- {{{ 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{ diff --git a/widgets/hwmontemp_linux.lua b/widgets/hwmontemp_linux.lua index 9182932..7631dc9 100644 --- a/widgets/hwmontemp_linux.lua +++ b/widgets/hwmontemp_linux.lua @@ -1,7 +1,21 @@ ----------------------------------------------------------------- --- Licensed under the GNU General Public License v2 --- (C) 2019, Alexander Koch ----------------------------------------------------------------- +-- widget type providing name-indexed temperatures from /sys/class/hwmon +-- Copyright (C) 2019 Alexander Koch +-- Copyright (C) 2019 Nguyễn Gia Phong +-- +-- 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 . -- environment local type = type diff --git a/widgets/init.lua b/widgets/init.lua index 5d3b246..61b8590 100644 --- a/widgets/init.lua +++ b/widgets/init.lua @@ -1,5 +1,24 @@ +-- widget types initialization +-- Copyright (C) 2010 Adrian C. (anrxc) +-- Copyright (C) 2011,2012 Jörg Thalheim +-- Copyright (C) 2012 Arvydas Sidorenko +-- +-- 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 . +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 })