Commit Graph

1831 Commits

Author SHA1 Message Date
Mihir Lad
64aa2013c2 Add dwm example config to config.cmake
label-state will be the label used for each tag. label-layout will show the
current layout. label-title will show the current window title.

label-title allows each monitor to show its selected window's title on the bar.
The xwindow module only shows the currently focused window on all monitors.

pin-tags will show all tags whether or not they are selected.

label-separator is inserted between workspaces.

enable-click will allow the user to view tags and toggle the view on tags.
2020-12-19 19:30:04 -05:00
Mihir Lad
af6b2754b4 Add dwm module to unsupported.hpp 2020-12-19 19:30:00 -05:00
Mihir Lad
c6ece92223 Update dwmipcpp submodule 2020-12-19 19:28:34 -05:00
Mihir Lad
ad3666ed47 Update cmake/config files to include dwmipcpp
Include dwmipcpp as a library in cmake and config files, so it can be built
automatically. The configuration of dwmicpp was added to match that of i3 and
bspwm to maintain the same cmake workflow and style.
2020-12-19 19:28:34 -05:00
Mihir Lad
6dac47f1c1 Add dwmipcpp submodule
This library will be used for the dwm module.
2020-12-19 19:28:34 -05:00
Nolan Prochnau
0d2838fcd5
feat(xkeyboard): Add variant support to layout label (#2163)
* Add variant support to xkeyboard layout label

Solves #316

* Run style checks, I guess?

* Add comment

* Return nothing if there is no variant

* Update CHANGELOG
2020-12-19 18:22:27 +01:00
Filip Banák
6f13fe93a3
xkeyboard: Fix indicator spacing (#2306)
* Fix xkeyboard module spacing between the layout and indicators when indicators are empty.

* Simplify the empty label check.

* Remove permanently enabled SCROLL_LOCK, sorry.

* Another mistake.

* Update src/modules/xkeyboard.cpp

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

* Update src/modules/xkeyboard.cpp

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

* Update.

* Fix xkeyboard module spacing between the layout and indicators, when indicators are empty. And fix the spacing between indicators when some are empty.

* Add issue #2292 to fixed.

* Update CHANGELOG.md

Co-authored-by: Filip Banák <6111455-Filip62@users.noreply.gitlab.com>
Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2020-12-17 20:49:10 +01:00
Patrick Ziegler
fd556525a8
New Tag Parser (#2303)
* refactor(color): Use enum class for color type

* Add testcases for tag parser

* Make tag parser a pull-style parser

Being able to parse single elements at a time gives us more fine-grained
error messages, we can also parse as much as possible and only stop
after an exception.

* fix(color): Parser did not check for invalid chars

* tag parser: First full implementation

* tag parser: Fix remaining failing tests

* tag parser: Replace old parser

* tag parser: Treat alignment as formatting tag

Makes the structure less complex and the alignment tags really are
formatting tags, they are structurally no different from the %{R} tag.

* tag parser: Cleanup type definitions

All type definitions for tags now live in tags/types.hpp, the parser.hpp
only contains the definitions necessary for actually calling the parser,
this shouldn't be included in many places (only places that actually do
parsing). But many places need the definitions for the tags themselves.

* Rename components/parser to tags/dispatch

* tag parser: Cleanup

* Add changelog
2020-12-17 20:37:28 +01:00
Patrick Ziegler
c07cc09a5f
doc: Add changelog to CONTRIBUTING.md TOC (#2310) 2020-12-17 02:17:56 +01:00
Patrick Ziegler
d63bf294b7
Adopt "keep a changelog" (#2308)
* Adopt keep a changelog

Ref: https://keepachangelog.com/en/1.0.0/

* Add changelog to release and contributing docs

* Use H2 for automatically added Download section

The individual changelog subsections use H3 and the changelog section
uses H2, so the Download section should use the same heading

* Add already present changes to changelog

* Mention changelog issue references in CONTRIBUTING.md
2020-12-16 16:04:10 +01:00
patrick96
680bb2d5e4 codecov: Disable pull request annotations
Codecov would add code comments (annotations) to PR diffs whenever a
line was not covered by tests. This isn't really useful to us right now
and just produces noise.
2020-12-16 00:06:10 +01:00
patrick96
433a313782 codecov: Recursively ignore test and lib folder
It seems that tests/* and lib/* don't actually exclude all the files in
codecov
2020-12-15 01:47:32 +01:00
patrick96
6afe6581e1 aur: Update PKGBUILD for 3.5.2 release 2020-12-14 11:10:27 +01:00
patrick96
4d2bdaa0bd
Merge branch 'hotfix/3.5.2' 2020-12-14 10:53:13 +01:00
patrick96
3eda8832b9
Release 3.5.2
Changelog

**Fixes**

Legacy action name support was accidentally broken in 3.5.1 (#2296), see #2299
2020-12-14 10:45:29 +01:00
patrick96
3225c11d2a tests: Update gtest to newest commit 2020-12-13 17:41:38 +01:00
Bjoern Hiller
7c662ec44f feat(conf) Properties for {bottom,top}-{left,right} radius 2020-12-13 17:02:23 +01:00
patrick96
94e1c64dff fix: Module type always empty string
The change in #2270 accidentally broke how we access module types.
module<Impl>::TYPE always points to the module superclass and it thus
accesses its empty TYPE field.

This mainly broke legacy action handling.

Ref #2270
2020-12-13 15:57:03 +01:00
patrick96
7493639889 aur: Update PKGBUILD for 3.5.1 release 2020-12-12 13:42:37 +01:00
patrick96
1c554dd0e0
Merge branch 'hotfix/3.5.1' 2020-12-12 13:28:57 +01:00
patrick96
9ba805d78f
Release 3.5.1
Changelog

**Features**

* config: Multiple inheritance (#2271), see #2269

**Fixes**

* (#2285), see #770, #2289
* Timer module: Polybar crash when interval is set to 0 (#2274), see #2273
* `custom/menu`: Wrong level numbers in error messages (#2264)
* `internal/xworkspaces`: Ignored certain workspace updates (#2275), see #2272
* Logger: Undefined behavior (#2284)
* build:
    * Build issues in older clang versions (#2270, #2279, #2280)
2020-12-12 13:02:47 +01:00
quandangv
ae1c6ca1b7 Fix 2283: Replace tokens at build() instread of update() 2020-12-12 12:33:21 +01:00
patrick96
47483a94f1 fix(process): fork_detached created zombie processes
Since the forked processes are still our children, we need to wait on
them, otherwise they become zombie processes.

We now fork twice, let the first fork immediately return and wait on it.
This reparents the second fork, which runs the actual code, to the init
process which then collects it.

Ref #770
2020-12-12 02:37:21 +01:00
patrick96
ccf14d9816
Fix CI badge 2020-12-12 02:03:30 +01:00
patrick96
d6148e3288 Remove travis 2020-12-12 01:43:12 +01:00
patrick96
95537f458d ci: Add manual trigger 2020-12-12 01:43:12 +01:00
patrick96
cf739ed295 ci: Use github actions 2020-12-12 01:43:12 +01:00
patrick96
54e2490aa5 fix(logger): Wrong conversion function called
For some reason when passing some non-const strings to convert, the
convert(T&& arg) method was used instead of the one specialized for
strings.

This caused an error in clang because you can't pass objects with
non-trivial types to varargs functions.

The best solution I found was to just add a specialized function for
non-const strings.
2020-12-12 01:43:12 +01:00
patrick96
a45b5d0424 fix(build): UB when converting strings in logger
The memory returned was no longer valid because arg is destructed after
the function returns.
2020-12-12 01:43:12 +01:00
Vlad Glagolev
d665634484
Fix build with clang++ 3.4 (#2279) 2020-12-12 01:07:51 +01:00
Vlad Glagolev
f6231f351f
Add missing header (#2280) 2020-12-12 01:07:13 +01:00
patrick96
df485f0a60 fix(module_formatter): Remove double moves 2020-12-07 15:35:38 +01:00
patrick96
bc87eb3b69 fix(battery): Crash when format-low not defined
This was a backwards-incompatible change introduced in #2199, however it
was caused because `module_formatter.has` throws an exception when the
format doesn't exist instead of just returning false.

Fixes #2262
Ref #2199
2020-12-07 15:35:38 +01:00
Patrick Ziegler
1168ef36a0
github: Add action to create release archive (#2277)
Whenever a release is published, this action will create a release
archive and update the release body with a download section.

This also integrates the suggestions from #2276

Resolves #2276
2020-12-06 18:16:17 +01:00
Patrick Ziegler
037f6e6c45
fix(xworkspaces): Never swallow updates (#2275)
If two WM events arrive withing 25ms of one-another, the second one does
not trigger a bar update.
The module state is still correct, it is just not reflected in the bar.

This somehow caused updates being swallowed in fluxbox, but only after
PR #882 was merged, even though that 25ms restriction existed long
before that.

Fixes #2272
2020-12-05 23:28:48 +01:00
Patrick Ziegler
82ebad5e7a
fix(timer_module): Ensure that interval > 0 (#2274)
Since 3.5.0, we use m_interval for a modulo operation, this crashes the
bar if the interval is 0. A non-positive interval shouldn't be allowed
anyway, so we now throw an exception in that case.

Fixes #2273
2020-12-05 22:58:38 +01:00
Patrick Ziegler
b2c515c73c
fix(config): Reintroduce multiple inheritance (#2271)
Pre 3.5.0, any key starting with 'inherit' was treated as an inherit
directive. This allowed for multiple inheritance even though it was
never inteded in that way.
3.5.0 removed that bug/feature by doing a strict check against 'inherit'

It seems people were relying on this behavior, so we are adding it back.
However multiple inheritance with multiple keys is also deprecated in
favor of the `inherit` key now supporting multiple space separated
sections.

This is because the config doesn't have a key order, but inheritance
does depend on the order the different section keys are copied over (if
multiple inherited sections define the same key).

Fixes #2269
2020-12-05 02:48:18 +01:00
Vlad Glagolev
3d6a7ffd4d
Fix linking when built with clang++ 3.4 (#2270) 2020-12-05 01:07:12 +01:00
Patrick Ziegler
c198859cd5
fix(menu): Wrong printf token in error message (#2264)
'level' is a string, not an integer
2020-12-03 15:12:59 +01:00
Patrick Ziegler
4e576f6572
travis: Disable notifications for passed builds (#2265)
Generates a bit of spam in IRC when making releases, because each branch
created will trigger a message.
2020-12-03 14:38:15 +01:00
Patrick Ziegler
d6ce8c9a46
aur: Update PKGBUILD for 3.5.0 release (#2261) 2020-12-02 22:00:15 +01:00
patrick96
11d1c2c5c7
Merge branch 'release/3.5.0' 2020-12-02 18:12:53 +01:00
Quan
39c73a8234
feat: Warn state for cpu, memory, fs, battery modules (#2199)
* [Temperature, Ramp] fix wrong icon for temperatures near base and warn temps

* [Temperature, Ramp] fix wrong icon for temperatures near base and warn temps

* Fix minor error

* Added WARN state for cpu module

* Implement WARN state for CPU, Memory modules, working on fs module

* Implement WARN state for fs module

* Simplify WARN state implementation for cpu and memory

* explicitly check percentage in get_by_percentage_with_borders

* Fixed silly error

* implement warn state on battery module, standardize the implementation on other modules

* minor fixes

* fix annoying error

* use more intuitive param name

* Fix percentage with borders bug

* Make requested changes
Hide the effect of warn states when unused

* Backward Compat: use no format instead of fallback label

* Reformat

* Refactor

* Reformat

* Reformat: convert tabs to spaces

* Reformat
2020-12-02 15:55:13 +01:00
Patrick Ziegler
078aa3c8cb
github: Typo in build issue template (#2260) 2020-12-02 15:16:15 +01:00
Jan Palus
9f2459be8c
net: increase speedrate precision (#2054)
more granular units need lower precision, while less granular need
higher precision. assume sane default of:

unit | precision
KB   | 0
MB   | 1
GB   | 2

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2020-12-01 17:54:54 +01:00
Patrick Ziegler
26a9bc5964
fix(doc): Typo (#2257)
Thanks to u/TheNextPoetician for reporting on reddit

Ref: https://www.reddit.com/r/Polybar/comments/k4llsx/typo_in_the_man_page/
2020-12-01 17:12:02 +01:00
Vlad Glagolev
5f67a8a12b
Respect interval default for tail = true (#2240) 2020-12-01 16:35:48 +01:00
patrick96
62638a5833
Release 3.5.0
Breaking Changes:

* The new config parser imposes some restrictions on which characters can be
  used in section and key names. Users shouldn't be affected by, this unless
  they use one of the following characters in any section or key name: `"'=;#[](){}:.$\%`
  Please consult [`man 5 polybar`](https://polybar.readthedocs.io/en/latest/man/polybar.5.html) for a full reference of the new config rules.
* `internal/temperature`: The first and last ramp element are now only used for
  `base-temperature` and below and `warn-temperature` and above respectively.
  This only slightly changes the ranges for which the different ramp levels are
  responsible for.
  (#2197)

Changelog

**Deprecations**

* `[settings]`: `throttle-input-for` has been removed. It wasn't a useful option
  and could cause certain actions (e.g. click commands) to be ignored. (#2117)

* All action names used by modules to handle click and scroll events are
  deprecated (#1907). This change mainly affects users of the menu module.
  Please read the [documentation](https://polybar.readthedocs.io/en/latest/user/actions.html) for instructions on how to migrate.

**New Config Options**

The `include-directory` key can be used the same as `include-file` and includes
all regular files in the given directory.

In labels:

* `label-NAME-minlen`, `label-NAME-alignment` can be used to pad labels with
  spaces to the right (alignment set to `left`), left (alignment set to
  `right`), and both sides (alignment set to `center`).

In `internal/backlight`:

* `enable-scroll` enables changing the brightness through scrolling.

In `internal/github`:

* `format-offline` is used when the module cannot connect to the server.
* `label-offline` can be used in `format-offline`.
* `api-url` can be used to connect to a custom github enterprise instance

In `internal/pulseaudio`:

* `click-right` and `click-middle` can be used to execute commands when
  right/middle clicking.
* `%decibels%` token can be used in `label-volume` and `label-muted` to show the
  volume in decibels.

**Changes To The Build System**

* Allow users to specify python executable when building. (polybar/xpp#27,
  #2125)
* The i3ipcpp submodule no longer rebuilds jsoncpp and just uses whatever
  version is available. (#2015, polybar/i3ipcpp#9)

**Features**

* New commandline argument: `-M` / `--list-all-monitors`.
    Will display all available monitors (even cloned ones).
* New log level: `notice`.
    Used as the default and is used for non-warning messages the user should
    nevertheless be aware of. (#2027)
* config:
    * New config parser (#1377)
    * `include-directory` key (#2196), see #1946
    * Add error message when an entire section is missing. (#2195)
    * `-minlen` and `-alignment` properties for labels. (#1546)
    * Make the `seperator` key in the bar section a label. (#1918)
    * Better color validation. (#1290)
* timer modules: Schedule module updates to be aligned with the update interval.
  For example, the date module now updates on the minute instead of in the
  middle of a minute if the interval is set to 60 seconds. (#2123), see #2064
* `custom/menu`: Multiple menu modules per bar (#1907)
* `internal/backlight`: Support for changing the brightness through scrolling.
  This may require additional changes to the system running polybar. (#1957)
* `internal/github`:
    * `format-offline` for when the module cannot connect to the server (#1825),
    see #1815
    * Support for github enterprise instances. (#1841), see #1812
* `internal/network`: Support `Gbit/s` for `%linkspeed%` token. (#2055)
* `internal/pulseaudio`:
    * `click-right` and `click-middle` keys (#1941)
    * `%decibels%` token (#1894), see #1886
* `internal/xworkspaces`: Proper implementation for `label-occupied`. (#822),
  see #874, #1444, #1033

**Fixes**

* Polybar not executing commands that produce output. (#1680), see #916
* Polybar froze until click commands finished executing (#2248)
* Polybar not properly working with mirrored monitors. (#1823), see #1192 and
  #1794
* Unstable animation framerate (#1683), see #568
* Multiple modules of the same type caused click events not to be delivered to
  the rigth one (#1907), see #1172
* config:
    * Seemingly unrelated error messages when BOM character appears in config.
    (#2166), see #2075
    * Fall back to next possible config location if config file doesn't exist
      (except if `--config` was used). (#2026), see #2016
* iconset: `fuzzy-match` chose first match, even if exact match was available.
  (#2042), see #2041
* `custom/menu`: Spacing issue (#1656)
* `internal/alsa`: Volume didn't go over 100% (#2184), see #2173
* `internal/backlight`: Use amdgpu workaround for all devices starting with
  `amdgpu_bl`. (#2122)
* `internal/battery`: Battery not marked as full if over `full-at` percent.
  (#2019), see #1622
* `internal/cpu`: More accurate cpu load calculation. (#1955)
* `internal/github`: Outdated GitHub API authentication. (#2029), see #2002
* `internal/memory`: Use the correct size prefixes (#2211), see #2023
* `internal/network`:
    * Wrong up- and downspeed values for non-integer intervals. (#2219)
    * tun/tap interfaces didn't query their IP addresses. (#1990), see #1986
    * Don't crash module if linkspeed cannot be queried. (#1772), see #1211
* `internal/temperature`:
    * `format-warn` was not used if the temperature was *exactly*
      `warn-temperature`. (#1897)
* `internal/xworkspaces`:
    * Multi-monitor issue (#1929), see #1764, #1849
    * Module sometimes showed too many workspaces (#1984), see #1983
* build:
    * xpp submodule doesn't work with python 3.9 (polybar/xpp#26)
    * CMake 3.17+ developer warnings (#2089, polybar/xpp#24, polybar/xpp#25)
    * gtest compilation failure (#1993), see google/googletest#2678
    * Compilation issue in GCC 6. (#1953)
2020-12-01 14:53:41 +01:00
patrick96
e89da58940
fix(builder): Properly apply alpha for fg and bg
It was not quite clear how try_apply_alpha should behave if the given
color was not ALPHA_ONLY. The implementation just returned 'this'.
However, the build relied on it returning the given color.

This broke all bg and fg settings in the entire bar.

To clear this up, we switch this around take the alpha channel of 'this'
and also return 'this' if it isn't ALPHA_ONLY.

Fixes #2255
2020-12-01 14:53:41 +01:00
Thibaut CHARLES
50d8a1ba06
feat(network): Ability to change speed unit text (B/s) (#2068)
New config option `speed-unit = B/s` will be used to suffix the upload and download speeds.

* mod::network: udspeed-unit to set network speed unit suffix

* Changed udspeed-unit to speed-unit
2020-11-29 14:15:27 +01:00