diff --git a/.clang-format b/.clang-format index 3caddce4..4d561f89 100644 --- a/.clang-format +++ b/.clang-format @@ -10,4 +10,5 @@ AllowShortIfStatementsOnASingleLine: false BreakConstructorInitializersBeforeComma: true DerivePointerAlignment: false PointerAlignment: Left +SpacesBeforeTrailingComments: 1 --- diff --git a/.clang-tidy b/.clang-tidy index a12c09fe..b558598b 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -32,8 +32,6 @@ Checks: ' CheckOptions: - key: modernize-loop-convert.NamingStyle value: lower_case - - key: readability-identifier-naming.GlobalConstantPrefix - value: 'g_' - key: readability-identifier-naming.ClassCase value: lower_case - key: readability-identifier-naming.ClassConstantCase diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..ea49a3b2 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: polybar +open_collective: polybar diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 24421294..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -name: Bug Report -about: Create a report for something that misbehaves - ---- - -## Checklist - - - -* [ ] I have read the appropriate section in the [contributing - guidelines](https://github.com/polybar/polybar/blob/master/CONTRIBUTING.md) -* [ ] I believe this issue is a problem with polybar itself and not a misconfiguration on my part. -* [ ] I have searched for other open and closed [issues](https://github.com/polybar/polybar/issues?q=is%3Aissue) that - may have already reported this problem. -* [ ] I have checked the [known issues](https://github.com/polybar/polybar/wiki/Known-Issues) page for this problem. - -## Describe the bug - - -**Expected behavior:** - - - -**Actual behavior:** - - - -**Was it working before?** -* Did you also experience this bug in an earlier version of polybar (yes/no/don't know)? -* If no, what was the last version where this worked correctly? - -## To Reproduce - - - -```dosini - -``` - - -## Polybar Log - -``` - -``` - -## Screenshots - - -## Environment: -* WM: -* Distro: -* Output of `polybar -vvv`: - -``` - -``` - -## Additional context - diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..ad0a991a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,112 @@ +name: Bug Report +description: Create a report for something that misbehaves +title: "[Bug]: " +labels: ["bug", "needs confirmation"] +body: + - type: checkboxes + id: checklist + attributes: + label: Checklist + description: Please carefully go through this checklist and check each option. + options: + - label: I have read the appropriate section in the [contributing guidelines](https://github.com/polybar/polybar/blob/master/CONTRIBUTING.md) + required: true + - label: I believe this issue is a problem with polybar itself and not a misconfiguration on my part + required: true + - label: I have searched for other open and closed [issues](https://github.com/polybar/polybar/issues?q=is%3Aissue) that may have already reported this problem + required: true + - label: I have checked the [known issues](https://github.com/polybar/polybar/wiki/Known-Issues) page for this problem. + required: true + - label: I have followed the [debugging guide](https://github.com/polybar/polybar/wiki/Debugging-your-Config) to narrow down the problem to a minimal config. + required: true + - type: textarea + id: reproduce + attributes: + label: Steps to reproduce + description: Any steps to take and commands to run to reproduce this issue. + placeholder: | + 1. `polybar -c ... bar` + 2. ... + validations: + required: true + - type: textarea + id: config + attributes: + label: Minimal config + description: A minimal but complete config with which the problem occurs. + render: dosini + placeholder: | + [bar/example] + ... + + [module/...] + ... + validations: + required: true + - type: textarea + id: logs + attributes: + label: Polybar log + description: Post everything polybar prints to the terminal when you run it and the issue occurs. If possible, run polybar with a higher log level (e.g. `trace` or `info`). + render: text + placeholder: | + notice: Parsing config file: ... + ... + - type: textarea + id: expected + attributes: + label: Expected behavior + description: A clear and concise description of what you expected to happen + validations: + required: true + - type: textarea + id: actual + attributes: + label: Actual behavior + description: What actually happens + validations: + required: true + - type: input + id: wm + attributes: + label: Window Manager and Version + placeholder: ex. i3-gaps 4.19.1 + validations: + required: true + - type: input + id: distro + attributes: + label: Linux Distribution + placeholder: ex. Ubuntu 21.04 + validations: + required: true + - type: textarea + id: version + attributes: + label: Polybar version + description: Output of `polybar -vvv` + render: text + placeholder: | + polybar 3.5.7 + + Features: +alsa +curl +i3 +mpd +network(libnl) +pulseaudio +xkeyboard + + X extensions: +randr (+monitors) +composite +xkb +xrm +xcursor + + Build type: Release + Compiler: /usr/bin/c++ + Compiler flags: -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -O3 -DNDEBUG -Wall -Wextra -Wpedantic -Wsuggest-override + Linker flags: -Wall -Wextra -Wpedantic -Wsuggest-override -Wall -Wextra -Wpedantic -Wsuggest-override + validations: + required: true + - type: textarea + id: context + attributes: + label: Additional Context / Screenshots + description: If applicaple, add screenshots and additional context to explain your problem + validations: + required: false + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! :heart: diff --git a/.github/ISSUE_TEMPLATE/build.md b/.github/ISSUE_TEMPLATE/build.md deleted file mode 100644 index 0693dc83..00000000 --- a/.github/ISSUE_TEMPLATE/build.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -name: Build Issues -about: Report issues while building polybar from source - ---- - -## Checklist - - - -* [ ] I have followed every step on the [compiling wiki page](https://github.com/polybar/polybar/wiki/Compiling) and - installed all necessary dependencies. -* [ ] My problem is not described on the [known issues page](https://github.com/polybar/polybar/wiki/Known-Issues) -* [ ] I have searched for other open and closed [issues](https://github.com/polybar/polybar/issues?q=is%3Aissue) that - may have already reported this problem. -* [ ] I was able to reproduce this build issue in a clean build - -## Build Process - -**How did you build polybar?** - - - -* [ ] From a release archive (Which version?) -* [ ] By cloning this repository (What is the output of `git describe --tags`?) -* [ ] Some other way (How?) - - - - -## Build Log - -``` - -``` - -## Environment: -* Distro (with Version): - -## Additional context - diff --git a/.github/ISSUE_TEMPLATE/build.yml b/.github/ISSUE_TEMPLATE/build.yml new file mode 100644 index 00000000..d6a5767f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/build.yml @@ -0,0 +1,81 @@ +name: Build Issues +description: Report issues while building polybar from source +labels: ["build", "needs confirmation"] +body: + - type: checkboxes + id: checklist + attributes: + label: Checklist + description: Please carefully go through this checklist and check each option. + options: + - label: I have followed every step on the [compiling wiki page](https://github.com/polybar/polybar/wiki/Compiling) and installed all necessary dependencies. + required: true + - label: My problem is not described on the [known issues page](https://github.com/polybar/polybar/wiki/Known-Issues) + required: true + - label: I have searched for other open and closed [issues](https://github.com/polybar/polybar/issues?q=is%3Aissue) that may have already reported this problem. + required: true + - label: I was able to reproduce this build issue in a clean build + required: true + - type: dropdown + id: source + attributes: + label: From where are you building polybar? + options: + - From a release archive + - By cloning this repository + - Some other way (How?) + validations: + required: true + - type: input + id: how + attributes: + label: Describe how you are building polybar. + description: Only if you selected "Some other way". + placeholder: ex. polybar from the AUR + validations: + required: false + - type: input + id: version + attributes: + label: Version + description: What version of polybar are you trying to build? If you are building directly from git, this is the output of `git describe --tags`. + placeholder: ex. 3.5.7 + validations: + required: true + - type: textarea + id: commands + attributes: + label: Build Process + description: List the exact commands you are using to build polybar + render: shell + placeholder: | + mkdir build + cd build + cmake .. + ... + validations: + required: true + - type: textarea + id: logs + attributes: + label: Build log + description: | + Copy-paste all the terminal output produced while building polybar. + This MUST include the output of the `cmake`, `make`, and/or `build.sh` commands, if you used them. + render: text + validations: + required: true + - type: input + id: distro + attributes: + label: Linux Distribution + placeholder: ex. Ubuntu 21.04 + validations: + required: true + - type: textarea + id: context + attributes: + label: Additional Context + description: Add any other context that you think is necessary about the problem here + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 0092b9f0..57279e36 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,7 +1,7 @@ --- name: Feature request about: Suggest an idea for this project - +labels: feature, needs confirmation --- ## Is your feature request related to a problem? Please describe. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99746764..9ec6ae5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,14 +18,47 @@ jobs: with: ref: ${{ github.event.inputs.ref }} - name: Install Dependencies - run: sudo apt-get install -y python3-sphinx + run: | + sudo apt-get update + sudo apt-get install -y python3-sphinx - name: Build Documentation run: | - mkdir -p doc/build - cd doc/build - cmake .. + mkdir -p build + cd build + cmake -DDISABLE_ALL=ON -DBUILD_DOC=ON -DSPHINX_FLAGS="-W" .. make doc + ipc: + runs-on: ubuntu-20.04 + env: + COLOR: "ON" + steps: + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + libxcb-composite0-dev \ + libxcb-ewmh-dev \ + libxcb-icccm4-dev \ + libxcb-image0-dev \ + libxcb-randr0-dev \ + libxcb-util0-dev \ + libxcb1-dev \ + libcairo2-dev \ + python3-xcbgen \ + libuv1-dev \ + xcb-proto + - uses: actions/checkout@v2 + with: + submodules: true + ref: ${{ github.event.inputs.ref }} + - name: Build polybar-msg + run: | + mkdir -p build + cd build + cmake -DDISABLE_ALL=ON -DBUILD_POLYBAR_MSG=ON .. + make polybar-msg + build: runs-on: ubuntu-20.04 strategy: @@ -62,6 +95,7 @@ jobs: libxcb1-dev \ libcairo2-dev \ python3-xcbgen \ + libuv1-dev \ xcb-proto if [ "$POLYBAR_BUILD_TYPE" != "minimal" ]; then @@ -74,9 +108,13 @@ jobs: libjsoncpp-dev \ libasound2-dev \ libpulse-dev \ - libiw-dev \ + libnl-genl-3-dev \ libmpdclient-dev fi + + if [ "$POLYBAR_BUILD_TYPE" = "tests" ]; then + sudo apt-get install -y lcov + fi - uses: actions/checkout@v2 with: submodules: true @@ -89,10 +127,34 @@ jobs: run: | cd $BUILD_DIR make + - name: Collect initial coverage + if: ${{ matrix.polybar_build_type == 'tests' }} + run: | + lcov --capture --initial --no-external --directory . -o cov_base.info - name: Tests if: ${{ matrix.polybar_build_type == 'tests' }} run: | cd $BUILD_DIR make check - cd $POLYBAR_DIR - bash <(curl -s https://codecov.io/bash) -F unittests -a "-ap" -Z + - name: Collect coverage + if: ${{ matrix.polybar_build_type == 'tests' }} + run: | + lcov --capture --no-external --directory . -o cov_tests.info + lcov --add-tracefile cov_base.info --add-tracefile cov_tests.info -o cov_total.info + lcov --remove cov_total.info ${PWD}'/build/*' ${PWD}'/tests/*' ${PWD}'/lib/*' -o cov.info + - name: Upload Coverage + if: ${{ matrix.polybar_build_type == 'tests' }} + uses: codecov/codecov-action@v2 + with: + flags: unittests + files: ./cov.info + fail_ci_if_error: true + - name: Upload Logs + if: failure() + uses: actions/upload-artifact@v2 + with: + name: cmake + path: | + build/CMakeFiles/CMakeError.log + build/CMakeFiles/CMakeOutput.log + retention-days: 5 diff --git a/.gitignore b/.gitignore index f6db60c3..e25c24ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,11 @@ /build /tags /compile_commands.json -/config *.bak *.pyc *.swp *.tmp .tags +*.user polybar-*.tar diff --git a/CHANGELOG.md b/CHANGELOG.md index e4267f9d..d253090f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,53 +10,205 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Breaking -- We rewrote our tag parser. This shouldn't break anything, if you experience - any problems, please let us know. - The new parser now gives errors for certain invalid tags where the old parser - would just silently ignore them. Adding extra text to the end of a valid tag - now produces an error. For example, tags like `%{T-a}`, `%{T2abc}`, `%{rfoo}`, - and others will now start producing errors. - This does not affect you unless you are producing your own formatting tags - (for example in a script) and you are using one of these invalid tags. +- `custom/script`: + - now doesn't hide failing script if it's output is not changing ([`#2636`](https://github.com/polybar/polybar/issues/2636)). Somewhat similar behaviour can be imitated with `format-fail`, if necessary. + - If the `exec` command produced no output and exited with a non-zero exit code the module is no longer completely empty, but just has an empty `%output%` token. If you relied on this behavior to hide the module under certain circumstances, make sure the script exits with an exit code of zero. ([`#2857`](https://github.com/polybar/polybar/discussions/2857), [`#2861`](https://github.com/polybar/polybar/pull/2861)) + +### Build +- Respect `CMAKE_INSTALL_PREFIX` when installing default config ([`#2770`](https://github.com/polybar/polybar/pull/2770), [`#2917`](https://github.com/polybar/polybar/pull/2917)) +- Change default `CMAKE_INSTALL_PREFIX` to `/usr`. Installations with default flags will now go into `/usr` instead of `/usr/local` ([`#2917`](https://github.com/polybar/polybar/pull/2917)) +- Bump C++ version to C++17 ([`#2847`](https://github.com/polybar/polybar/pull/2847)) + +### Deprecated +- `custom/text`: The `content` setting and all its properties are deprecated in favor of `format` with the same functionality. ([`#2676`](https://github.com/polybar/polybar/pull/2676)) ### Added -- Warn states for the cpu, memory, fs, and battery modules. - ([`#570`](https://github.com/polybar/polybar/issues/570), - [`#956`](https://github.com/polybar/polybar/issues/956), - [`#1871`](https://github.com/polybar/polybar/issues/1871), - [`#2141`](https://github.com/polybar/polybar/issues/2141)) - - `internal/battery`: `format-low`, `label-low`, `animation-low`, `low-at = - 10`. +- Added support for TAG_LABEL (`