Commit Graph

762 Commits

Author SHA1 Message Date
Sebastian Graf
cb75857ff6 pulse: Set volume to max when the increase was too huge (#1765)
Previously, when volume was in close proximity to n_max_volume, a larger
increase would not do anything. After this patch, volume is set to
m_max_volume in such scenarios. If the volume already is at
n_max_volume, we mirror the old behavior and emit a warning.

So, for example, consider m_max_volume was 100%, but the volume prior
to the increase was 96%. An increase of 5% would do nothing (emit a
warning, even) instead of setting the volume to 100%.

Note that this might happen even if the volume is at 95% according to
%percentage% due to rounding errors.
2019-05-14 22:06:14 +02:00
Roberto Santalla
b2b73b5d91 feat(battery): add %percentage_raw% token (#1756)
Displays real percentage instead of being set to 100 if percentage > full-at

* battery: added percentage_raw token, which ignores full-at

* battery: current_percentage returns raw, added clamping function instead

* battery: clamp percentage used by build()
Made clamp_percentage() const to allow its usage inside build()

* battery: read and return percentage in one line
2019-05-14 15:01:54 +02:00
patrick96
0ab9fcdc38 refactor: Remove all mentions of icon_t
Is exactly the same label_t
2019-04-08 09:01:48 +02:00
Kazufumi NOTO
7414e98008 feat(temp): Configurable lower bound for ramp (#1706)
Similar to warn-temperature, temps below `base-temperature` will use the first ramp icon.

Closes #1703
2019-04-07 18:36:09 +02:00
Jérôme BOULMIER
fca4151f36 fix(window): remove useless operator= and add default copy cstr (#1729)
Fixes compilation under GCC 9

The default copy constructor implicit generation is deprecated by C++ standard.

The window& operator=(const xcb_window_t win); operator seems to be useless.

Fixes #1728
Ref jaagr/xpp#16
2019-04-07 17:32:55 +02:00
patrick96
fc2d2db76f refactor(cmake): Determine version in cmake
We need to have the version string available in multiple places not just
the source code. It is now hardcoded in the root CMakeLists.txt and all
files that need it will be configured with cmake.

This also removed the unecessary duality of GIT_TAG and APP_VERSION and
GIT_TAG_NAMESPACE and APP_VERSION_NAMESPACE.
2019-04-05 23:43:37 +02:00
DrunkenChicken
25f99c0a61 fix(xworkspaces): active ws upon ws deletion (#1713)
Active desktop was tracked via it's index, but when desktops are removed from `_NET_DESKTOP_NAMES` that index may become invalid.

Fixes #1710
2019-04-01 18:04:44 +02:00
Jérôme BOULMIER
31a25af3d3 fix(tray): fix offset for negative percentage (#1669)
tray-offset-{x,y} were clamped between [0, max_value] rather than [-max_value, max_value]. Therefore negative percentage were ignored.

Fixes #1666
2019-03-22 09:55:08 +01:00
Kazufumi NOTO
82b9ea8a09 fs: Fix incorrect size report on 32bit machines (#1699)
Cast before multiplication to avoid overflow.

Fixes #743
2019-03-18 18:16:42 +01:00
Jérôme BOULMIER
e3b84c9595 fix(controller): ignore SIGUSR1 until polybar is fully reloaded. (#1678)
To avoid polybar from being killed by SIGUSR1 during reloading, SIGUSR1 is ignored until the signal is registered in the new polybar process.

As stated in signal(7) man page, the ignored signals are still ignored after a call to a function of the execvX family.

    During an execve(2), the dispositions of handled signals are reset to the default;
    the dispositions of ignored signals are left unchanged.

Fixes #428
2019-03-13 07:55:02 +01:00
patrick96
b3f7cd08e9 fix(xkeyboard): Only update indicators when used
Was causing a segfault if `format = <label-layout>`
2019-03-06 20:29:12 -08:00
patrick96
de3240b861 fix(xkeyboard): Print deprecation message
`config::warn_deprecated` does not accept keys of the form `<...>` and
strips the surrounding brackets like `load_label` does
2019-03-06 20:29:12 -08:00
patrick96
fbd870c343 fix(xkeyboard): Use correct indicator label field
Fixes #1660
2019-03-06 20:29:12 -08:00
Gilad Naaman
db9a83a83b feat(xkeyboard): Customizable indicators and layouts (#1559)
* `layout-icon-*` list that maps layouts to icons.
* `indicator-icon-*` list that maps indicators to off and on icons
* `label-indicator-off`
* `label-indicator-on` which replaces the now deprecated `label-indicator`
* `label-indicator-[on|off]-*` for each indicator. Overrides `label-indicator-on` and `label-indicator-off` 

Fixes #1558 
Closes #1048

* add icon support for xkeyboard layouts

* removed unneeded #include

* add sperate %icon% token that can be used in <label-layout>

* removed unneeded #include

* added caps lock indicator (was mentioned in wiki, but not actually implememnted) and support for indicator icons

* a few more fixes to make sure existing user configs are not broken

* ready to go

* Added an option to replace xkb indicator names

* Added labels for each indicator state

* Removed print left on accident

* Fixed review comments

* Update src/modules/xkeyboard.cpp

Co-Authored-By: Gilnaa <gilad@naaman.io>
2019-02-24 22:35:39 +01:00
striker.sh
ca4426a962 fix(xworkspace): Fully support _NET_DESKTOP_NAMES spec (#1579)
Ref https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472706208

Fixes #1491
Fixes #248
Closes #904
2019-02-08 13:32:31 +01:00
patrick96
b3ceedde76 refactor(bar): Remove bar_settings.center
Not used anywhere
2019-02-05 11:50:25 +01:00
Patrick Ziegler
a7ad68da31
fix(randr): Check if there is a primary monitor (#1621)
* fix(randr): Check if there is a primary monitor

primary_info.name() throws an error if get_output_info is called with
XCB_NONE

Fixes #1620
2019-01-24 21:17:35 +01:00
NBonaparte
1145681cf5
feat(monitor): use primary monitor as default (#1426)
If the monitor option isn't set, the primary monitor (if connected) is chosen as the default display.
2019-01-20 11:20:30 -08:00
patrick96
b03f14400a fix(net): buffer overflow when gathering ipv6 addr 2019-01-20 15:12:22 +01:00
Benno Fünfstück
f74c524fff fix(renderer): Handling of missing root pixmap (#1608)
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 #1582 
Fixes #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
2019-01-17 14:22:48 +01:00
patrick96
01be9b3504 feat(net): All tokens for all labels
If you have `accumulate-stats = true` it is useful to be able to display
the current network speed even if the interface is disconnected.
2019-01-17 08:35:49 +01:00
patrick96
014606294c fix(net): Display N/A when no ipv4 address 2019-01-17 08:35:49 +01:00
Patrick Ziegler
921658f331
memory: Remove decimal places for megabytes (#1606)
As requested in #1598

Two decimal places for megabytes gives you precision at the scale of tenths of kilobytes, which is quite unnecessary for RAM
2019-01-17 08:32:42 +01:00
patrick96
a0b888b5e6 fix(fs): Calculate free bytes properly
Seems this was missed in a682d2af91

This is now also consistent with what df does

Closes #743
2019-01-17 08:31:48 +01:00
patrick96
67f1ceaaca feat: format-font
Resolves #19
2019-01-17 08:31:14 +01:00
Ddone
46b8bb84ed feat(border): Percentage and pixel offset (#1592)
Uses the same X%:Z format as width, height and offset-*

Resolves #1567
2019-01-12 11:48:09 +01:00
Ddone
b728fea5be fix(i3): crash without <label-state> (#1591)
Fixes #975
2019-01-09 18:38:44 +01:00
patrick96
4a506d429d xbacklight: Use monitor-strict from bar settings
monitor-strict in the xbacklight module was never documented anywhere so
it's fine to remove it.
2019-01-08 17:23:28 +01:00
patrick96
e793082008 randr: Add separate key for exact monitor matching
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
2019-01-08 17:23:28 +01:00
patrick96
fe0b072dd0 feat(bspwm): Support marked flag for focused nodes
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
2019-01-08 17:14:39 +01:00
Benno Fünfstück
7256366112 fix(tray): correctly handle transparency when using offset (#1571)
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>
2019-01-05 01:08:18 +01:00
Matthias Viehweger
dec801a114 fix(xworkspaces): FPE when no _NET_DESKTOP_NAMES (#1576)
Fixes #1462
2019-01-03 18:59:55 +01:00
Sergey
cc8947ac01 feat(cpu): Add percentage-sum token (#1517)
Adds `%percentage-sum%` token to cpu label that contains the cumulative load of all cores.
2018-12-03 01:48:18 +01:00
NBonaparte
35c0c4a343 fix(xcb): check for composite extension (#1430)
* fix(xcb): check for composite extension

* fix(travis): add xcb-composite to deps

* fix(xcb): always include composite when building
2018-12-02 16:39:14 +01:00
sunil
22af69545a feat(net): Support bridge interfaces (#1528)
Bridge interfaces don't provide linkspeed via ethtool but everything else works the same as with ethernet links.

Fixes #1522
2018-11-28 16:09:00 +01:00
sam-lunt
d3e37918e5 CMake refactor (#1510)
* 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
2018-11-21 18:46:33 +01:00
patrick96
f8e4a5932a refactor: Unescape action cmd before emitting 2018-11-16 18:12:26 -08:00
patrick96
38f551f884 test(parser): Add tests for parse_action_cmd 2018-11-16 18:12:26 -08:00
patrick96
18e2609f11 fix(builder): Escape all colons in action command
Fixes #984
2018-11-16 18:12:26 -08:00
Denis Kasak
fa693aecf8 feat(script): Add double-click to script module (#1442) 2018-11-16 16:06:04 +01:00
patrick96
6ca4f06785 doc: Convert @ to \ doxygen commands
Ref #1377
2018-11-04 19:28:27 -08:00
patrick96
3c504bb913 fix(build): remove side-effects of iwlib.h
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
2018-10-31 17:00:13 -07:00
patrick96
3b32f5899a fix: Move return value of parse_layout_symbol
Fixes #1469
2018-10-16 11:05:14 -07:00
Patrick Ziegler
b80023fd41
feat(cpu): Add ramp-coreload-spacing (#1472)
Resolves #1389
2018-10-16 01:11:05 +02:00
Patrick Ziegler
6d0cfbdfde Revert "feat(cpu): Add ramp-coreload-spacing (#1472)"
This reverts commit 06adef1055.
2018-10-16 01:01:11 +02:00
Ryan Geary
06adef1055 feat(cpu): Add ramp-coreload-spacing (#1472)
Resolves #1389
2018-10-16 00:59:45 +02:00
patrick96
abdd5f9233 fix(script): Avoid duplicate action tags for tailed
If a tailed command is used polybar would generate two action tags, one
with %counter% replaced and one with %pid% replaced, but never both

This is a bug that was introduced in #934
2018-10-08 21:38:25 -07:00
patrick96
13b0ee7454 tray: Properly deprecate tray-transparent 2018-10-04 15:52:03 +02:00
Benno Fünfstück
70807a5a9f fix(renderer): remove debug code, add comment 2018-10-04 15:52:03 +02:00
Benno Fünfstück
6237e2d419 fix(renderer): fix pseudo-transparency wrong compositing
The idea is that pseudo-transparency should behave like real transparency as
much as possible. To achieve this, we now render the bar the same way in both
cases. The only part where pseudo-transparency differs is at the very end, where
the rendered bar is captured and composited against the desktop background
image. This should ensure that both modes behave the same.
2018-10-04 15:52:03 +02:00