Trey's conky configuration.
Go to file
Trey Blancher c571a09f4b Initial conky_printf commit 2020-10-25 17:48:58 -04:00
LICENSE Initial commit 2020-10-23 18:44:11 -04:00
README.md Initial commit 2020-10-23 18:44:11 -04:00
conky.conf Initial conky_printf commit 2020-10-25 17:48:58 -04:00
scripts.lua Initial conky_printf commit 2020-10-25 17:48:58 -04:00

README.md

This is Trey Blancher's conky configuration. I have no need for fancy graphics, meter bars, or anything else X-related. I run XMonad, so I hardly ever see the root window (mostly I only see one window taking up the entire screen, with a dmenu at the top, and another dmenu at the bottom that runs conky). I run conky in CLI mode only, and that's good enough for me.

I pipe the output of conky through dmenu, which upates every two seconds. I also have custom formatting functions (see scripts.lua in this repository). This ensures the output of conky has the same length, even if certain fields within the string change. This is especially useful for the network bandwidth output, which otherwise change length every two seconds as the bandwidth usage fluctuates between bytes (B), Kilobytes (KiB), and Megabytes (MiB).

TODO: My formatting function needs to be generalized. Essentially, I'm creating a conky-specific printf function. Right now, it's split into two functions, with calls to the Lua string.format function. One function takes only one format specifier, and the other takes two.

The fmt() function takes the format string, and expects a single numerical second argument. If the format string contains any format specifiers (see man sprintf for details) that aren't numbers (e.g. %s for strings), fmt() will fail with an error. I use this for the percentages of RAM, Swap, and CPU in use.

The fmt2() function takes the format string, and expects two string arguments. It is not necessarily an error if either or both of the arguments are numbers, they will be cast to strings. I use this function to format the bandwidth ("Net:") display in conky, so the length of this segment doesn't shift around (the Unicode arrow icons for up and down bandwidth stay in the same place).

Ideally these two functions would be combined into a "conky_printf function, that could take an arbitrary format string with any number of format specifiers, with the requisite number of numerical or string arguments. I know how to do this with the .../arg/unpack(arg) table specification in Lua, but numeric specifiers need to convert any strings passed to the function to numeric values instead of strings. This is the challenging part, but should be doable.