Module corky
Corky main module.
This module is the one that should be loaded in Conky's configuration file. It contains the startup, pre- and post-draw and shutdown hooks.
To use it, include the following lines in the Conky configuration (assuming the file corky.lua
and the
corky
folder are placed in the ~/.conky/lua/
directory, modify the lua_load
directive according to your
setup):
conky.config = { -- […] lua_load = "~/.conky/lua/corky.lua", lua_startup_hook = "startup_hook", lua_draw_hook_pre = "draw_hook_pre", lua_draw_hook_post = "draw_hook_post", lua_shutdown_hook = "shutdown_hook", -- […] };
Configuration of Corky:
All settings for Corky are included in the Conky configuration file. There is usually no need to edit any
of the Lua source files. See the corky.config module for a general syntax description, and the individual
modules for details about available configuration options. An example configuration file is included in the
example
folder.
Developer information:
This module will add its parent directory to the global package search path. Corky modules are placed in the
corky
folder (let's call it namespace). If you want to add your own modules, it is recommended to use the
corkyx
namespace instead, to avoid possible clashes with future Corky modules.
This module will load the corky.conky and corky.cairo modules. These modules will clean up the global
namespace (_G
) by removing (almost) all conky_*
, cairo_*
and CAIRO_*
variables and functions. Please
refer to the individual module's documentation for more details.
A Cairo surface and context will be initialized before any of the Corky draw hooks are executed, so modules may use corky.cairo to draw stuff without having to setup these by themselves. The surface and context will be created before the draw hooks are run, and destroyed afterwards, during every Conky update cycle.
Corky Hooks:
During the startup_hook
, draw_hook_pre
, draw_hook_post
and shutdown_hook
(the three Lua hooks provided
by Conky) the following Corky hooks will be executed (in the specified order):
During the startup_hook
:
before_startup
startup
after_startup
During the draw_hook_pre
:
before_pre_draw
pre_draw
after_pre_draw
During draw_hook_post
:
before_post_draw
post_draw
after_post_draw
During the shutdown_hook
:
before_shutdown
shutdown
after_shutdown
Modules may register functions for these hooks as required, see corky.hooks.
Note: It appears that Conky calls the draw_hook_pre
and draw_hook_post
hooks multiple times before it
calls the startup_hook
. For Corky hooks, however, it is guaranteed that draw hooks will not be executed
before the startup hooks have been run.
Info:
Functions
conky_startup_hook () | Conky startup hook. |
conky_shutdown_hook () | Conky shutdown hook. |
conky_draw_hook_pre () | Conky pre-draw hook. |
conky_draw_hook_post () | Conky post-draw hook. |
Functions
- conky_startup_hook () line 145
-
Conky startup hook.
This function should be set as
lua_startup_hook
in the Conky configuration.It will read the Corky configuration, and after that it will run the following hook functions (in that order):
before_startup
startup
after_startup
See also:
- conky_shutdown_hook () line 169
-
Conky shutdown hook.
This function should be set as
lua_shutdown_hook
in the Conky configuration.It will run the following hook functions (in that order):
before_shutdown
shutdown
after_shutdown
See also:
- conky_draw_hook_pre () line 197
-
Conky pre-draw hook.
This function should be set as
lua_draw_hook_pre
in the Conky configuration.It will increment the cache's update counter first, then it will initialize Cairo by calling corky.cairo.init(). When this is done, the following hook functions will be run (in that order):
before_pre_draw
pre_draw
after_pre_draw
Note that this function will not be called before the conky_startup_hook() has been run.
See also:
- conky_draw_hook_post () line 236
-
Conky post-draw hook.
This function should be set as
lua_draw_hook_post
in the Conky configuration.It will run the following hook functions (in that order):
before_post_draw
post_draw
after_post_draw
After that, it will execute corky.cairo.clean_up().
Note that this function will not be called before the conky_startup_hook() has been run.
See also: