Compare commits

..

2 Commits

Author SHA1 Message Date
Gregor Best e7524651d9
Merge dbec7746b1 into 11b522c313 2024-01-23 21:40:16 +00:00
Gregor Best dbec7746b1 fix: don't restart if zero active screens are reported
On laptops and similar devices, RandR sometimes returns zero active
screens, for example when closing a laptop's lid before it suspends.

Don't restart in that case because the new polybar instance will see
zero screens and quit. Instead, just ignore those kind of events.
2024-01-23 22:40:08 +01:00
2 changed files with 10 additions and 9 deletions

View File

@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- An option `unmute-on-scroll` for `internal/pulseaudio` and `internal/alsa` to unmute audio when the user scrolls on the widget.
### Changed
- When the `-r` flag is provided, and RandR reports zero connected active screens, Polybar will not restart. This fixes Polybar dying on some laptops when the lid is closed. [`#3078`](https://github.com/polybar/polybar/pull/3078).
## [3.7.1] - 2023-11-27
### Build
- Fixed missing header when using `libc++` in clang 15 and below

View File

@ -102,18 +102,16 @@ void screen::handle(const evt::randr_screen_change_notify& evt) {
m_connection.reset_screen();
auto screen = m_connection.screen();
auto changed = false;
// We need to reload if the screen size changed as well
auto [changed, num_monitors] = have_monitors_changed();
if (num_monitors == 0) {
m_log.notice("randr_screen_change_notify got 0 connected screens, ignoring event");
return;
}
// We need to reload if the screen size changed as well, not just if screens were added/removed.
if (screen->width_in_pixels != m_size.w || screen->height_in_pixels != m_size.h) {
changed = true;
} else {
auto p = have_monitors_changed();
changed = p.first;
if (p.second == 0) {
m_log.notice("randr_screen_change_notify got 0 connected screens, ignoring event");
return;
}
}
if (changed) {