Removed submodule and added the raw files.

This commit is contained in:
Johannes Findeisen 2026-11-19 19:37:32 +01:00
commit 6397c554c3
96 changed files with 8176 additions and 0 deletions

View file

@ -0,0 +1,48 @@
# Widget type templates
Before writing a new widget type, make sure to ask yourself if anyone is going
to need the feature. Only widget types that you (or an incapacitated friend
you can personally talk to) require would be merged. Do not file PRs because
they seem like a good idea. If they're really useful, they'll be requested
in the issue tracker.
Additionally, too simple widget types (e.g. an one-liner) and those that
are not modular enough are very unlikely to be merged. By *modular*, we mean
> constructed with standardized units or dimensions
> allowing flexibility and variety in use
If all the above conditions are met, you can start from one of the templates
in this directory:
* `sync.lua`: synchronous widget type that does not fork
* `async.lua`: asynchronous widget type for fetching informations using
a command-line utility. As a rule of thumb, if your widget type uses
`io.popen`, you would need to refactor it to use async facilities.
Your widget types should be placed in `widgets`: the `contrib` directory
exists only for historical reasons and is barely maintained anymore.
The filenames should be of the form `<name>_<platform>.lua`, whereas
* `<name>` is a single (alphanumeric) word, preferably in lowercase
* `<platform>` is the OS that the widget type works on.
At the time of writing these are supported:
- `freebsd`: FreeBSD
- `openbsd`: OpenBSD
- `bsd`: all \*BSDs listed above
- `linux`: GNU/Linux
- `all`: all of the above
Please be aware of `luacheck`, which may help you during the progress.
From `widgets`, run
luacheck --config .luacheckrc ..
After finishing the widget type, you should document its usage in the project's
`README.md`. Try to provide at least
* A brief description
* The list of supported platforms
* Type and structures of the arguments that the widget type passes
(`format` and `warg`), with unused parameters omitted
* Type and structure of the return value

View file

@ -0,0 +1,28 @@
-- template for asynchronous widet types
-- 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/>.
local helpers = require"vicious.helpers"
return helpers.setasyncall{
async = function (format, warg, callback)
-- In here there should be some asynchronous function
-- from vicious.spawn or helpers.sysctl_async
-- that call callback on the result.
end }
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View file

@ -0,0 +1,25 @@
-- template for synchronous widet types
-- 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/>.
local helpers = require"vicious.helpers"
return helpers.setcall(function (format, warg)
-- Do the processing and return a table here.
end)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80