Polybar had issues when there is no background set or set by a tool like imagemagick which doesn't add the root pixmap to the root window properties.
There's not much we can do about it, but at least polybar doesn't crash anymore.
Fixes#1582Fixes#1585
* fix(tray_manager): only enable transparency if neccessary
Previously, we always enabled transparency
* fix(background_manager): avoid needless fetching
* fix(renderer): move logging message to correct place
* fix(background_manager): handle dummy pixmap (_XSETROOT_ID) right
* fix(background_manager): more initialization + don't free on error
Freeing on error is incorrect, since we could still be called again later in
which case we still need the resources.
* fix(background_manager): add more infos to trace logs
* fix(background): correct typo (XROOTMAP -> XROOTPMAP)
* fix(background_manager): do not report "no background" as error
* style(background_manager): use braces for if
Co-Authored-By: bennofs <benno.fuenfstueck@gmail.com>
* fix(background_manager): better error message for dummy pixmap
Co-Authored-By: bennofs <benno.fuenfstueck@gmail.com>
* style(background): some more style fixes
* fix(connection): initialize pixmap in all cases in root_pixmap()
* style(connection): improve readability using early return
This adds `monitor-exact = true` in the bar section
This also properly does best-match instead of first-match if multiple
matches exists. For example if there are two monitors HDMI2 and HDMI-2
and we try to match HDMI-2 with monitor-exact = false, until now HDMI2
would be matched. Now exact matches are always preferred.
Fixes#1532
This adds a new label in the bspwm module `label-marked`
This flag for focused nodes of a focused desktop was introduced in [1]
and released with bspwm 0.9.4
It adds the `M` flag to `G` type items in bspwm's report format
Resolves#1552
[1]: d0138af475
This patch adds support for observing multiple slices of the desktop background.
This is used for the tray so that it doesn't have to rely on the bar's rect to
get the desktop background. In particular, it now handles the case where the
tray is not contained fully within the bar's outer rect (for example, when using tray-offset-{x,y})
Co-Authored-By: bennofs <benno.fuenfstueck@gmail.com>
### Breaking Changes:
None
### Changelog
**New Config Options**
The following config options were added
In the `[settings]` section:
* `pseudo-transparency`
In `internal/cpu`:
* `ramp-coreload-spacing`, spacing between elements in `<ramp-coreload>` elements
* `%percentage-sum%` in `label`. Shows sum of all percentages
In `custom/script`:
* `double-click-left`
* `double-click-middle`
* `double-click-right`
In `internal/pulseaudio`:
* `interval`, volume increase and decrease steps in percentage points
In `internal/memory`:
* `bar-swap-used`
* `bar-swap-free`
* `ramp-swap-used`
* `ramp-swap-free`
**Deprecations**
* `tray-transparent` in the bar section is no longer used. The tray now always uses pseudo-transparency
**Features**
* volume: adjustable volume steps (#1364), see #1361
* memory: Add progress bars and ramps for swap (#1325)
* render: pseudo-transparency (always used in the tray) (#595)
* cpu:
* Configurable spacing in between coreloads (#1472), see #1389
* Non-normalized cpu load (#1517), see #1516
* script: Double click actions (#1442)
* net: Support for bridge interfaces (#1528), see #1522
* token: zero pad tokens when min-width value starts with a `0` (#1341), see #1332
**Fixes**
* config: Use font patterns detected on system in sample config (#1350)
* net: Disconnected module when SSID is only an emoji (#1371), see #1367
* tray: Tray overlapping with bar (#1392), see #591
* build: Several build errors (#1395, #1454, #1470, jaagr/xpp#12, #1493), see #1447, #1469, #750, #1492
* mpd: format-online-prefix not working (#1402), see #1399
* font: Crash for some font-patterns (#1451), see #1435
* script:
* Only `%counter%` or `%pid%` token usable, never both (#1456)
* click actions with colons in them (#1457), see #984
* renderer: Bar locks up when xorg composite extension is disabled (#1430), see #1425
The previous approach relied on manually updating the version and date
using a Makefile
This approach dynamically gathers the correct version from git and uses
the date of the latest commit in the branch
* Clean up CMake logic
- removed logic to find CppUnit (no longer used)
- removed "dirs" variable used to pass include directories
- removed add_library function (no longer used)
- removed make_executable function
* only used in 2 places (polybar and polybar-msg)
* it was more general than needed, logic is simpler without it
- split polybar into static library and executable
* this allows linking unit tests to the library
* rename library
* add coverage build
- Added a CMake build type "Coverage" that builds C and C++
code with the "--coverage" flag (recognized by both GCC and Clang)
- removed "-Wno-missing-field-initializers" from test flags,
since it didn't seem to be needed any more
- removed logic from tests/CMakeLists to disable "-Werror" and "-pedantic-errors"
since there didn't seem to be any warnings during the build
* fix whitespace
* update travis
* remove O2 from defalt flags
* allow tests to be built by default make target
* disable Werror for debug builds
If FcNameParse returns NULL FcDefaultSubstitute segfaults
We log and throw an error here because the signal emitter swallows all
exceptions so if that exception was thrown, the bar would stop rendering
without any indication as to why.
Fixes#1435
wireless_tools 29 redefines inline in iwlib.h as:
#define inline inline __attribute__((always_inline))
which conflicts with POLYBAR_NS, which is defined as:
#define POLYBAR_NS \
namespace polybar { \
inline namespace APP_VERSION_NAMESPACE {
In version 30.pre9 this #define is moved into a source file and thus
cannot conflict.
The error only occurs when building with clang, so it seems gcc and
clang handle this differently
Fixes#1492
We need to use positions relative to the position of the bar for indexing into
the background image slice, but the code used absolute ones.
This worked fine as long as absolute positions are the same as relative
positions (this is the case for a bar located at (0,0), so if bottom = false).
But for bottom bars (where the bar position is not (0,0)) this was wrong which
caused the tray background to be black (out of bounds for the background slice).
The systray only supports pseudo transparency (real transparency would require
much larger changes) so the real transparency should only be used for the bar itself.
We now take the bar position that the window manager gives us instead of trying
to calculate it ourselves. This is more correct when multiple bars are attached
to the same edge, as the window manager may move some of them in that
case (assuming override redirect is not enabled)
We need to fetch the outer area from the root window, not just the inner area
because we paint the background below the borders as well.
This has the nice effect of supporting semi-transparency for borders as well.
Now all the tokens in the memory module also have ramp and bar counterparts.
These can be used exactly the same as `bar-used` and `ramp-used`, they are named `<bar-swap-used>`, `<bar-swap-free>`, `<ramp-swap-used>`, and `<ramp-swap-free>`
Breaking Changes:
* `0 < label-NAME-maxlen < 3` will now throw an exception and disable the containing module, if ellipsis is enabled for that label. (#1198)
Changelog:
Deprecations:
* `internal/volume` is now called `internal/alsa` (#967)
* temperature: The `%temperature%` is deprecated in favor of `%temperature-c%`(#897)
* mpd: `icon-repeatone` is deprecated in favor of `icon-single` (#1295), see #1279
Features:
* feat(mpd): Add support for icon-consume (#861)
* feat(bspwm): Add workspace separator (#942)
* feat(i3): Add workspace separator (#938), see #929
* feat(build): Make polybar build on FreeBSD (#931, jaagr/xpp#8), see #239
* feat(volume): Add pulseaudio backend (#779)
* feat(script): Add %pid% token for tail commands (#934)
* feat(temp): Add temperature tokens without unit (#897)
* feat(memory): Add memory used/free ramp (#1038), see #1037
* feat(memory): Add swap tokens (#1018)
* feat(net): Add unknown-as-up option (#1077), see #457
* feat(config): Support fractional size and offset (#972), see #953
* feat(xwindow): Add label-empty (#1136)
* feat(battery): Add animation-discharging (analog to animation-charging) (#1190)
* feat(config): Support pixel offset for bar size and offset values (#1224)
* feat(mpd): Add `%album-artist%` token (#1263)
* feat(net): Add local_ip6 token (#1239), see #1234
* feat(net): Add nl80211 support (#1009), see #277
Fixes:
* fix(mpd): Wrong elapsed time when after standby (#921), see #915
* fix(config): Wrong min, maxlen when using the same token multiple times (#974), see #971
* fix(battery): use power_now correctly (#958), see #928
* fix(mpd): Crash when mpd isn't running (#983), see #979
* fix(xworkspaces): Respect 'enable-scroll' (#1002)
* fix(xbacklight): Respect 'enable-scroll' (#1014)
* fix(build): support xcb-proto >=1.13 (jaagr/xpp#11), see #973
* fix(mpd): Respect MPD_HOST env variable (#1025), see #1007
* fix(i3): Reconnect i3 IPC socket on restart/error (#1099), see #762
* fix(cursor): Occasional crash on mouseover (#1124), see #1117
* fix(net): Mark 'not connected' on querying failure (#1171), see #1163
* fix(gcc): Fix -Wstringop-truncation warning (#1216, jaagr/i3ipcpp#7), see #1215
* fix(builder): Don't truncate colors with same channels (#1217), see #1183
* fix(bspwm): Consistent behavior when scrolling through multiple desktops (#986), see #981
* fix(builder): Respect label-ellipsis option (#1198), see #1194
The check of the maxlen and ellipsis condition was also moved to the
label creation, this way get_label_text doesn't need to care about the
restrictions placed on maxlen and ellipsis
The repeatone button doesn't influence repeating behaviour at all, so
the name is misleading.
This deprecates icon-repeatone for now, until we can completely remove
it
Fixes#1279
This patch enables support for nl80211. In case the libnl-genl-3.0
library isn't found, it will fall back to Wext instead.
The library to use can also be manually set with the CMake option
WITH_LIBNL.
The Wireless-Extensions (WE or Wext) are deprecated and long replaced
by cfg80211.
Although Wext isn't used by WiFi drivers anymore, CFG80211_WEXT allows
old tools to communicate with modern drivers by providing a wrapper
API.
It's queried the same way ipv4 addresses are queried, but here it displays globally routable addresses. If there are multiple such addresses, it picks one (same as with ipv4). It's possible that an address discovered this way is not in fact globally reachable but still marked as global.
Using brace initialization here causes bar.hpp to not compile when
included on its own, forcing all clients to also include
tray_manager.hpp and so on, which defeats the purpose of forward
declaring those classes.
This also allows us to remove the tray_manager.hpp, renderer.hpp and
parser.hpp includes from the clients of bar.hpp
Only updating when an mpd event occurred would cause issues when mpd was
playing and the machine was put to sleep because the elapsed time was
calculated by taking the time difference of the last update and now
which would give you wrong numbers, if the machine was in standby in
between.
Since the update function on the module is only called once a second (or
when an event happens), we can just update the data every time without a
huge performance hit.
Fixes#915
Breaking Changes:
* Date module no longer supports non-padded specifiers (i.e. `%-d`) and potentially other specifiers, see #792
- Check http://en.cppreference.com/w/cpp/io/manip/put_time to see supported specifiers
* Setting background color to `background-0` with gradients (refer to https://github.com/jaagr/polybar/wiki/Known-Issues)
Changelog:
Features:
* Feat(mpd): State-specific formats (`format-playing`, `format-paused`, `format-stopped`) (#567), see #524
* Feat(ipc): Visibility commands (show, hide, toggle, restart, quit) (b6c5563)
* Feat(shell): Bash completion (#588)
* Feat(menu): `expand-right` option (#658), see #655
* Feat(temperature): hwmon sysfs support (#688), see #404
* Feat(cursor): Change cursors over clickable/scrollable areas (#727), see #721
* Feat(temperature): Fahrenheit and Celsius tokens (#804)
* Feat(mpd): Use mpd name tag or URI as fallback for title-less tracks (#823), see #815
Fixes:
* Fix(i3): Clicking workspaces without index (#521), see #520
* Fix(parser): Prefix options overriding format options (#729), see #544
* Fix(parser): Overline tags (eebf105)
* Fix(process_util): Prefix shell environment variable (`$POLYBAR_SHELL`) (86ff947), see #566
* Fix(parser): `%{R}` tag (reverse colors) (0bd8f1f), see #585
* Fix(renderer): Center block position with tray (389bae2 & #673), see #551 & #672
* Fix(xworkpaces): Active workspace with XMonad (#587), see #411 & #535
* Fix(config): Expand tilde, environment variable (d3b0670 & #724), see #603 & #719
* Fix(build): Remove curlbuild.h (#648), see #647
* Fix(renderer): Off by one error for actions (#663), see #661
* Fix(gcc): GCC 7.1 ([jaagr/xpp/#6](https://github.com/jaagr/xpp/pull/6))
* Fix(fs): Use `bytes_available` for `percentage_used` (138f5fa), see #710
* Fix(fs): Use `f_frsize` for calculations (a682d2a)
* Fix(date): Remove date string length limitation (#745), see #754
* Fix(renderer): Nested actions (#772), see #760 and #758
* Fix(i3): Check and warn if current workspace not found (#826), see #824
* Fix(github): Prevent module disappearing with no connection (#811), see #810
* Fix(renderer): Module gradients (#831), see #759
* Fix(build): Update deprecated jsoncpp Reader
expand-right defaults to true to preserve the current functionality
If set to false, the items in the menu will be added to the left of the
toggle label (instead of the right side)
Should resolve the issue discussed in #655
If the mouse was at the leftmost edge of the screen and there was an
action area from 0 to N, the click wouldn't register
Before if an action area was defined from A to B it was from A exclusive
to B inclusive now it is from A inclusive to B exclusive. This is the
same way that the pixel addresses work, since a pixel's coordinate is
defined by the top-left corner.
Fixes#661
When focusing a desktop with the urgent flag, two events are received
from `bspc` simultaneously, separated by a newline character.
This was not handled correctly and the second event was discarded causing
the urgent style to be removed, but the focused style would remain on the
previously focused desktop.
This fixes the problem by handling any number of events that arrive at the
same time (separated by newlines).
This helps ensure that when a string is truncated it is not done in the
middle of a utf8 multi-byte sequence. This doesn't 100% correspond to
user-perceived characters, but it should be pretty close in most cases.
In the previous implementation, std::find() returned fns.end() several times,
which caused an "Address boundary error" in std::sort if the preferred
font-index was set to m_fonts.size() + 1.
This commit reimplements the font prioritization with a simple swap.
Reproduction steps:
- Start polybar with the following config:
[bar/top]
font-0 = NotoSans-Regular:size=8;0
font-1 = MaterialIcons:size=10;0
modules-left = date
[module/date]
type = internal/date
date = %Y-%m-%d
label-font = 3 ; invalid index
This tries to mimic the old renderer's behavior as closely as possible.
In the absence of any information, DPI is assumed to be 96x96. DPI can
be configured on a per-bar basis using the configuration key "dpi".
To use the DPI configuration from Xresources (if built with support),
one can specify the following in the bar config:
dpi = ${xrdb:Xft.dpi:96}
This fixes a "bug" where polybar wouldn't reload on a configuration
file change on some configurations of vim, which don't actually issue
any IN_MODIFY events because they choose to move the file, replace it
with a new one, and then delete the file instead.
To work around this, we now also listen for IN_IGNORED which fires when
the file we are watching is destroyed. When this happens, we re-attach
the configuration file watcher to the new file and reload.
Added support for fuzzy matching workspace names when assigning icons.
This feature is enabled/disabled through a new option, 'fuzzy-match'.
It is disabled by default.