Fix battery refresh when swapping power (issue #839 and #1181)#1306
Fix battery refresh when swapping power (issue #839 and #1181)#1306koppa wants to merge 1 commit into
Conversation
* Merge the inotify_module class inside the battery_module
This allows further extension of the class
* Recreate battery on missing paths
f0s3
left a comment
There was a problem hiding this comment.
Code is fine, I haven't noticed anything wrong while testing and reviewing it. Some part of indentation was changed (which does not relate to the bug fix). I think that if you create a new PR that fixes the indentation, I will review and approve it.
| protected: | ||
| void runner() { | ||
| this->m_log.trace("%s: Thread id = %i", this->name(), concurrency_util::thread_id(this_thread::get_id())); | ||
| public: using module<Impl>::module; void start() { this->m_mainthread = thread(&inotify_module::runner, this); } protected: void runner() { this->m_log.trace("%s: Thread id = %i", this->name(), concurrency_util::thread_id(this_thread::get_id())); |
There was a problem hiding this comment.
Leave the indentation as it was, it is difficult to review and, possibly, introduces useless changes.
There was a problem hiding this comment.
Strange that it was all put on the same line. Did clang-format do that?
|
@f0s3 Thanks for the review. I will also take a last look once I have some time. The formatting changes are introduced by We are currently trying to get all our code formatted with Though the one where everything moved onto the same line seems out of place and shouldn't be something that |
|
I'm using this patch on my laptop, and it seems to be working fine (fixes the problem in #1937). |
Here is a fix for correcting the behavior of polybar when suspending.
The paths for monitoring the battery state can change in a running system,
for example after a suspend.
Therefore now the battery module now tries to find the correct battery paths
after a failing inotify watch.
For the implementation i merged the logic of the inotify_module into the battery modules
for an easy fix.
TEAM EDIT: Fixes #1937