Commit graph

611 commits

Author SHA1 Message Date
Daniel Eklöf
d2af5b2c84 config: verify: break out err_prefix(), and rename 2019-01-12 12:11:59 +01:00
Daniel Eklöf
550d4ad534 module/clock: export module info through the new module_info struct type 2019-01-12 12:05:39 +01:00
Daniel Eklöf
e24923e7cc module/battery: export module info through the new module_info struct type 2019-01-12 12:02:41 +01:00
Daniel Eklöf
3d36735f88 module/backlight: export module info through the new module_info struct type 2019-01-12 11:59:01 +01:00
Daniel Eklöf
e536391df6 module/alsa: export module info through the new module_info struct type 2019-01-12 11:58:57 +01:00
Daniel Eklöf
eaf061ee57 module: define a struct for module meta data
* Function pointer; instantiates the module from a yml conf node
* Its (top-level) configuration attributes
2019-01-12 11:52:46 +01:00
Daniel Eklöf
4dd1a24af6 config: sort includes, add comment 2019-01-12 11:47:30 +01:00
Daniel Eklöf
3c870f759a config: verify: config_verify_bar() -> conf_verify_bar() 2019-01-12 11:47:01 +01:00
Daniel Eklöf
d44db1a6a8 config: verify: expose verification primitives 2019-01-12 11:46:26 +01:00
Daniel Eklöf
6cb2f52328 config: conf_particle_from() -> conf_to_particle() 2019-01-12 11:28:20 +01:00
Daniel Eklöf
8809cbb481 Put each module in its own subdirectory 2019-01-12 11:19:57 +01:00
Daniel Eklöf
75bdd2ad3c config: use dashes, '-', instead of underscores, '_' in attribute names 2019-01-12 10:32:52 +01:00
Daniel Eklöf
b0705578b0 config: remove asserts
Since the config is now fully verified, before we start loading
anything, there's no longer any need to assert on thing.
2019-01-12 10:27:02 +01:00
Daniel Eklöf
d03565a545 config: verify: fix a number of incorrect nodes passed to err_prefix() 2019-01-11 23:20:51 +01:00
Daniel Eklöf
a1e0ce2f87 config: verify: err_prefix(): include line/column info in message 2019-01-11 23:20:23 +01:00
Daniel Eklöf
d922bc572f yml: add line/column info to every node 2019-01-11 23:20:06 +01:00
Daniel Eklöf
3f578d30eb config: bar: no need to check for NULL on required attributes 2019-01-11 22:51:01 +01:00
Daniel Eklöf
61a2f84651 config: verify: particles and decorations 2019-01-11 22:44:40 +01:00
Daniel Eklöf
a0cb4aef38 config: verify: make dictionary verifiers data driven 2019-01-11 21:17:11 +01:00
Daniel Eklöf
3d22b30c87 module/network: make module verification data driven
This is done by implementing a generic verify_dict() function, that
takes an array of attribute metadata.

The attribute metadata consists of the attribute name, whether it's
required or optional, and a verify callback function.
2019-01-11 21:01:03 +01:00
Daniel Eklöf
e54e19e2c4 module/mpd: expose repeat/random/consume state 2019-01-11 20:10:36 +01:00
Daniel Eklöf
7b2dfd1399 module/i3: implement 'urgent' event handling 2019-01-11 20:05:38 +01:00
Daniel Eklöf
b9b90d8b9e module/i3: 'reload' events don't have a 'current' element 2019-01-11 20:01:36 +01:00
Daniel Eklöf
706313b1e5 config: backlight: content doesn't have to be a dictionary
And, particle_from_config() will take care of asserting on the correct
type anyway.
2019-01-09 21:17:41 +01:00
Daniel Eklöf
67767e6f54 module/backlight: expose brightness as percent too 2019-01-09 21:17:27 +01:00
Daniel Eklöf
c18b5a1bbe main: catch SIGTERM
And when exiting, log which signal we were killed by.
2019-01-09 18:50:26 +01:00
Daniel Eklöf
8dfe4af76b bar: call cairo_device_finish() on the surface's device
This fixes lots of memory leaks detected by valgrind.

Unsure if this is how you're supposed to shutdown cairo. You'd
think (from the documentation) that destroying the surface would (when
the refcount reaches 0) destroy the device too...
2019-01-09 18:50:26 +01:00
Daniel Eklöf
b2c9c386d9 bar: make sure modules (and particles and fonts!) are destroyed before cleanup
Before shutting down and destroying cairo and XCB, make sure the
modules, particles and fonts have been destroyed.

I.e. move module destruction from bar's destroy() to the end of bar's
run()
2019-01-09 18:50:26 +01:00
Daniel Eklöf
092e83680b bar: flush cairo surface before copying pixmap to bar window 2019-01-09 18:50:26 +01:00
Daniel Eklöf
73c93bad5a config: implicit lists now have the same default right-spacing as explicit ones 2019-01-09 18:50:26 +01:00
Daniel Eklöf
2562d94f24 config: remove extra ';' 2019-01-09 18:50:26 +01:00
Daniel Eklöf
7fc9749c28 module/clock: user can now specify the date/time format strings 2019-01-09 18:50:26 +01:00
Daniel Eklöf
9037aadd04 module/xwindow: some windows have a zero-length PID property 2019-01-09 18:50:26 +01:00
Daniel Eklöf
128716c8aa module/i3: if there's no specific workspace template, try a default one
If the user hasn't specified a specific template for a workspace, try
to lookup a default one (the empty string).

This allows the user to configure a "fallback" template to be used for
"extra", or not-often-used workspaces.
2019-01-09 18:50:26 +01:00
Daniel Eklöf
54798567c0 module/alsa: track all channels
Warn if volume and/or muted state is inconsistent (as we only expose a
single volume/muted state).

Also, don't query for current volume if max == 0 (i.e. typically a
digital output).

Finally, make absolutely sure that volume min is really less (or
equal) to volume max, and that the current volume level is between min
and max.
2019-01-09 18:50:26 +01:00
Daniel Eklöf
558f75a54b module/particle: remove cairo context from begin_expose() 2019-01-09 18:50:26 +01:00
Daniel Eklöf
f6977417e0 font: use font-config to load font
This allows us to a) move away from cairo's "toy" API, and b) let the
user specify font options in a single font "name" string:

  Serif:size=10:weight=bold:slant=italic

This also allows us to simplify the font code significantly (except
for the fontconfig parts...); the font no longer sets itself in a
cairo surface - font users do that; the font simply returns a
cairo_scaled_font_t.

Furthermore, font_clone() has now been simplified to basically just
refcount the scaled font. I.e. there's no need to run the full
constructor and lookup and instantiate the cairo scaled font again.
2019-01-09 18:50:16 +01:00
Daniel Eklöf
b52bdf14b2 xcb: log version info as debug, rather than info 2019-01-09 18:29:51 +01:00
Daniel Eklöf
2b2c5bbf4d config: not true 2019-01-07 18:32:27 +01:00
Daniel Eklöf
91826ff176 module/removables: handle optical media (CDROMs) 2019-01-07 18:32:09 +01:00
Daniel Eklöf
af13df3045 module/i3: trigger a bar refresh after a workspace event 2019-01-07 18:31:55 +01:00
Daniel Eklöf
072a508291 module/i3: add more debug logging 2019-01-07 18:31:47 +01:00
Daniel Eklöf
552739fa20 module/i3: fix gcc warning
Gcc (correctly) figured out that we may end up truncating the socket
path. In practice, it's something that should never happen.

Never the less, silence the warning by writing the socket path
directly into the sockaddr_un object.
2019-01-07 18:30:30 +01:00
Daniel Eklöf
efe3dd06ab alsa: initialize values, fixes valgrind warning
When snd_mixer_selem_get_*() fails, the values were left
uninitialized, trigger a valgrind warning.

In addition to fixing this, the error(s) are now logged (but only as
warnings, as they are not fatal).
2019-01-07 18:29:03 +01:00
Daniel Eklöf
fdadf577e9 main: detect when X server dies, and abort
This is done by creating an XCB connection, whose only purpose is to
detect a POLLHUP (xcb disconncet).

Furthermore, make sure SIGINT is blocked in all threads except the
main thread.
2019-01-07 18:27:43 +01:00
Daniel Eklöf
3f226d8cce bar: detect XCB disconnect (and abort) 2019-01-07 18:27:28 +01:00
Daniel Eklöf
400a92fa04 tag: rename and rewrite sbuf_strcat()
In particular, don't use strncat() with a length derived from the
source.
2019-01-07 18:26:48 +01:00
Daniel Eklöf
f0cc0b4383 yml: initialize return value, fixes gcc warning (-O3 -Wall) 2019-01-07 18:26:29 +01:00
Daniel Eklöf
bf5ad4d6b7 module/network: both thrd_current() and getpid() are 32-bit 2019-01-06 20:41:34 +01:00
Daniel Eklöf
aa38063e37 wip: verify configuration
We now verify the configuration (currently down to module level, but
not including particles) that are present are of the expected type.
2019-01-06 20:04:01 +01:00