Commit graph

369 commits

Author SHA1 Message Date
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
Daniel Eklöf
45e5f11fea modules: remove "connected to " prefix from info logs 2019-01-02 18:14:49 +01:00
Daniel Eklöf
43aeb1c224 module/alsa: include volume min/max/cur and muted state in info log 2019-01-02 18:14:26 +01:00
Daniel Eklöf
64a52656b1 module/alsa: log info message when up and running 2019-01-02 18:11:39 +01:00
Daniel Eklöf
2d5d1d5a46 module/alsa: disable debug logging 2019-01-02 18:08:32 +01:00
Daniel Eklöf
0d8704737e module/alsa: monitors volume and muted state of selected card/mixer 2019-01-02 18:07:16 +01:00
Daniel Eklöf
cba97a0e65 yml: remove commented out (old) code 2019-01-02 12:32:19 +01:00
Daniel Eklöf
2977af835c yml: add TODO to handle duplicate keys when merging dictionaries 2019-01-02 12:14:23 +01:00
Daniel Eklöf
91fa8a0217 yml: cleanup 2019-01-02 12:09:42 +01:00
Daniel Eklöf
305058deab yml: detect (and report to user) duplicate keys in dictionaries 2019-01-02 12:08:41 +01:00
Daniel Eklöf
de34d734a0 license: MIT 2019-01-02 11:24:28 +01:00
Daniel Eklöf
e159b596d9 bar: ignore XCB_MAPPING_NOTIFY events 2019-01-01 23:32:59 +01:00
Daniel Eklöf
b13305526a yml: apparently, libyaml's line number in the error context is 0 based
Which makes zero sense when reporting the error to the user.
2019-01-01 23:27:54 +01:00
Daniel Eklöf
4d46a14a67 main: print a descriptive error message when yaml parsing fails 2019-01-01 23:26:10 +01:00
Daniel Eklöf
5abd825137 yml: yml_load(): optionally allocates an error string (on error) 2019-01-01 23:25:36 +01:00
Daniel Eklöf
3dc7d0e39d yml: yml_destroy(): return immediately if node is NULL
This can happen for example when destroying a partially created
dictionary entry, where only the key node has been created.
2019-01-01 23:24:27 +01:00
Daniel Eklöf
a9110cc936 config: allow simple lists without actually declaring a list node
That is, instead of writing:

  content:
    list:
      items:
        - string: ..
        - string: ..

It is now possible to write:

  content:
    - string: ...
    - string: ...

Obviously, this means it's not possible to assign spacing, margin or
on-click handlers to such a list.
2019-01-01 20:50:49 +01:00
Daniel Eklöf
ed4716a600 module/removables: remove debug logging 2019-01-01 20:37:04 +01:00
Daniel Eklöf
94dbe3b892 bar: ignore events we're not interrested in 2019-01-01 20:35:36 +01:00
Daniel Eklöf
7dd35f1159 module/xkb: remove assert: variable has been removed 2019-01-01 20:34:39 +01:00
Daniel Eklöf
9351d3b6d9 yml: yml_value_as_bool(): return false if value didn't match any known values 2019-01-01 20:32:12 +01:00
Daniel Eklöf
28b0f150cd xcb: replace asserts with error checks 2019-01-01 20:32:03 +01:00
Daniel Eklöf
aa477eaa32 module/xkb: remove unused variable 2019-01-01 20:31:54 +01:00
Daniel Eklöf
c01806d6fa module/xkb: declare and initialize 'symbols' before first goto err
This ensures we don't free() an invalid value.
2019-01-01 20:31:00 +01:00
Daniel Eklöf
a8a9ab28bd module/removables: log warning if action is something we didn't expect 2019-01-01 20:30:27 +01:00
Daniel Eklöf
410b7635d7 log: ensure variables are always initialized. Fixes gcc warning 2019-01-01 20:30:15 +01:00
Daniel Eklöf
e711a6f103 config: deco_from_config() return NULL if we didn't match a deco 2019-01-01 20:29:55 +01:00
Daniel Eklöf
ba1c52d291 bar: remove unused variable 2019-01-01 20:29:48 +01:00
Daniel Eklöf
bdd760a40b module/removables: cleanup 2019-01-01 20:18:48 +01:00
Daniel Eklöf
14f9aec088 module/removables: monitors removable devices using udev 2019-01-01 20:07:50 +01:00
Daniel Eklöf
0ab8dad7b9 module/network: initialize MAC address to 0
This fixes a valgrind "uninitialized value(s)" warning.
2019-01-01 13:10:44 +01:00
Daniel Eklöf
a96f901a15 module/network: disable debug logging 2019-01-01 13:10:35 +01:00
Daniel Eklöf
ea2cc50194 module/network: process_reply() -> parse_reply() 2018-12-31 13:44:49 +01:00
Daniel Eklöf
b2af90abbc module/network: IFA_ADDRESS: include add/del in log message 2018-12-31 13:42:32 +01:00
Daniel Eklöf
24842d9b28 module/network: RTM_NEWLINK/DELLINK: don't do anything if nothing's changed
We're only interrested in a few of the attributes. Thus, there's no
need to log or update anything, if none of those attributes haven't
changed.
2018-12-31 13:40:43 +01:00
Daniel Eklöf
dcf8051f1a module/network: break out message parsing code
This also allows us to actually handle errors (by aborting run())
2018-12-31 13:36:44 +01:00
Daniel Eklöf
8352d89491 module/network: break out message receiving code 2018-12-31 13:27:37 +01:00
Daniel Eklöf
b3f3f91dc2 module/network: drop libnl dependency, use raw netlink sockets instead 2018-12-31 13:19:01 +01:00
Daniel Eklöf
0ea4e5a2d8 log: LOG_ERRNO_P(), like LOG_ERRNO(), except user provides errno value 2018-12-31 13:18:22 +01:00
Daniel Eklöf
4c4f0ce7a0 module: network: monitor ethernet interfaces
State exposed (tag names):

* name: the interface name ("eth0" etc)
* index: the interface index, "ifindex"
* state: operational state (down, up etc)
* mac: the Ethernet hardware address
* ipv4: the *last* IPv4 address added to the interface
* ipv6: the *last* IPv6 address added to the interface

State we monitor (for changes):

* state
* ipv4 addresses
* ipv6 addresses
2018-12-30 20:40:10 +01:00
Daniel Eklöf
c795718ad7 config: i3: handle the 'spacing' attribute 2018-12-30 20:39:45 +01:00
Daniel Eklöf
500aebe9ef module/mpd: free connection object when failing to connect 2018-12-30 14:04:40 +01:00
Daniel Eklöf
07d6564e79 module/mpd: raise connection retry interval from 1s -> 10s 2018-12-30 12:40:58 +01:00