Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This should allow lemonbar to dynamically detect and handle RandR
changes. Fixing #135
When ever a RandR ouput change notification is received we fetch all the
randr monitors and resize the bars to fit them. Creating new ones where
they are missing, and deleting the excess if there are any.
I've done a bit of testing, turning one of my monitors on and off with it running, starting the bar at different points (with the monitor at a small resolution, large resolution, and off). I've also been switching between these stages while the bar was running, without any issues, and with the new expected behavior.
It ended up being quite a few more changes than i anticipated, but that's mostly because i extracted some functions to make this change easier to digest, and to duplicate less code. There is still some, you might want to look at that.
This change assumes that setting an atom to a value that is already set has no effect on the environment. This has only been tested on bspwm (where it does work), so it might be a good idea to test this multiple places if it's undocumented. It also relies on Map Window not causing issues when called on a mapped window. According to the X11 documentation: "If the window is already mapped, this request has no effect." So that should be fine.
I would say the functionality is there, If you could look at the style that would be great.