Made module require relative

This commit is contained in:
thomas 2022-06-08 15:45:32 -06:00
parent 4d3025400e
commit dc720f789f
59 changed files with 84 additions and 84 deletions

View File

@ -201,7 +201,7 @@ For example,
local awful = require("awful")
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
String Quotes
^^^^^^^^^^^^^

View File

@ -21,7 +21,7 @@
local tonumber = tonumber
local setmetatable = setmetatable
local string = { format = string.format }
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
local math = {
min = math.min,
floor = math.floor

View File

@ -21,7 +21,7 @@
local tonumber = tonumber
local io = { open = io.open }
local setmetatable = setmetatable
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
local string = {
sub = string.sub,
match = string.match,

View File

@ -20,8 +20,8 @@
-- {{{ Grab environment
local pcall = pcall
local helpers = require("vicious.helpers")
local spawn = require("vicious.spawn")
local helpers = require((...):match(".*vicious") .. ".helpers")
local spawn = require((...):match(".*vicious") .. ".spawn")
local success, json = pcall(require, "cjson")
if not success then

View File

@ -22,7 +22,7 @@ local ipairs = ipairs
local setmetatable = setmetatable
local table = { insert = table.insert }
local string = { gmatch = string.gmatch }
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- }}}

View File

@ -20,11 +20,11 @@
-- {{{ Setup environment
local setmetatable = setmetatable
local wrequire = require("vicious.helpers").wrequire
local wrequire = require((...):match(".*vicious") .. ".helpers").wrequire
-- Vicious: widgets for the awesome window manager
-- vicious.contrib
local contrib = { _NAME = "vicious.contrib" }
local contrib = { _NAME = (...):match(".*vicious") .. ".contrib" }
-- }}}
-- Load modules at runtime as needed

View File

@ -24,7 +24,7 @@ local type = type
local io = { popen = io.popen }
local setmetatable = setmetatable
local string = { find = string.find }
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- }}}

View File

@ -27,7 +27,7 @@ local os = { time = os.time }
local io = { lines = io.lines }
local setmetatable = setmetatable
local string = { match = string.match }
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- }}}

View File

@ -22,7 +22,7 @@ local tonumber = tonumber
local io = { popen = io.popen }
local string = { gmatch = string.gmatch }
local setmetatable = setmetatable
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- }}}

View File

@ -21,8 +21,8 @@
local tonumber = tonumber
local string = {match = string.match}
local math = {ceil = math.ceil, floor = math.floor}
local helpers = require "vicious.helpers"
local spawn = require "vicious.spawn"
local helpers = require (...):match(".*vicious") .. ".helpers"
local spawn = require (...):match(".*vicious") .. ".spawn"
-- }}}
-- Openweather: provides weather information for a requested station

View File

@ -21,7 +21,7 @@
local tonumber = tonumber
local math = { ceil = math.ceil }
local setmetatable = setmetatable
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
local io = {
open = io.open,
popen = io.popen

View File

@ -15,8 +15,8 @@ Or you can load them in your rc.lua after you require Vicious:
.. code-block:: lua
local vicious = require"vicious"
vicious.contrib = require"vicious.contrib"
local vicious = require(...):match(".*vicious") .. ".
vicious.contrib = require(...):match(".*vicious") .. ".contrib"
Widget Types
------------

View File

@ -16,7 +16,7 @@ Then add the following to the top of your ``rc.lua``:
.. code-block:: lua
local vicious = require("vicious")
local vicious = require((...):match(".*vicious") .. ".)
vicious.register
----------------

View File

@ -8,7 +8,7 @@ to be used stand-alone or to feed widgets of any window manager
.. code-block:: lua
> widgets = require("vicious.widgets.init")
> widgets = require((...):match(".*vicious") .. ".widgets.init")
> print(widgets.volume(nil, "Master")[1])
100

View File

@ -48,7 +48,7 @@ local string = {
local table = { concat = table.concat }
local pcall = pcall
local assert = assert
local spawn = require("vicious.spawn")
local spawn = require((...):match(".*vicious") .. ".spawn")
-- }}}

View File

@ -38,7 +38,7 @@ local table = {
insert = table.insert,
remove = table.remove
}
local helpers = require("vicious.helpers")
local helpers = require((...) .. ".helpers")
local dstatus, debug = pcall(require, "gears.debug")
local stderr = io.stderr
local warn
@ -50,8 +50,8 @@ end
-- Vicious: widgets for the awesome window manager
local vicious = {}
vicious.widgets = require("vicious.widgets")
--vicious.contrib = require("vicious.contrib")
vicious.widgets = require((...) .. ".widgets")
--vicious.contrib = require((...) .. ".contrib")
-- Initialize tables
local timers = {}

View File

@ -16,7 +16,7 @@
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
local helpers = require"vicious.helpers"
local helpers = require(...):match(".*vicious") .. ".helpers"
return helpers.setasyncall{
async = function (format, warg, callback)

View File

@ -16,7 +16,7 @@
-- You should have received a copy of the GNU General Public License
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
local helpers = require"vicious.helpers"
local helpers = require(...):match(".*vicious") .. ".helpers"
return helpers.setcall(function (format, warg)
-- Do the processing and return a table here.

View File

@ -25,8 +25,8 @@ local string = {
format = string.format
}
local helpers = require("vicious.helpers")
local spawn = require("vicious.spawn")
local helpers = require((...):match(".*vicious") .. ".helpers")
local spawn = require((...):match(".*vicious") .. ".spawn")
-- }}}
-- Battery: provides battery level of requested battery

View File

@ -28,7 +28,7 @@ local math = {
floor = math.floor
}
local helpers = require"vicious.helpers"
local helpers = require(...):match(".*vicious") .. ".helpers"
-- }}}
-- {{{ Battery widget type

View File

@ -29,7 +29,7 @@ local math = {
modf = math.modf
}
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- }}}
local bat_openbsd = {}

View File

@ -23,8 +23,8 @@ local type = type
local tonumber = tonumber
local os = { getenv = os.getenv }
local helpers = require"vicious.helpers"
local spawn = require"vicious.spawn"
local helpers = require(...):match(".*vicious") .. ".helpers"
local spawn = require(...):match(".*vicious") .. ".spawn"
-- }}}
local CMUS_SOCKET = helpers.shellquote(os.getenv"CMUS_SOCKET")

View File

@ -21,7 +21,7 @@
local math = { floor = math.floor }
local string = { gmatch = string.gmatch }
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- }}}
-- Cpu: provides CPU usage for all available CPUs/cores

View File

@ -29,7 +29,7 @@ local string = {
gmatch = string.gmatch
}
local helpers = require"vicious.helpers"
local helpers = require(...):match(".*vicious") .. ".helpers"
-- }}}
-- Initialize function tables

View File

@ -21,7 +21,7 @@ local string = { gmatch = string.gmatch }
local table = { insert = table.insert }
local tonumber = tonumber
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- cpu_openbsd: provides both a helper function that allows reading

View File

@ -19,7 +19,7 @@
-- {{{ Grab environment
local tonumber = tonumber
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- }}}
-- Cpufreq: provides freq, voltage and governor info for a requested CPU

View File

@ -19,7 +19,7 @@
-- {{{ Grab environment
local tonumber = tonumber
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- }}}
local GOVERNOR_STATE = {

View File

@ -21,7 +21,7 @@
local tonumber = tonumber
local io = { lines = io.lines }
local string = { gmatch = string.gmatch }
local helpers = require"vicious.helpers"
local helpers = require(...):match(".*vicious") .. ".helpers"
-- }}}
-- {{{ CPU Information widget type

View File

@ -21,7 +21,7 @@
-- {{{ Grab environment
local os = { date = os.date, time = os.time }
local helpers = require"vicious.helpers"
local helpers = require(...):match(".*vicious") .. ".helpers"
-- }}}
return helpers.setcall(function (format, warg)

View File

@ -23,7 +23,7 @@ local pairs = pairs
local io = { lines = io.lines }
local os = { time = os.time, difftime = os.difftime }
local helpers = require"vicious.helpers"
local helpers = require(...):match(".*vicious") .. ".helpers"
-- }}}
-- Initialize function tables

View File

@ -21,7 +21,7 @@
local tonumber = tonumber
local type = type
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- }}}
-- fanspeed: provides speed level of fans

View File

@ -23,8 +23,8 @@
-- {{{ Grab environment
local tonumber = tonumber
local helpers = require"vicious.helpers"
local spawn = require"vicious.spawn"
local helpers = require(...):match(".*vicious") .. ".helpers"
local spawn = require(...):match(".*vicious") .. ".spawn"
-- }}}
-- Mebibyte and gibibyte respectively, because backward compatibility

View File

@ -24,8 +24,8 @@ local type = type
local tonumber = tonumber
local string = { match = string.match }
local helpers = require("vicious.helpers")
local spawn = require("vicious.spawn")
local helpers = require((...):match(".*vicious") .. ".helpers")
local spawn = require((...):match(".*vicious") .. ".spawn")
-- }}}
-- Gmail: provides count of new and subject of last e-mail on Gmail

View File

@ -21,8 +21,8 @@
-- {{{ Grab environment
local tonumber = tonumber
local helpers = require"vicious.helpers"
local spawn = require"vicious.spawn"
local helpers = require(...):match(".*vicious") .. ".helpers"
local spawn = require(...):match(".*vicious") .. ".spawn"
-- }}}
-- Hddtemp: provides hard drive temperatures using the hddtemp daemon

View File

@ -22,8 +22,8 @@ local type = type
local tonumber = tonumber
local io = { open = io.open }
local helpers = require"vicious.helpers"
local spawn = require"vicious.spawn"
local helpers = require(...):match(".*vicious") .. ".helpers"
local spawn = require(...):match(".*vicious") .. ".spawn"
local pathcache = {}

View File

@ -19,6 +19,6 @@
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
local setmetatable = setmetatable
local wrequire = require("vicious.helpers").wrequire
local wrequire = require((...):match(".*vicious") .. ".helpers").wrequire
return setmetatable({ _NAME = "vicious.widgets" }, { __index = wrequire })
return setmetatable({ _NAME = (...):match(".*vicious") .. ".widgets" }, { __index = wrequire })

View File

@ -21,7 +21,7 @@
-- {{{ Grab environment
local type = type
local io = { open = io.open }
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- }}}
-- Initialize variables

View File

@ -19,7 +19,7 @@
-- {{{ Grab environment
local io = { open = io.open }
local helpers = require"vicious.helpers"
local helpers = require(...):match(".*vicious") .. ".helpers"
-- }}}
-- {{{ Mbox count widget type

View File

@ -22,8 +22,8 @@
-- {{{ Grab environment
local type = type
local helpers = require"vicious.helpers"
local spawn = require"vicious.spawn"
local helpers = require(...):match(".*vicious") .. ".helpers"
local spawn = require(...):match(".*vicious") .. ".spawn"
-- }}}
-- vicious.widgets.mdir

View File

@ -27,8 +27,8 @@ local string = {
find = string.find
}
local helpers = require("vicious.helpers")
local spawn = require("vicious.spawn")
local helpers = require((...):match(".*vicious") .. ".helpers")
local spawn = require((...):match(".*vicious") .. ".spawn")
-- }}}
-- Mem: provides RAM and Swap usage statistics

View File

@ -23,7 +23,7 @@
local io = { lines = io.lines }
local math = { floor = math.floor }
local string = { gmatch = string.gmatch }
local helpers = require"vicious.helpers"
local helpers = require(...):match(".*vicious") .. ".helpers"
-- }}}
-- {{{ Memory widget type

View File

@ -27,8 +27,8 @@ local tonumber = tonumber
local math = { floor = math.floor }
local type = type
local helpers = require"vicious.helpers"
local spawn = require"vicious.spawn"
local helpers = require(...):match(".*vicious") .. ".helpers"
local spawn = require(...):match(".*vicious") .. ".spawn"
-- }}}
-- Mpd: provides Music Player Daemon information

View File

@ -25,8 +25,8 @@ local string = {
gmatch = string.gmatch
}
local helpers = require("vicious.helpers")
local spawn = require("vicious.spawn")
local helpers = require((...):match(".*vicious") .. ".helpers")
local spawn = require((...):match(".*vicious") .. ".spawn")
-- }}}

View File

@ -23,7 +23,7 @@ local tonumber = tonumber
local os = { time = os.time }
local io = { lines = io.lines }
local string = { match = string.match }
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- }}}
-- Initialize function tables

View File

@ -17,8 +17,8 @@
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
local tonumber = tonumber
local helpers = require("vicious.helpers")
local spawn = require("vicious.spawn")
local helpers = require((...):match(".*vicious") .. ".helpers")
local spawn = require((...):match(".*vicious") .. ".spawn")
local notmuch = {}

View File

@ -21,7 +21,7 @@
-- {{{ Grab environment
local io = { lines = io.lines }
local os = { time = os.time, date = os.date }
local helpers = require"vicious.helpers"
local helpers = require(...):match(".*vicious") .. ".helpers"
-- }}}
-- {{{ OrgMode widget type

View File

@ -19,8 +19,8 @@
-- {{{ Grab environment
local los = { getenv = os.getenv }
local string = { match = string.match }
local helpers = require("vicious.helpers")
local spawn = require("vicious.spawn")
local helpers = require((...):match(".*vicious") .. ".helpers")
local spawn = require((...):match(".*vicious") .. ".spawn")
-- }}}
-- OS: provides operating system information

View File

@ -25,7 +25,7 @@ local math = { ceil = math.ceil }
local los = { getenv = os.getenv }
local string = { gsub = string.gsub }
local helpers = require"vicious.helpers"
local helpers = require(...):match(".*vicious") .. ".helpers"
-- }}}
-- {{{ Operating system widget type

View File

@ -22,8 +22,8 @@
-- along with Vicious. If not, see <https://www.gnu.org/licenses/>.
-- {{{ Grab environment
local spawn = require("vicious.spawn")
local helpers = require("vicious.helpers")
local spawn = require((...):match(".*vicious") .. ".spawn")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- }}}
-- Pkg: provides number of pending updates on UNIX systems

View File

@ -26,7 +26,7 @@ local string = {
gmatch = string.gmatch
}
local helpers = require"vicious.helpers"
local helpers = require(...):match(".*vicious") .. ".helpers"
-- }}}
-- Initialize function tables

View File

@ -21,7 +21,7 @@
local string = { match = string.match }
local type = type
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- }}}
-- Thermal: provides temperature levels of ACPI and coretemp thermal zones

View File

@ -22,7 +22,7 @@ local type = type
local tonumber = tonumber
local string = { match = string.match }
local math = { floor = math.floor }
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- }}}
-- {{{ Thermal widget type

View File

@ -22,7 +22,7 @@ local tonumber = tonumber
local math = { floor = math.floor }
local os = { time = os.time }
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- }}}
-- Uptime: provides system uptime and load information

View File

@ -21,7 +21,7 @@
-- {{{ Grab environment
local math = { floor = math.floor }
local string = { match = string.match }
local helpers = require("vicious.helpers")
local helpers = require((...):match(".*vicious") .. ".helpers")
-- }}}
-- {{{ Uptime widget type

View File

@ -20,8 +20,8 @@
-- {{{ Grab environment
local tonumber = tonumber
local string = { match = string.match }
local helpers = require("vicious.helpers")
local spawn = require("vicious.spawn")
local helpers = require((...):match(".*vicious") .. ".helpers")
local spawn = require((...):match(".*vicious") .. ".spawn")
-- }}}
-- Volume: provides volume levels and state of requested mixer

View File

@ -25,8 +25,8 @@ local tonumber = tonumber
local string = { match = string.match }
local table = { concat = table.concat }
local helpers = require("vicious.helpers")
local spawn = require("vicious.spawn")
local helpers = require((...):match(".*vicious") .. ".helpers")
local spawn = require((...):match(".*vicious") .. ".spawn")
-- }}}
-- Volume: provides volume levels and state of requested ALSA mixers

View File

@ -25,8 +25,8 @@ local math = { ceil = math.ceil }
local os = { date = os.date, difftime = os.difftime, time = os.time }
local string = { format = string.format }
local spawn = require"vicious.spawn"
local helpers = require"vicious.helpers"
local spawn = require(...):match(".*vicious") .. ".spawn"
local helpers = require(...):match(".*vicious") .. ".helpers"
-- }}}
-- Weather: provides weather information for a requested station

View File

@ -23,8 +23,8 @@ local type = type
local tonumber = tonumber
local math = { floor = math.floor }
local helpers = require"vicious.helpers"
local spawn = require"vicious.spawn"
local helpers = require(...):match(".*vicious") .. ".helpers"
local spawn = require(...):match(".*vicious") .. ".spawn"
-- }}}
-- Wifi: provides wireless information for a requested interface using iwconfig

View File

@ -23,8 +23,8 @@
local type = type
local tonumber = tonumber
local helpers = require("vicious.helpers")
local spawn = require("vicious.spawn")
local helpers = require((...):match(".*vicious") .. ".helpers")
local spawn = require((...):match(".*vicious") .. ".spawn")
-- }}}
-- Wifiiw: provides wireless information for a requested interface