diff --git a/.clang-format b/.clang-format index 4d561f89..9f04cab3 100644 --- a/.clang-format +++ b/.clang-format @@ -1,9 +1,9 @@ --- Language: Cpp -Standard: Cpp11 +Standard: c++17 BasedOnStyle: Google ColumnLimit: 120 -NamespaceIndentation: All +NamespaceIndentation: Inner AlignAfterOpenBracket: DontAlign AllowShortFunctionsOnASingleLine: Empty AllowShortIfStatementsOnASingleLine: false diff --git a/.clang-tidy b/.clang-tidy index b558598b..d28a1322 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -16,6 +16,7 @@ Checks: ' -modernize-raw-string-literal, -modernize-use-bool-literals, -modernize-use-trailing-return-type, + -readability-identifier-length, -readability-implicit-bool-cast, -readability-else-after-return, -readability-named-parameter, @@ -26,7 +27,8 @@ Checks: ' -cppcoreguidelines-pro-type-reinterpret-cast, -cppcoreguidelines-pro-type-union-access, -cppcoreguidelines-pro-type-cstyle-cast, - -cppcoreguidelines-pro-bounds-constant-array-index + -cppcoreguidelines-pro-bounds-constant-array-index, + -cppcoreguidelines-owning-memory, ' CheckOptions: diff --git a/.editorconfig b/.editorconfig index 57c08e6e..ff6aa42b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,6 +7,9 @@ indent_style = space indent_size = 2 charset = utf-8 +[*.py] +indent_size = 4 + [Makefile] indent_style = tab indent_size = 2 diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index ad0a991a..8f9fadf4 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,4 +1,4 @@ -name: Bug Report +name: 🐞 Bug Report description: Create a report for something that misbehaves title: "[Bug]: " labels: ["bug", "needs confirmation"] @@ -33,7 +33,7 @@ body: id: config attributes: label: Minimal config - description: A minimal but complete config with which the problem occurs. + description: A minimal but **complete** config with which the problem occurs. render: dosini placeholder: | [bar/example] @@ -103,7 +103,7 @@ body: id: context attributes: label: Additional Context / Screenshots - description: If applicaple, add screenshots and additional context to explain your problem + description: If applicable, add screenshots and additional context to explain your problem validations: required: false - type: markdown diff --git a/.github/ISSUE_TEMPLATE/build.yml b/.github/ISSUE_TEMPLATE/build.yml deleted file mode 100644 index d6a5767f..00000000 --- a/.github/ISSUE_TEMPLATE/build.yml +++ /dev/null @@ -1,81 +0,0 @@ -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/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 6a1549ad..81b3623a 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,8 +1,11 @@ blank_issues_enabled: false contact_links: - - name: Polybar Gitter Room - url: https://gitter.im/polybar/polybar - about: Please ask and answer questions here. - - name: Polybar subreddit - url: https://www.reddit.com/r/polybar - about: Please ask and answer questions here. + - name: 🙋 Ask a question + url: https://github.com/polybar/polybar/blob/master/SUPPORT.md + about: Have a look at our support resources and channels + - name: 💡 Feature request + url: https://github.com/polybar/polybar/discussions/categories/ideas + about: Suggest your idea over in Discussions + - name: 🛠️ Build Issues + url: https://github.com/polybar/polybar/discussions/categories/build-support + about: Get support when building polybar from source diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 57279e36..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -labels: feature, needs confirmation ---- - -## Is your feature request related to a problem? Please describe. - - -## Why does polybar need this feature? - - -## Describe the solution you'd like - - -## Describe alternatives you've considered - - -## Additional context - diff --git a/.codecov.yml b/.github/codecov.yml similarity index 100% rename from .codecov.yml rename to .github/codecov.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ec6ae5c..f5eb3a6d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,11 +10,11 @@ on: jobs: docs: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: COLOR: "ON" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ github.event.inputs.ref }} - name: Install Dependencies @@ -29,7 +29,7 @@ jobs: make doc ipc: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: COLOR: "ON" steps: @@ -48,7 +48,7 @@ jobs: python3-xcbgen \ libuv1-dev \ xcb-proto - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true ref: ${{ github.event.inputs.ref }} @@ -60,7 +60,7 @@ jobs: make polybar-msg build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: cxx: [g++, clang++] @@ -115,7 +115,7 @@ jobs: if [ "$POLYBAR_BUILD_TYPE" = "tests" ]; then sudo apt-get install -y lcov fi - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true ref: ${{ github.event.inputs.ref }} @@ -125,7 +125,7 @@ jobs: run: ./common/ci/configure.sh - name: Build run: | - cd $BUILD_DIR + cd "$BUILD_DIR" make - name: Collect initial coverage if: ${{ matrix.polybar_build_type == 'tests' }} @@ -134,17 +134,17 @@ jobs: - name: Tests if: ${{ matrix.polybar_build_type == 'tests' }} run: | - cd $BUILD_DIR + cd "$BUILD_DIR" make check - 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 + 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 + uses: codecov/codecov-action@v3 with: flags: unittests files: ./cov.info diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3a8d34c5..a0c408d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,9 +31,11 @@ jobs: RELEASE_TAG=${GITHUB_REF#refs/tags/} fi echo "Publishing Version $RELEASE_TAG" - echo "RELEASE_TAG=$RELEASE_TAG" >> "$GITHUB_ENV" - echo "POLYBAR_DIR=polybar-$RELEASE_TAG" >> "$GITHUB_ENV" - echo "POLYBAR_ARCHIVE=polybar-$RELEASE_TAG.tar.gz" >> "$GITHUB_ENV" + { + echo "RELEASE_TAG=$RELEASE_TAG" + echo "POLYBAR_DIR=polybar-$RELEASE_TAG" + echo "POLYBAR_ARCHIVE=polybar-$RELEASE_TAG.tar.gz" + } >> "$GITHUB_ENV" # Checks out the target tag - uses: actions/checkout@v2 @@ -91,7 +93,7 @@ jobs: const fname = '${{ env.POLYBAR_ARCHIVE }}' const url = '${{ steps.upload_archive.outputs.browser_download_url }}' const hash = '${{ env.SHA256SUM }}' - let body = "## Download:\n\n" + let body = "## Download\n\n" body += `[${fname}](${url}) (**sha256**: \`${hash}\`)\n\n` body += process.env.RELEASE_BODY; diff --git a/.gitignore b/.gitignore index e25c24ce..8428eee5 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,10 @@ .tags *.user +# clangd +/.cache + polybar-*.tar +*.cache + +.venv diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..1cebab8f --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,22 @@ +--- +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the version of Python and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3" + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: doc/conf.py + fail_on_warning: true + +python: + install: + - requirements: doc/requirements.txt diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py deleted file mode 100644 index 4942991d..00000000 --- a/.ycm_extra_conf.py +++ /dev/null @@ -1,126 +0,0 @@ -import os -import ycm_core - -# Default flags -flags = [ - '-std=c++14', - '-Wall', - '-Wextra', - - # Relative paths are corrected by MakeRelativePathsInFlagsAbsolute - '-Isrc', - '-Iinclude', - '-Ilib/concurrentqueue/include', - '-Ilib/i3ipcpp/include', - '-Ilib/xpp/include', - '-Itests', - - '-I/usr/include', - '-I/usr/include/freetype2', - ] - -# Base directory of the project, parent directory of all source files -project_dir = os.path.dirname(os.path.abspath(__file__)) - -# This assumes that everyone coding for this project builds inside the 'build' -# directory -compilation_database_folder = project_dir + "/build" - -if os.path.exists(compilation_database_folder): - database = ycm_core.CompilationDatabase(compilation_database_folder) -else: - database = None - -SOURCE_EXTENSIONS = ['.cpp', '.cxx', '.cc', '.c', '.m', '.mm'] - -# Converts all relative paths in the given flag list to absolute paths with -# working_directory as the base directory -def MakeRelativePathsInFlagsAbsolute(flags, working_directory): - if not working_directory: - return list(flags) - new_flags = [] - make_next_absolute = False - path_flags = ['-isystem', '-I', '-iquote', '--sysroot='] - for flag in flags: - new_flag = flag - - if make_next_absolute: - make_next_absolute = False - if not flag.startswith('/'): - new_flag = os.path.join(working_directory, flag) - - for path_flag in path_flags: - if flag == path_flag: - make_next_absolute = True - break - - if flag.startswith(path_flag): - path = flag[len(path_flag):] - new_flag = path_flag + os.path.join(working_directory, path) - break - - if new_flag: - new_flags.append(new_flag) - return new_flags - -def IsHeaderFile(filename): - extension = os.path.splitext(filename)[1] - return extension in ['.h', '.hxx', '.hpp', '.hh', ".inl"] - -# Tries to query the compilation database for flags -# For header files it tries to use the flags for a corresponding source file -def GetCompilationInfoForFile(filename): - if not database: - return None - - # The compilation_commands.json file generated by CMake does not have entries - # for header files. We try to use the compile flags used for the corresponding - # source file. - # - # For this try to replace the file extension with an extension that - # corresponds to a source and we also try to replace the 'include' folder in - # the path with 'src' - if IsHeaderFile(filename) : - basename = os.path.splitext(filename)[0] - - # Absolute path of the include and source directories - include_dir = project_dir + "/include" - src_dir = project_dir + "/src" - - # Absolute path without file extension, with the 'include' folder replaced - # with 'src' in the path - src_basename = None - # If the header file is inside the include dir, try to search in the src dir - if basename.startswith(include_dir): - # file path relative to include dir - rel_path_include = os.path.relpath(basename, include_dir) - src_basename = os.path.join(src_dir, rel_path_include) - - for extension in SOURCE_EXTENSIONS: - # A list of all possible replacement files to be searched - replacement_files = [basename + extension] - - if src_basename: - replacement_files.append(src_basename + extension) - - for replacement_file in replacement_files: - if os.path.exists(replacement_file): - comp_info = database.GetCompilationInfoForFile(replacement_file) - if comp_info.compiler_flags_: - return comp_info - return database.GetCompilationInfoForFile(filename) - -def FlagsForFile(filename, **kwargs): - compilation_info = GetCompilationInfoForFile(filename) - if compilation_info and compilation_info.compiler_flags_: - # Bear in mind that compilation_info.compiler_flags_ does NOT return a - # python list, but a "list-like" StringVec object - final_flags = MakeRelativePathsInFlagsAbsolute( - [x for x in compilation_info.compiler_flags_ if x != "-Werror"], - compilation_info.compiler_working_dir_) - else: - # We use default flags if GetCompilationInfoForFile can't find any flags - relative_to = project_dir - final_flags = MakeRelativePathsInFlagsAbsolute(flags, relative_to) - - return {'flags': final_flags, 'do_cache': True} diff --git a/CHANGELOG.md b/CHANGELOG.md index d253090f..d54387e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,81 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `internal/i3`: module errors when i3 has negative gaps ([`#2888`](https://github.com/polybar/polybar/issues/2888), [`#2889`](https://github.com/polybar/polybar/pull/2889)) - `wm-restack = bspwm`: bar may become unclickable if there are overlapping monitors ([`#2873`](https://github.com/polybar/polybar/issues/2873), [`#2961`](https://github.com/polybar/polybar/pull/2961)) +## [3.7.1] - 2023-11-27 +### Build +- Fixed missing header when using `libc++` in clang 15 and below + +### Changed +- `internal/tray`: The module must use the `` tag (this is the default) ([`#3037`](https://github.com/polybar/polybar/pull/3037)) + +## Fixed +- Modules did not validate that all tags (e.g. `