Commit graph

155 commits

Author SHA1 Message Date
Daniel Eklöf
ab67d036ae tags: break out string formatting from particle/string 2018-12-29 17:03:41 +01:00
Daniel Eklöf
cc654eda57 module/mpd: cleanup 2018-12-28 15:26:22 +01:00
Daniel Eklöf
97b279ff82 module/mpd: don't detach refresh thread
Instead, abort and join previous thread (if any), just before creating
a new one.

Abort/join the last one when destroying the module.

Note: we may end up with a dangling (non-joined) thread for a
while (for example, when state goes from playing -> paused/stopped).

It will however be joined eventually; either when state goes to
'playing' again, or when the module is destroyed.
2018-12-28 14:22:17 +01:00
Daniel Eklöf
cc59593f29 module/mpd: idle mask variable is unused, when we don't debug log 2018-12-28 14:15:03 +01:00
Daniel Eklöf
0103eff3a0 module/mpd: free album/artist/title before replacing them 2018-12-28 14:14:43 +01:00
Daniel Eklöf
64af167d66 module/mpd: disable debug logging 2018-12-28 14:14:21 +01:00
Daniel Eklöf
d8274c2c9c module/mpd: refresh thread only resets refresh_abort_fd if it's "ours"
That is, we only reset it if the module main thread haven't already
done so (and quite possibly created another eventfd).
2018-12-28 14:08:45 +01:00
Daniel Eklöf
b40069616c module/mpd: refresh_abort_fd now uses -1 to indicate there are is no active thread 2018-12-28 14:08:16 +01:00
Daniel Eklöf
ba31a557f5 module/mpd: refresh thread calls bar->refresh() directly
This is possible, since content() now calculates the correct 'elapsed'
time, based on the time the original elapsed value was received from
MPD.
2018-12-28 14:07:06 +01:00
Daniel Eklöf
f74f2ad031 module/mpd: elapsed and duration are now tracked in millseconds 2018-12-28 14:06:13 +01:00
Daniel Eklöf
67bd38f5df module/mpd: implement refresh_in() 2018-12-28 12:47:18 +01:00
Daniel Eklöf
89ebfa0dbb module/mpd: remember *when* the 'elapsed' member was set.
This allows us to update the elapsed field without having to talk to
MPD.

In particular, it fixes a bug where we reported the same elapsed value
when we we're updated due to *other* modules calling bar->refresh().
2018-12-28 12:47:14 +01:00
Daniel Eklöf
904f9ff8e1 tag: all tag constructors must now be passed a module 'owner' 2018-12-28 12:40:41 +01:00
Daniel Eklöf
99008c5ad9 module/mpd: "elapsed" tag is now a realtime tag (when state == playing) 2018-12-27 11:44:46 +01:00
Daniel Eklöf
9a94c9c1f7 module/mpd: monitors MPD 2018-12-27 11:36:38 +01:00
Daniel Eklöf
ce68bdb59d exposable: add a 'width' member, set (at latest) in begin_expose() 2018-12-26 16:37:11 +01:00
Daniel Eklöf
1929099ca4 module/backlight: new module 2018-12-26 12:44:17 +01:00
Daniel Eklöf
5306ebd4ed bar: call refresh() after all modules have been loaded
This also means that modules do *not* have to call bar->refresh() just
before/after calling module_signal_ready().

As long as the module's initial state has been correctly/completely
set up before it calls module_signal_ready(), the module *only* has to
call bar->refresh() when it's state changes.
2018-12-26 11:48:09 +01:00
Daniel Eklöf
3af0280304 module/xwindow: replace assert with real error check 2018-12-26 11:44:21 +01:00
Daniel Eklöf
6d75fe64ef module/xkb: signal module-ready when failing early 2018-12-26 11:42:42 +01:00
Daniel Eklöf
b2121070f8 module/i3: replace asserts with real error checks 2018-12-26 11:31:28 +01:00
Daniel Eklöf
30332670aa module/battery: convert asserts to real error checks 2018-12-25 12:25:24 +01:00
Daniel Eklöf
d81547066d module/battery: log error message on failure during initialization 2018-12-19 21:12:42 +01:00
Daniel Eklöf
7e95862e12 module/battery: error handling during initialization 2018-12-19 20:54:36 +01:00
Daniel Eklöf
ffaec546f5 module/xwindow: use lock from generic module 2018-12-19 20:35:43 +01:00
Daniel Eklöf
60b72cc55a module/xkb: delay ready signal, until we've actually initialized 2018-12-19 20:29:58 +01:00
Daniel Eklöf
661cabfb69 module/i3: use lock provided by generic module 2018-12-19 20:26:15 +01:00
Daniel Eklöf
2c7362fefa module/battery: no need to lock before we've signaled ready 2018-12-19 20:24:36 +01:00
Daniel Eklöf
3413232ed6 module: add new function module_signal_ready() 2018-12-19 20:23:53 +01:00
Daniel Eklöf
a3eb7ebc08 bar: wait for all modules to have started up before continuing
After starting all the module threads, wait for all modules to have
signalled "ready" before continuing.

This will allow modules to do initial setup, and knowing that
content() will *not* be called until they've signalled "ready".
2018-12-19 19:41:25 +01:00
Daniel Eklöf
7f0f096ba4 module: begin_expose() and content() take a non-const module pointer 2018-12-19 19:03:19 +01:00
Daniel Eklöf
b579f97db7 module/xwindow: use module common constructor/destructor 2018-12-19 19:00:29 +01:00
Daniel Eklöf
f8cb3acc35 module/xkb: use module common constructor/destructor 2018-12-19 18:59:33 +01:00
Daniel Eklöf
20cb0f0de7 module/label: use module common constructor/destructor 2018-12-19 18:58:10 +01:00
Daniel Eklöf
536db672b4 module/i3: use module common constructor/destructor 2018-12-19 18:57:19 +01:00
Daniel Eklöf
16553a7216 module/battery: acquire lock when reading/writing state 2018-12-18 20:24:30 +01:00
Daniel Eklöf
d279b585db module/battery: read all data into local variables first
This minimizes the time we'll have to hold the lock (once we lock).
2018-12-18 20:23:19 +01:00
Daniel Eklöf
f253bbebd2 module/battery: we're scanning into a signed long 2018-12-18 20:22:48 +01:00
Daniel Eklöf
76995ddcd5 module/battery: use module common constructor and default destructor 2018-12-18 20:22:30 +01:00
Daniel Eklöf
72624af1fa clock: use module common constructor and destructor 2018-12-18 20:13:04 +01:00
Daniel Eklöf
3618b863ff module/i3: lower case initial letter in log message 2018-12-18 20:00:03 +01:00
Daniel Eklöf
6db41b7803 module/xkb: initialize layouts to zero
Fixes a crash when content() is called before we've initialized the
layouts.
2018-12-18 19:49:05 +01:00
Daniel Eklöf
1c708975eb module/xkb: use log framework 2018-12-18 19:37:30 +01:00
Daniel Eklöf
1fa5baf8b7 module/i3: use log framework 2018-12-18 19:37:22 +01:00
Daniel Eklöf
2fdd419600 module/battery: use log framework 2018-12-18 19:37:10 +01:00
Daniel Eklöf
ef594b877b module/xkb: monitor current xkb layout 2018-12-17 19:59:29 +01:00
Daniel Eklöf
e186c3447d module/battery: remove unused left/right spacing options 2018-12-16 19:17:14 +01:00
Daniel Eklöf
8f7fba72a5 module/battery: remove inferior error checks 2018-12-16 17:09:33 +01:00
Daniel Eklöf
a9681dd19c cleanup 2018-12-16 17:08:38 +01:00
Daniel Eklöf
fa3c17aa4a module/battery: use libudev to monitor for battery changes
This allows us to detect plug/unplug events immediately, instead of
having to wait for the next poll event.

Unfortunately, capacity changes do not appear to generate events :(
2018-12-16 17:04:44 +01:00