Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for dynamic RandR changes #171

Closed
wants to merge 1 commit into from

Conversation

DelusionalLogic
Copy link
Contributor

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.

@DelusionalLogic DelusionalLogic changed the title Support for RandR Support for dynamic RandR changes Feb 20, 2016
@DelusionalLogic DelusionalLogic force-pushed the master branch 4 times, most recently from a66ab59 to 0d6f353 Compare February 23, 2016 11:09
This should allow lemonbar to dynamically detect and handle RandR
changes.

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.
@LemonBoy
Copy link
Owner

The main idea is to avoid the kitchen-sink approach, whenever the screen is changed it's up to the window manager to take care of it and it's up to the user's scripts to just restart the bar.
Keep it simple, sam!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants