If the clock timer fires when global scr is NULL then we end up calling
redrawmenubar() with a NULL global scr, but a valid local scr.
So just pass in the scr used when doing "stuff" into redrawmenubar(),
making the 'scr' in redrawmenubar() also local scope.
* add a batteryinfo config option to enable whether or not to display
the current battery info string
* populate that battery info string whenever we receive a battery
update from the module
* document it all
This is very specific to a battery thing rather than a generic menu
widget thing, but I think I'll go and twiddle with this stuff a bit
more first and then work on a more generic "menu widget" thing later.
It'd be nice to have "menu bar things" like battery and the date/time
field on a linked list of "things".
There's also some bugs - notably, rendering artifacts when the
string length shrinks, and it only updating on the 'current' menu bar
(when you have multiple desktops visible at once.) Those also
should be fixed for completeness. :-)
Totally not ready for prod, but at least I'm making progress
figuring out how to add extra bits to this thing.
* add a second widget to the menu bar, next to the title bar
* add a new module command to update the battery information
* add a freebsd specific Battery module, not linked into the
build right now.
* amiwm will print out whenever we get battery information from the
module.
Right now I'm trying to figure out how to get some kind of periodic
background event into the module main loop. Launcher does it
using cx_broker(), but I dunno if I can adapt that pattern here.
This is a pretty straight forward change to remove the global front
variable and instead use a couple of accessor functions.
This hopefully will make it easier to keep track and debug when
the front screen changes.