Compare commits

...

7 Commits

Author SHA1 Message Date
Isak05 de5ddc1a48
Merge branch 'hotfix/3.7.2' into bugfix/3117 2024-04-28 16:54:22 +02:00
Isak05 c49c8f3926 Add changelog 2024-04-28 16:33:17 +02:00
patrick96 ab583b08cd fix(tray): Clients not being removed properly
The vector::erase call needs to be supplied with the end of the range,
otherwise only a single element is removed.

Fixes #3111
2024-04-15 23:43:25 +02:00
patrick96 c8f7dc1c14 fix(i3): Properly render non-full-width windows
Without override-redirect, i3 will not allow you to have a
non-full-width bar. But polybar simply ignores that request and
continues to render the user-requested width instead of the width i3 has
configured the window to be.

With the 3.7 release, we started setting the window's backing pixmap to
the rendering pixmap. In the case above, the pixmap would only be
allocted for the smaller width and when i3 maps the window, it repeats
the backing pixmap to fill the entire window.

At the point where i3 maps the window, the pixmap contains an initial
render of the bar without module content and that render is then
duplicated.

Reverting back to the old approach of simply copying over the pixmap
after each render does not have that problem and the remainder of the
bar is black (or fully transparent with a compositor).

Ideally, polybar would respect the width i3 configures for it, but that
would break many existing setups that rely on non-full-width bars in i3

Fixes #3060
2024-02-18 19:02:30 +01:00
Patrick Ziegler 020699724f
fix(label): Misbehaving min-length tokens with non-ASCII characters (#3090)
* Changed bit count for label to use UTF8 standard

Fixes #3074

* label: Calculate length only once

The length calculation has to traverse the whole string

---------

Co-authored-by: nklloyd <nicholask.lloyd@gmail.com>
2024-02-10 12:51:34 +01:00
Patrick Ziegler 8e04f15ed6
fix(backlight): %backlight% token appearing on the bar (#3081)
* Fix backlight initial value matching the actual brightness level

The initial value is `0`. If the actual brightness is also `0` you see
`%percentage%` token as text, it’s not being replaced. Since
`m_brightness` is an `int` the initial value could be just `-1` since
the actual brightness is never goes below zero. Thus this bug will never
show up again because actual brightness on first render won’t match
the “old” `m_brightness` value.

See also for more detailed explanation of the bug:
https://github.com/polybar/polybar/discussions/3079#discussioncomment-8169932

* Add docs

---------

Co-authored-by: Viacheslav Lotsmanov <lotsmanov89@gmail.com>
2024-01-20 18:09:12 +01:00
patrick96 0ed669f049
fix(doc): Update vulnerable rtd search extension
Ref: https://github.com/readthedocs/readthedocs-sphinx-search/security/advisories/GHSA-xgfm-fjx6-62mj
2024-01-20 17:53:28 +01:00
7 changed files with 33 additions and 32 deletions

View File

@ -32,20 +32,15 @@ Checks: '
'
CheckOptions:
- key: modernize-loop-convert.NamingStyle
value: lower_case
- key: readability-identifier-naming.ClassCase
value: lower_case
- key: readability-identifier-naming.ClassConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.ClassMethodCase
value: lower_case
- key: readability-identifier-naming.MemberCase
value: lower_case
- key: readability-identifier-naming.ProtectedMemberPrefix
value: 'm_'
- key: readability-identifier-naming.PrivateMemberPrefix
value: 'm_'
cppcoreguidelines-avoid-do-while.IgnoreMacros: true
modernize-loop-convert.NamingStyle: lower_case
readability-identifier-naming.ClassCase: lower_case
readability-identifier-naming.ClassConstantCase: UPPER_CASE
readability-identifier-naming.ClassMethodCase: lower_case
readability-identifier-naming.MemberCase: lower_case
readability-identifier-naming.ProtectedMemberPrefix: 'm_'
readability-identifier-naming.PrivateMemberPrefix: 'm_'
HeaderFilterRegex: ''
WarningsAsErrors: ''
AnalyzeTemporaryDtors: false

View File

@ -9,6 +9,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- `custom/script`: When a script with `tail = true` received multiple lines quickly, only the first would get displayed ([`#3117`](https://github.com/polybar/polybar/issues/3117), [`#3119`](https://github.com/polybar/polybar/pull/3119)) by [@Isak05](https://github.com/Isak05)
- Token min-length calculations would behave differently when non-ASCII characters appear in the token ([`#3074`](https://github.com/polybar/polybar/issues/3074), [`#3087`](https://github.com/polybar/polybar/pull/3087)) by [@nklloyd](https://github.com/nklloyd)
- i3: Fix duplicated rendering for non-full-width bars ([`#3091`](https://github.com/polybar/polybar/pull/3091), [`#3060`](https://github.com/polybar/polybar/issues/3060))
- `internal/backlight`: Module could display the literal `%percentage%` token if the backlight reports a value of 0 at startup ([`#3081`](https://github.com/polybar/polybar/pull/3081)) by [@unclechu](https://github.com/unclechu)
- `internal/tray`: Fix crash during restarting, when tray icons were not removed proberly ([`#3111`](https://github.com/polybar/polybar/issues/3111), [`#3112`](https://github.com/polybar/polybar/pull/3112))
## [3.7.1] - 2023-11-27
### Build

View File

@ -4,4 +4,4 @@
sphinx~=7.2.6
sphinx-rtd-theme~=2.0.0rc2
sphinx-notfound-page~=1.0.0
readthedocs-sphinx-search~=0.3.1
readthedocs-sphinx-search~=0.3.2

View File

@ -67,7 +67,12 @@ namespace modules {
brightness_handle m_val;
brightness_handle m_max;
int m_percentage = 0;
/**
* Initial value set to a negative number so that any value read from the backlight file triggers an update during
* the first read.
* Otherwise, tokens may not be replaced
*/
int m_percentage = -1;
chrono::duration<double> m_interval{};
chrono::steady_clock::time_point m_lastpoll;

View File

@ -86,14 +86,6 @@ renderer::renderer(connection& conn, signal_emitter& sig, const config& conf, co
{
m_pixmap = m_connection.generate_id();
m_connection.create_pixmap(m_depth, m_pixmap, m_window, m_bar.size.w, m_bar.size.h);
uint32_t configure_mask = 0;
std::array<uint32_t, 32> configure_values{};
xcb_params_cw_t configure_params{};
XCB_AUX_ADD_PARAM(&configure_mask, &configure_params, back_pixmap, m_pixmap);
connection::pack_values(configure_mask, &configure_params, configure_values);
m_connection.change_window_attributes_checked(m_window, configure_mask, configure_values.data());
}
m_log.trace("renderer: Allocate graphic contexts");
@ -372,8 +364,8 @@ void renderer::flush() {
highlight_clickable_areas();
m_surface->flush();
// Clear entire window so that the new pixmap is shown
m_connection.clear_area(0, m_window, 0, 0, m_bar.size.w, m_bar.size.h);
// Copy pixmap onto the window
m_connection.copy_area(m_pixmap, m_window, m_gcontext, 0, 0, 0, 0, m_bar.size.w, m_bar.size.h);
m_connection.flush();
if (!m_snapshot_dst.empty()) {

View File

@ -82,14 +82,15 @@ namespace drawtypes {
for (auto&& tok : m_tokens) {
string repl{replacement};
size_t len = string_util::char_len(repl);
if (token == tok.token) {
if (tok.max != 0_z && string_util::char_len(repl) > tok.max) {
if (tok.max != 0_z && len > tok.max) {
repl = string_util::utf8_truncate(std::move(repl), tok.max) + tok.suffix;
} else if (tok.min != 0_z && repl.length() < tok.min) {
} else if (tok.min != 0_z && len < tok.min) {
if (tok.rpadding) {
repl.append(tok.min - repl.length(), ' ');
repl.append(tok.min - len, ' ');
} else {
repl.insert(0_z, tok.min - repl.length(), tok.zpad ? '0' : ' ');
repl.insert(0_z, tok.min - len, tok.zpad ? '0' : ' ');
}
}

View File

@ -502,7 +502,8 @@ void manager::remove_client(const client& c) {
void manager::remove_client(xcb_window_t win) {
auto old_size = m_clients.size();
m_clients.erase(
std::remove_if(m_clients.begin(), m_clients.end(), [win](const auto& client) { return client->match(win); }));
std::remove_if(m_clients.begin(), m_clients.end(), [win](const auto& client) { return client->match(win); }),
m_clients.end());
if (old_size != m_clients.size()) {
reconfigure();
@ -518,7 +519,8 @@ void manager::remove_client(xcb_window_t win) {
*/
void manager::clean_clients() {
m_clients.erase(
std::remove_if(m_clients.begin(), m_clients.end(), [](const auto& client) { return client.get() == nullptr; }));
std::remove_if(m_clients.begin(), m_clients.end(), [](const auto& client) { return client.get() == nullptr; }),
m_clients.end());
}
bool manager::change_visibility(bool visible) {