Commit Graph

166 Commits

Author SHA1 Message Date
Flexlolo 9476ad80b8
Implement tray-reversed option (#3182)
* implement tray-reversed option

* update changelog

* Update src/x11/tray_manager.cpp

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Update CHANGELOG.md

---------

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2024-10-30 22:13:34 +01:00
Nolan Prochnau 552d81dd56
pulseaudio: Preserve channel balance (#3169)
Instead of preserving the proportions of PulseAudio channels, we now preserve the balance between the channels. This mirrors pulsemixer's approach.
2024-10-19 17:35:33 +02:00
clover 2d00384046
feat(battery): add ramp-charging tag (#3172)
* feat(battery): add ramp-charging tag

* Update battery.cpp

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md
2024-10-19 17:34:47 +02:00
Patrick Ziegler 15ccea6099
doc: Fix changelog entry (#3173)
Git merged the entry into the wrong section
2024-10-13 14:09:03 +02:00
Gregor Best 0eb39c5205
fix: don't restart if zero active screens are reported (#3078)
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-10-13 13:52:10 +02:00
patrick96 1ba083cdb2
Merge remote-tracking branch 'origin/hotfix/3.7.2' 2024-08-17 13:30:20 +02:00
patrick96 b3af5a3316
Version 3.7.2 2024-08-17 13:19:58 +02:00
patrick96 c0d3d7a3e7 fix(render): Deal with incomplete wallpapers
If the root pixmap does not fully cover the bar window, some
pseudo-transparent areas were filled with unitialized data, causing
pixelation or other rendering artifacts.

Now, ovserved background slices are first filled with black to make sure
this does not happen and they print an error if not the full pixmap can
be filled.

Fixes #3041
2024-08-17 13:13:12 +02:00
patrick96 4d1758457b fix(ipc): Clear output until initial hook finishes
Before, it just showed '%output%'

Fixes #3131
2024-08-01 11:15:48 +02:00
Isak05 81ea16931e
fix(script): Receiving multiple lines rapidly only displays first line (#3119)
Fixes #3117
2024-04-28 21:10:12 +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
Roddy Rappaport 11b522c313 doc: Added unmute-on-scroll to changelog and module descriptions 2024-01-17 18:01:10 +01:00
patrick96 b25d00b159 fix(doc): Wrong header level in changelog 2023-11-27 17:29:31 +01:00
patrick96 367847ec3b
Merge branch 'hotfix/3.7.1' 2023-11-27 17:20:39 +01:00
patrick96 91bd85cf50
Version 3.7.1 2023-11-27 17:15:23 +01:00
patrick96 c552df3b66 fix: Modules did not validate tags used in formats
The 'value' variable that was used for validation, was empty because it
was used in a move at the beginning of the function.

Fixes #3043
2023-11-16 22:29:00 +01:00
patrick96 432e19df01 build: Add missing headers in common.hpp 2023-11-12 15:18:34 +01:00
patrick96 8566051336 fix(tray): Allow module to disappear for empty tray
Modules that don't produce any output are hidden by the controller
(don't have margins or separators).
The tray module should also do that for `format = <tray>` when there are
no icons.

This required the visibility handling to be tied to the module
visibility instead of being handled by the renderer.
Otherwise, the renderer would hide the tray (because the %{Pt} tag was
never sent) and the tray would not unhide when new icons appeared; it
can't differentiate between hidden because empty and hidden because the
module is hidden by the user (the latter is the reason the renderer does
hiding at all).

Fixes #3036
2023-11-11 04:01:26 +01:00
patrick96 a7d9b7d912 doc: The Kelvin unit appears without "degrees" 2023-11-06 01:02:48 +01:00
patrick96 2471f3595c
Version 3.7.0 2023-11-05 23:36:13 +01:00
Tony Zorman f7a755799c feat(xworkspaces): Add group-by-monitor flag
By default, we group workspaces by monitor with the help of
_NET_DESKTOP_VIEWPORT.  However, some users may experience this as an
unpredictable "shuffling" of workspaces.  While WMs could disable
advertising the property itself, it seems more sensible to handle this
at the level of polybar.  Hence, introduce a new group-by-monitor
flag—defaulting to true—which can be used to disable this behaviour.

Closes: https://github.com/polybar/polybar/issues/2603
Related: https://github.com/xmonad/xmonad-contrib/pull/791
Related: https://github.com/qtile/qtile/issues/3375

Co-authored-by: scaramangado <scaramangado@gmail.com>
2023-10-29 16:15:10 +01:00
patrick96 6a648c8ef7 doc: Update readthedocs URLs
There is a redirect setup that redirects anything to `/en/stable` (or
whatever the default version is).
This allows us to create version-agnostic direct links that always
redirect to the default version
2023-10-23 00:32:46 +02:00
patrick96 aebdb5328a fix(backlight): Poll if necessary
The `backlight` file seems to not receive modification events for
inotify (it does receive other events though).
These other events still trigger an update, but the value read is still
the old value because the events arrive just slightly before the file is
updated.

The new `poll-interval` setting will inject an event every X seconds to
force an update.
If the actual_brightness file is used, the interval is set to 0 and thus
turned off.

This does not add any more wakeups to the module, the inotify modules
wake up every second anyway and during that time, the interval is
checked.

Fixes #2835
2023-10-21 20:32:11 +02:00
patrick96 c9752598a5 fix(bspwm): Restack against topmost root window.
The ewmh strategy has to be dropped because the
`_NET_SUPPORTING_WM_CHECK` window may (at least in bspwm) appear
anywhere in the window stack.

To fix the overlapping monitors issue in #2873, we simply restack
against the topmost of these root windows.

Fixes #2972
Fixes #2873 (again)
2023-10-08 21:04:29 +02:00
patrick96 1043354aec tray: Deprecate all legacy tray settings 2023-08-06 15:26:28 +02:00
patrick96 4d1bba2c4e Add changelog 2023-05-15 14:44:50 +02:00
patrick96 f78ec80df3 Add changelog entry 2023-05-10 17:06:00 +02:00
patrick96 8cc1b4fcfd fix(build): Use CMAKE_INSTALL_FULL_<dir> for default config
Using CMAKE_INSTALL_SYSCONFDIR does respect CMAKE_INSTALL_PREFIX, but it
prefixes it to CMAKE_INSTALL_SYSCONFDIR, which results in the default
config being installed to /usr/etc/polybar/config.ini or
/usr/local/etc/polybar/config.ini

CMAKE_INSTALL_FULL_SYSCONFDIR gives an absolute path that respects the
prefix but does the right thing (uses /etc) if it is /usr

Ref: #2770
2023-02-13 22:08:57 +01:00
patrick96 fc423c0921 fix(i3): Deal with negative coordinates
Pulls in fix in i3ipcpp repo: https://github.com/polybar/i3ipcpp/pull/12

Fixes https://github.com/polybar/polybar/issues/2888
Ref https://github.com/i3/i3/discussions/5352
2023-01-05 22:11:08 +01:00
patrick96 edf37385cb script: Bump poll timeout to 250ms
The module has a poll timeout because it needs to periodically check if
it is shutting down. Otherwise, it would be stuck polling and the bar
couldn't shut down until the script produces a new line.

However, this causes the bar to wake up intermittently (currently
~40/s) due to the 25ms timeout.
Bumping this to 250ms still gives us timely shut downs and caps the
number of wake ups to 4/s.

This is only a stop-gap solution, ideally the script runner is
integrated into the main event loop and uses its polling handles which
don't have to wake up to check for a shutdown.

Ref #1778
Ref #2337
2022-12-12 00:52:13 +01:00
patrick96 d5498c8a8a script: Require zero exit code to show empty module.
Showing an empty module if the script failed but produced no output does
not make too much sense.

Ref #2857
2022-11-05 12:43:43 +01:00
patrick96 87750c064e build: Bump C++ to C++17
Now requires gcc8 or clang7
2022-10-23 15:20:21 +02:00
Madhav Prabhu C M 30e1cc2595
feat(ipc): <label> support (#2841)
* Label = %output% working

* build fix

* Output as deprecated, Label as default

* Corrections

 * Corrections Simplified

* Changelog updated
2022-10-23 10:47:22 +02:00
Ashwin cbf5439e80 changelog 2022-10-22 13:06:06 +02:00
Madhav Prabhu C M 54b75f23ab
feat(ipc). Per hook format (#2810)
* Added format-x support for ipc_module, tested with demo config

* Certain cases not working

* Certain cases not working, build

* Changed label to output tag, Mixing of default formats wont work

* created changelog
2022-10-09 18:42:36 +02:00
Patrick Ziegler e9713185cb
backlight: Remove actual_brightness amdgpu check (#2839)
The issue has been fixed in the linux kernel version 5.9 and above so we
are removing our workaround for this from polybar.
Users with older versions can still work around this by explicitly
setting `use-actual-brightness` to false, it is just not done by default
anymore.

Closes #2835
Ref https://bugzilla.kernel.org/show_bug.cgi?id=203905
Ref 69d9f4278d
2022-10-08 15:52:47 +02:00
Ron0Studios 303015244e
feat: longest match ws-icon fuzzy matching (#2831)
* better fuzzy matching

Improved fuzzy matching so that it finds the longest matching icon instead of the first possible match

* Update CHANGELOG.md

* removed debug output

* added tests and improved fuzzy finder

- added return statements to the fuzzy finder
- added tests to check whether the fuzzy finder works.

* minor style changes

* minor change to iconset.cpp

* Delete tasks.json
2022-10-05 23:05:44 +02:00
Ashwin Rajesh 03987b19a5
fix(xwindow): Crash when no tag is set in format (#2833)
* xwindow works without tag

* changelog
2022-10-05 21:39:02 +02:00
patrick96 5719d130fd feat(xwindow): %instance%, %class% from WM_CLASS 2022-10-02 20:57:29 +02:00
Patrick Ziegler 053a7eb2d8
fix: Crash on root pixmap and window depth mismatch (#2813)
The background_manager used the root window depth for creating its
pixmaps, but when the root pixmap has a different depth, this causes the
copy_area_checked call to fail and crash the bar.

We now load the root pixmap before finding the visual and creating the
slice pixmaps.

Fixes #2798
2022-09-05 09:58:12 +02:00
Patrick Ziegler d817080ee8
fix(renderer): Small gaps when rendering emojis (#2802)
If any rendered text uses a non-integer number of pixels (often emojis),
rendering of subsequent text blocks will start between pixels which
results in small gaps in the background and over/underline colors caused
by cairo only rendering at fractional-intensity in the beginning and end
pixel.

Simply rounding up text width can solve this.

Fixes #2785
2022-08-25 00:55:16 +02:00
Ashwin Rajesh 7838241a77
feat(tokens): Negative minimum length adds right padding (#2801)
* negative minimum length adds right padding

* missing else statement

* updated changelog
2022-08-25 00:36:38 +02:00
Dave 6ccecbfca2
feat(temperature): Add `zone-type` setting (#2752)
Signed-off-by: xphoniex <dj.2dixx@gmail.com>

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-08-21 19:25:42 +02:00
Quantenzitrone 708bd9c891
feat(temperature): %temperature-k% token for Kelvin (#2784)
* added kelvin option for module/temperature

* changelog for the changes i made

* fixed typos

* fixed the temperature conversion to be more precise

* Update CHANGELOG.md

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* changed the calculation of the different temperatures

it now uses float as a initial value and makes m_temp temp_k and temp_f by converting and rounding with std::round

* std::lround makes more sense to use than std::round

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2022-08-21 19:10:48 +02:00
Patrick Ziegler b5764c8a93
Use CMAKE_INSTALL_SYSCONFDIR instead of /etc (#2770)
Some distro's build infrastructure (e.g. gentoo) can use
CMAKE_INSTALL_PREFIX to install to a different location.
When the config path is hardcoded to /etc, CMAKE_INSTALL_PREFIX has no
effect.

Ref: https://bugs.gentoo.org/858797
2022-07-19 23:26:11 +02:00
patrick96 841b799299
Add include-file reload fix to changelog 2022-07-09 12:26:07 +02:00
raffael0 f3e27a205e
backlight: auto-detect default card (#2728)
* auto-detect a default backlight

* Implemented suggestions

* added changelog

* Implemented suggestions

* Fix changelog formatting

Co-authored-by: patrick96 <p.ziegler96@gmail.com>
2022-06-16 12:54:38 +02:00