diff --git a/.clang-tidy b/.clang-tidy deleted file mode 100644 index db499035..00000000 --- a/.clang-tidy +++ /dev/null @@ -1,208 +0,0 @@ -WarningsAsErrors: > - -*, - bugprone-*, - -bugprone-multi-level-implicit-pointer-conversion, - -bugprone-empty-catch, - -bugprone-unused-return-value, - -bugprone-reserved-identifier, - -bugprone-switch-missing-default-case, - -bugprone-unused-local-non-trivial-variable, - -bugprone-easily-swappable-parameters, - -bugprone-forward-declararion-namespace, - -bugprone-forward-declararion-namespace, - -bugprone-macro-parentheses, - -bugprone-narrowing-conversions, - -bugprone-branch-clone, - -bugprone-assignment-in-if-condition, - concurrency-*, - -concurrency-mt-unsafe, - cppcoreguidelines-*, - -cppcoreguidelines-pro-type-const-cast, - -cppcoreguidelines-owning-memory, - -cppcoreguidelines-avoid-magic-numbers, - -cppcoreguidelines-pro-bounds-constant-array-index, - -cppcoreguidelines-avoid-const-or-ref-data-members, - -cppcoreguidelines-non-private-member-variables-in-classes, - -cppcoreguidelines-avoid-goto, - -cppcoreguidelines-pro-bounds-array-to-pointer-decay, - -cppcoreguidelines-avoid-do-while, - -cppcoreguidelines-avoid-non-const-global-variables, - -cppcoreguidelines-special-member-functions, - -cppcoreguidelines-explicit-virtual-functions, - -cppcoreguidelines-avoid-c-arrays, - -cppcoreguidelines-pro-bounds-pointer-arithmetic, - -cppcoreguidelines-narrowing-conversions, - -cppcoreguidelines-pro-type-union-access, - -cppcoreguidelines-pro-type-member-init, - -cppcoreguidelines-macro-usage, - -cppcoreguidelines-macro-to-enum, - -cppcoreguidelines-init-variables, - -cppcoreguidelines-pro-type-cstyle-cast, - -cppcoreguidelines-pro-type-vararg, - -cppcoreguidelines-pro-type-reinterpret-cast, - -google-global-names-in-headers, - -google-readability-casting, - google-runtime-operator, - misc-*, - -misc-use-internal-linkage, - -misc-unused-parameters, - -misc-no-recursion, - -misc-non-private-member-variables-in-classes, - -misc-include-cleaner, - -misc-use-anonymous-namespace, - -misc-const-correctness, - modernize-*, - -modernize-use-emplace, - -modernize-redundant-void-arg, - -modernize-use-starts-ends-with, - -modernize-use-designated-initializers, - -modernize-use-std-numbers, - -modernize-return-braced-init-list, - -modernize-use-trailing-return-type, - -modernize-use-using, - -modernize-use-override, - -modernize-avoid-c-arrays, - -modernize-macro-to-enum, - -modernize-loop-convert, - -modernize-use-nodiscard, - -modernize-pass-by-value, - -modernize-use-auto, - performance-*, - -performance-inefficient-vector-operation, - -performance-inefficient-string-concatenation, - -performance-enum-size, - -performance-move-const-arg, - -performance-avoid-endl, - -performance-unnecessary-value-param, - portability-std-allocator-const, - readability-*, - -readability-identifier-naming, - -readability-use-std-min-max, - -readability-math-missing-parentheses, - -readability-simplify-boolean-expr, - -readability-static-accessed-through-instance, - -readability-use-anyofallof, - -readability-enum-initial-value, - -readability-redundant-inline-specifier, - -readability-function-cognitive-complexity, - -readability-function-size, - -readability-identifier-length, - -readability-magic-numbers, - -readability-uppercase-literal-suffix, - -readability-braces-around-statements, - -readability-redundant-access-specifiers, - -readability-else-after-return, - -readability-container-data-pointer, - -readability-implicit-bool-conversion, - -readability-avoid-nested-conditional-operator, - -readability-redundant-member-init, - -readability-redundant-string-init, - -readability-avoid-const-params-in-decls, - -readability-named-parameter, - -readability-convert-member-functions-to-static, - -readability-qualified-auto, - -readability-make-member-function-const, - -readability-isolate-declaration, - -readability-inconsistent-declaration-parameter-name, - -clang-diagnostic-error, - -HeaderFilterRegex: '.*\.hpp' -FormatStyle: file -Checks: > - -*, - bugprone-*, - -bugprone-easily-swappable-parameters, - -bugprone-forward-declararion-namespace, - -bugprone-forward-declararion-namespace, - -bugprone-macro-parentheses, - -bugprone-narrowing-conversions, - -bugprone-branch-clone, - -bugprone-assignment-in-if-condition, - concurrency-*, - -concurrency-mt-unsafe, - cppcoreguidelines-*, - -cppcoreguidelines-owning-memory, - -cppcoreguidelines-avoid-magic-numbers, - -cppcoreguidelines-pro-bounds-constant-array-index, - -cppcoreguidelines-avoid-const-or-ref-data-members, - -cppcoreguidelines-non-private-member-variables-in-classes, - -cppcoreguidelines-avoid-goto, - -cppcoreguidelines-pro-bounds-array-to-pointer-decay, - -cppcoreguidelines-avoid-do-while, - -cppcoreguidelines-avoid-non-const-global-variables, - -cppcoreguidelines-special-member-functions, - -cppcoreguidelines-explicit-virtual-functions, - -cppcoreguidelines-avoid-c-arrays, - -cppcoreguidelines-pro-bounds-pointer-arithmetic, - -cppcoreguidelines-narrowing-conversions, - -cppcoreguidelines-pro-type-union-access, - -cppcoreguidelines-pro-type-member-init, - -cppcoreguidelines-macro-usage, - -cppcoreguidelines-macro-to-enum, - -cppcoreguidelines-init-variables, - -cppcoreguidelines-pro-type-cstyle-cast, - -cppcoreguidelines-pro-type-vararg, - -cppcoreguidelines-pro-type-reinterpret-cast, - google-global-names-in-headers, - -google-readability-casting, - google-runtime-operator, - misc-*, - -misc-unused-parameters, - -misc-no-recursion, - -misc-non-private-member-variables-in-classes, - -misc-include-cleaner, - -misc-use-anonymous-namespace, - -misc-const-correctness, - modernize-*, - -modernize-return-braced-init-list, - -modernize-use-trailing-return-type, - -modernize-use-using, - -modernize-use-override, - -modernize-avoid-c-arrays, - -modernize-macro-to-enum, - -modernize-loop-convert, - -modernize-use-nodiscard, - -modernize-pass-by-value, - -modernize-use-auto, - performance-*, - -performance-avoid-endl, - -performance-unnecessary-value-param, - portability-std-allocator-const, - readability-*, - -readability-function-cognitive-complexity, - -readability-function-size, - -readability-identifier-length, - -readability-magic-numbers, - -readability-uppercase-literal-suffix, - -readability-braces-around-statements, - -readability-redundant-access-specifiers, - -readability-else-after-return, - -readability-container-data-pointer, - -readability-implicit-bool-conversion, - -readability-avoid-nested-conditional-operator, - -readability-redundant-member-init, - -readability-redundant-string-init, - -readability-avoid-const-params-in-decls, - -readability-named-parameter, - -readability-convert-member-functions-to-static, - -readability-qualified-auto, - -readability-make-member-function-const, - -readability-isolate-declaration, - -readability-inconsistent-declaration-parameter-name, - -clang-diagnostic-error, - -CheckOptions: - performance-for-range-copy.WarnOnAllAutoCopies: true - performance-inefficient-string-concatenation.StrictMode: true - readability-braces-around-statements.ShortStatementLines: 0 - readability-identifier-naming.ClassCase: CamelCase - readability-identifier-naming.ClassIgnoredRegexp: I.* - readability-identifier-naming.ClassPrefix: C # We can't use regex here?!?!?!? - readability-identifier-naming.EnumCase: CamelCase - readability-identifier-naming.EnumPrefix: e - readability-identifier-naming.EnumConstantCase: UPPER_CASE - readability-identifier-naming.FunctionCase: camelBack - readability-identifier-naming.NamespaceCase: CamelCase - readability-identifier-naming.NamespacePrefix: N - readability-identifier-naming.StructPrefix: S - readability-identifier-naming.StructCase: CamelCase diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index fd5797d5..ce6d9d3e 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -1,15 +1,75 @@ -name: Do not open issues, go to discussions please! -description: Do not open an issue +name: Bug Report +description: Something is not working right +labels: ["bug"] body: - type: checkboxes attributes: - label: Please close this issue. - description: Users cannot open issues. I want my issue to be closed. + label: Already reported ? * + description: Before opening a new bug report, please take a moment to search through the current open and closed issues to check if it already exists. options: - - label: Yes, I want this issue to be closed. - required: true + - label: I have searched the existing open and closed issues. + required: true + + - type: dropdown + id: type + attributes: + label: Regression? + description: | + Regression means that something used to work but no longer does. + **BEFORE CONTINUING**, please check if this bug is a regression or not, and if it is, we need you to bisect with the help of the wiki: https://wiki.hyprland.org/Crashes-and-Bugs/#bisecting-an-issue + multiple: true + options: + - "Yes" + - "No" + validations: + required: true - type: textarea - id: body + id: ver attributes: - label: Issue body + label: System Info and Version + description: | + Paste the output of `hyprctl systeminfo -c` here. If you can't + launch Hyprland, paste the output of `Hyprland --systeminfo`. + If `Hyprland --systeminfo` errors out (added in 0.44.0), find + and paste the Hyprland version manually. + value: "
+ System/Version info + + + ```sh + + + + ``` + + +
" + validations: + required: true + + - type: textarea + id: desc + attributes: + label: Description + description: "What went wrong?" + validations: + required: true + + - type: textarea + id: repro + attributes: + label: How to reproduce + description: "How can someone else reproduce the issue?" + validations: + required: true + + - type: textarea + id: logs + attributes: + label: Crash reports, logs, images, videos + description: | + Anything that can help. Please always ATTACH and not paste them. + Logs can be found in $XDG_RUNTIME_DIR/hypr + Crash reports are stored in ~/.cache/hyprland or $XDG_CACHE_HOME/hyprland + diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml new file mode 100644 index 00000000..b34786a0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.yml @@ -0,0 +1,19 @@ +name: Feature Request +description: I'd like to request additional functionality +labels: ["enhancement"] +body: + - type: markdown + attributes: + value: | + Before opening a new issue, take a moment to search through the current open ones. + + --- + + - type: textarea + id: desc + attributes: + label: Description + description: "Describe your idea" + validations: + required: true + diff --git a/.github/actions/setup_base/action.yml b/.github/actions/setup_base/action.yml index 9fcaabfb..26660ce6 100644 --- a/.github/actions/setup_base/action.yml +++ b/.github/actions/setup_base/action.yml @@ -20,11 +20,9 @@ runs: clang \ cmake \ git \ - glaze \ glm \ glslang \ go \ - gtest \ hyprlang \ hyprcursor \ jq \ @@ -35,10 +33,7 @@ runs: libfontenc \ libglvnd \ libinput \ - libjxl \ libliftoff \ - libspng \ - libwebp \ libxcursor \ libxcvt \ libxfont2 \ @@ -46,7 +41,6 @@ runs: libxkbfile \ lld \ meson \ - muparser \ ninja \ pango \ pixman \ @@ -64,8 +58,7 @@ runs: xcb-util \ xcb-util-image \ libzip \ - librsvg \ - re2 + librsvg - name: Get hyprwayland-scanner-git shell: bash @@ -76,25 +69,11 @@ runs: cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` cmake --install build - - name: Get hyprwire-git - shell: bash - run: | - git clone https://github.com/hyprwm/hyprwire --recursive - cd hyprwire - cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build - cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` - cmake --install build - - name: Get hyprutils-git shell: bash run: | git clone https://github.com/hyprwm/hyprutils && cd hyprutils && cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -B build && cmake --build build --target hyprutils && cmake --install build - - name: Get hyprgraphics-git - shell: bash - run: | - git clone https://github.com/hyprwm/hyprgraphics && cd hyprgraphics && cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -B build && cmake --build build --target hyprgraphics && cmake --install build - - name: Get aquamarine-git shell: bash run: | diff --git a/.github/labeler.yml b/.github/labeler.yml index 6b89255a..a0685fcf 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -22,10 +22,6 @@ protocols: - changed-files: - any-glob-to-any-file: ["protocols/**", "src/protocols/**"] -start: - - changed-files: - - any-glob-to-any-file: "start/**" - core: - changed-files: - any-glob-to-any-file: "src/**" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 75b4b7c5..073333bc 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,11 +1,3 @@ - - - #### Describe your PR, what does it fix/add? diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2ec558ed..7739d2b2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,63 +21,108 @@ jobs: - name: Build Hyprland run: | - CFLAGS=-Werror CXXFLAGS=-Werror make nopch + make all - name: Compress and package artifacts run: | mkdir x86_64-pc-linux-gnu mkdir hyprland + mkdir hyprland/example + mkdir hyprland/assets cp ./LICENSE hyprland/ cp build/Hyprland hyprland/ cp build/hyprctl/hyprctl hyprland/ cp build/hyprpm/hyprpm hyprland/ + cp build/Hyprland hyprland/ cp -r example/ hyprland/ cp -r assets/ hyprland/ - tar -cvJf Hyprland.tar.xz hyprland + tar -cvf Hyprland.tar.xz hyprland - name: Release - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: Build archive path: Hyprland.tar.xz - clang-format: - permissions: read-all + meson: if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork - name: "Code Style" + name: "Build Hyprland with Meson (Arch)" runs-on: ubuntu-latest container: image: archlinux steps: - - name: Checkout repository + - name: Checkout repository actions uses: actions/checkout@v4 + with: + sparse-checkout: .github/actions - # - name: clang-format check - # uses: jidicula/clang-format-action@v4.16.0 - # with: - # exclude-regex: ^subprojects$ + - name: Setup base + uses: ./.github/actions/setup_base - - name: Install clang-format - run: | - pacman --noconfirm --noprogressbar -Syyu - pacman --noconfirm --noprogressbar -Sy clang + - name: Configure + run: meson setup build -Ddefault_library=static + + - name: Compile + run: ninja -C build + + no-pch: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork + name: "Build Hyprland without precompiled headers (Arch)" + runs-on: ubuntu-latest + container: + image: archlinux + steps: + - name: Checkout repository actions + uses: actions/checkout@v4 + with: + sparse-checkout: .github/actions + + - name: Setup base + uses: ./.github/actions/setup_base + with: + INSTALL_XORG_PKGS: true + + - name: Compile + run: make nopch + + noxwayland: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork + name: "Build Hyprland in pure Wayland (Arch)" + runs-on: ubuntu-latest + container: + image: archlinux + steps: + - name: Checkout repository actions + uses: actions/checkout@v4 + with: + sparse-checkout: .github/actions + + - name: Setup base + uses: ./.github/actions/setup_base + + - name: Configure + run: mkdir -p build && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DNO_XWAYLAND:STRING=true -H./ -B./build -G Ninja + + - name: Compile + run: make release + + clang-format: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork + name: "Code Style (Arch)" + runs-on: ubuntu-latest + container: + image: archlinux + steps: + - name: Checkout repository actions + uses: actions/checkout@v4 + with: + sparse-checkout: .github/actions + + - name: Setup base + uses: ./.github/actions/setup_base + + - name: Configure + run: meson setup build -Ddefault_library=static - name: clang-format check - run: .github/workflows/clang-format-check.sh "." "llvm" "^subprojects$" "" - - - name: Save PR head commit SHA - if: failure() && github.event_name == 'pull_request' - shell: bash - run: | - SHA="${{ github.event.pull_request.head.sha }}" - echo "SHA=$SHA" >> $GITHUB_ENV - - name: Save latest commit SHA if not PR - if: failure() && github.event_name != 'pull_request' - shell: bash - run: echo "SHA=${{ github.sha }}" >> $GITHUB_ENV - - - name: Report failure in job summary - if: failure() - run: | - DEEPLINK="${{ github.server_url }}/${{ github.repository }}/commit/${{ env.SHA }}" - echo -e "Format check failed on commit [${GITHUB_SHA:0:8}]($DEEPLINK) with files:\n$(<$GITHUB_WORKSPACE/failing-files.txt)" >> $GITHUB_STEP_SUMMARY + run: ninja -C build clang-format-check diff --git a/.github/workflows/clang-format-check.sh b/.github/workflows/clang-format-check.sh deleted file mode 100755 index 41237aa7..00000000 --- a/.github/workflows/clang-format-check.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env bash -# -# Adapted from https://github.com/jidicula/clang-format-action - -############################################################################### -# check.sh # -############################################################################### -# USAGE: ./entrypoint.sh [] [] -# -# Checks all C/C++/Protobuf/CUDA files (.h, .H, .hpp, .hh, .h++, .hxx and .c, -# .C, .cpp, .cc, .c++, .cxx, .proto, .cu) in the provided GitHub repository path -# (arg1) for conforming to clang-format. If no path is provided or provided path -# is not a directory, all C/C++/Protobuf/CUDA files are checked. If any files -# are incorrectly formatted, the script lists them and exits with 1. -# -# Define your own formatting rules in a .clang-format file at your repository -# root. Otherwise, the provided style guide (arg2) is used as a fallback. - -# format_diff function -# Accepts a filepath argument. The filepath passed to this function must point -# to a C/C++/Protobuf/CUDA file. -format_diff() { - local filepath="$1" - - # Invoke clang-format with dry run and formatting error output - local_format="$(clang-format \ - --dry-run \ - --Werror \ - --style=file \ - --fallback-style="$FALLBACK_STYLE" \ - "${filepath}")" - - local format_status="$?" - if [[ ${format_status} -ne 0 ]]; then - # Append Markdown-bulleted monospaced filepath of failing file to - # summary file. - echo "* \`$filepath\`" >>failing-files.txt - - echo "Failed on file: $filepath" >&2 - echo "$local_format" >&2 - exit_code=1 # flip the global exit code - return "${format_status}" - fi - return 0 -} - -CHECK_PATH="$1" -FALLBACK_STYLE="$2" -EXCLUDE_REGEX="$3" -INCLUDE_REGEX="$4" - -# Set the regex to an empty string regex if nothing was provided -if [[ -z $EXCLUDE_REGEX ]]; then - EXCLUDE_REGEX="^$" -fi - -# Set the filetype regex if nothing was provided. -# Find all C/C++/Protobuf/CUDA files: -# h, H, hpp, hh, h++, hxx -# c, C, cpp, cc, c++, cxx -# ino, pde -# proto -# cu -if [[ -z $INCLUDE_REGEX ]]; then - INCLUDE_REGEX='^.*\.((((c|C)(c|pp|xx|\+\+)?$)|((h|H)h?(pp|xx|\+\+)?$))|(ino|pde|proto|cu))$' -fi - -cd "$GITHUB_WORKSPACE" || exit 2 - -if [[ ! -d $CHECK_PATH ]]; then - echo "Not a directory in the workspace, fallback to all files." >&2 - CHECK_PATH="." -fi - -# initialize exit code -exit_code=0 - -# All files improperly formatted will be printed to the output. -src_files=$(find "$CHECK_PATH" -name .git -prune -o -regextype posix-egrep -regex "$INCLUDE_REGEX" -print) - -# check formatting in each source file -IFS=$'\n' # Loop below should separate on new lines, not spaces. -for file in $src_files; do - # Only check formatting if the path doesn't match the regex - if ! [[ ${file} =~ $EXCLUDE_REGEX ]]; then - format_diff "${file}" - fi -done - -# global exit code is flipped to nonzero if any invocation of `format_diff` has -# a formatting difference. -exit "$exit_code" diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml deleted file mode 100644 index 505829e3..00000000 --- a/.github/workflows/clang-format.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: clang-format -on: pull_request_target -jobs: - clang-format: - permissions: write-all - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork - name: "Code Style" - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: clang-format check - uses: jidicula/clang-format-action@v4.16.0 - with: - exclude-regex: ^subprojects$ - - - name: Create comment - if: ${{ failure() && github.event_name == 'pull_request' }} - run: | - echo 'Please fix the formatting issues by running [`clang-format`](https://wiki.hyprland.org/Contributing-and-Debugging/PR-Guidelines/#code-style).' > clang-format.patch - - - name: Post comment - if: ${{ failure() && github.event_name == 'pull_request' }} - uses: mshick/add-pr-comment@v2 - with: - message-path: | - clang-format.patch diff --git a/.github/workflows/close-issues.yml b/.github/workflows/close-issues.yml deleted file mode 100644 index 55f4e126..00000000 --- a/.github/workflows/close-issues.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: Close Unauthorized Issues - -on: - workflow_dispatch: - issues: - types: [opened] - -jobs: - close-unauthorized-issues: - runs-on: ubuntu-latest - permissions: - issues: write - steps: - # XXX: This *could* be done in Bash by abusing GitHub's own tool to interact with its API - # but that's too much of a hack, and we'll be adding a layer of abstraction. github-script - # is a workflow that eases interaction with GitHub API in the workflow run context. - - name: "Close 'unauthorized' issues" - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const ALLOWED_USERS = ['vaxerski', 'fufexan', 'NotAShelf']; - const CLOSING_COMMENT = 'Users are no longer allowed to open issues themselves, please open a discussion instead.\n\nPlease see the [wiki](https://wiki.hyprland.org/Contributing-and-Debugging/Issue-Guidelines/) on why this is the case.\n\nWe are volunteers, and we need your cooperation to make the best software we can. Thank you for understanding! ❤️\n\n[Open a discussion here](https://github.com/hyprwm/Hyprland/discussions)'; - - async function closeUnauthorizedIssue(issueNumber, userName) { - if (ALLOWED_USERS.includes(userName)) { - console.log(`Issue #${issueNumber} - Created by authorized user ${userName}`); - return; - } - - console.log(`Issue #${issueNumber} - Unauthorized, closing`); - - await github.rest.issues.update({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issueNumber, - state: 'closed', - state_reason: 'not_planned' - }); - - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issueNumber, - body: CLOSING_COMMENT - }); - } - - if (context.eventName === 'issues' && context.payload.action === 'opened') { - // Direct access to the issue that triggered the workflow - const issue = context.payload.issue; - - // Skip if this is a PR - if (issue.pull_request) { - console.log(`Issue #${issue.number} - Skipping, this is a pull request`); - return; - } - - // Process the single issue that triggered the workflow - await closeUnauthorizedIssue(issue.number, issue.user.login); - } else { - // For manual runs, we need to handle pagination - async function* fetchAllOpenIssues() { - let page = 1; - let hasNextPage = true; - - while (hasNextPage) { - const response = await github.rest.issues.listForRepo({ - owner: context.repo.owner, - repo: context.repo.repo, - state: 'open', - per_page: 100, - page: page - }); - - if (response.data.length === 0) { - hasNextPage = false; - } else { - for (const issue of response.data) { - yield issue; - } - page++; - } - } - } - - // Process issues one by one - for await (const issue of fetchAllOpenIssues()) { - try { - // Skip pull requests - if (issue.pull_request) { - console.log(`Issue #${issue.number} - Skipping, this is a pull request`); - continue; - } - - await closeUnauthorizedIssue(issue.number, issue.user.login); - } catch (error) { - console.error(`Error processing issue #${issue.number}: ${error.message}`); - } - } - } diff --git a/.github/workflows/man-update.yaml b/.github/workflows/man-update.yaml index 6c0a72f3..b47787c0 100644 --- a/.github/workflows/man-update.yaml +++ b/.github/workflows/man-update.yaml @@ -17,14 +17,14 @@ jobs: run: sudo apt install pandoc - name: Clone repository - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: token: ${{ secrets.PAT }} - name: Build man pages run: make man - - uses: stefanzweifel/git-auto-commit-action@v5 + - uses: stefanzweifel/git-auto-commit-action@v4 name: Commit with: commit_message: "[gha] build man pages" diff --git a/.github/workflows/new-pr-comment.yml b/.github/workflows/new-pr-comment.yml deleted file mode 100644 index 36ea1909..00000000 --- a/.github/workflows/new-pr-comment.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: "New MR welcome comment" - -on: - pull_request_target: - types: - - opened - -jobs: - comment: - if: > - github.event.pull_request.user.login != 'vaxerski' && - github.event.pull_request.user.login != 'fufexan' && - github.event.pull_request.user.login != 'gulafaran' && - github.event.pull_request.user.login != 'ujint34' && - github.event.pull_request.user.login != 'paideiadilemma' && - github.event.pull_request.user.login != 'notashelf' - runs-on: ubuntu-latest - permissions: - pull-requests: write - - env: - PR_COMMENT: | - Hello and thank you for making a PR to Hyprland! - - Please check the [PR Guidelines](https://wiki.hypr.land/Contributing-and-Debugging/PR-Guidelines/) and make sure your PR follows them. - It will make the entire review process faster. :) - - If your code can be tested, please always add tests. See more [here](https://wiki.hypr.land/Contributing-and-Debugging/Tests/). - - _beep boop, I'm just a bot. A real human will review your PR soon._ - - steps: - - name: Add comment to PR - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const pr = context.payload.pull_request; - - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: pr.number, - body: process.env.PR_COMMENT, - }); diff --git a/.github/workflows/nix-build.yml b/.github/workflows/nix-build.yml new file mode 100644 index 00000000..d1f47ee4 --- /dev/null +++ b/.github/workflows/nix-build.yml @@ -0,0 +1,28 @@ +name: Nix (Build) + +on: + workflow_call: + secrets: + CACHIX_AUTH_TOKEN: + required: false + +jobs: + build: + strategy: + matrix: + package: + - hyprland + - hyprland-cross + - xdg-desktop-portal-hyprland + + runs-on: ubuntu-latest + steps: + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + + - uses: cachix/cachix-action@v15 + with: + name: hyprland + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + + - run: nix build 'github:hyprwm/Hyprland?ref=${{ github.ref }}#${{ matrix.package }}' -L --extra-substituters "https://hyprland.cachix.org" diff --git a/.github/workflows/nix-ci.yml b/.github/workflows/nix-ci.yml index 5b22e992..75c19790 100644 --- a/.github/workflows/nix-ci.yml +++ b/.github/workflows/nix-ci.yml @@ -1,4 +1,4 @@ -name: Nix +name: Nix (CI) on: [push, pull_request, workflow_dispatch] @@ -8,22 +8,7 @@ jobs: uses: ./.github/workflows/nix-update-inputs.yml secrets: inherit - hyprland: + build: if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork) - uses: ./.github/workflows/nix.yml - secrets: inherit - with: - command: nix build 'github:${{ github.repository }}?ref=${{ github.ref }}' -L --extra-substituters "https://hyprland.cachix.org" - - xdph: - if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork) - needs: hyprland - uses: ./.github/workflows/nix.yml - secrets: inherit - with: - command: nix build 'github:${{ github.repository }}?ref=${{ github.ref }}#xdg-desktop-portal-hyprland' -L --extra-substituters "https://hyprland.cachix.org" - - test: - if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork) - uses: ./.github/workflows/nix-test.yml + uses: ./.github/workflows/nix-build.yml secrets: inherit diff --git a/.github/workflows/nix-test.yml b/.github/workflows/nix-test.yml deleted file mode 100644 index 68357093..00000000 --- a/.github/workflows/nix-test.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Nix (Test) - -on: - workflow_call: - secrets: - CACHIX_AUTH_TOKEN: - required: false - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Install Nix - uses: nixbuild/nix-quick-install-action@v31 - with: - nix_conf: | - keep-env-derivations = true - keep-outputs = true - - - name: Restore and save Nix store - uses: nix-community/cache-nix-action@v6 - with: - # restore and save a cache using this key (per job) - primary-key: nix-${{ runner.os }}-${{ github.job }} - # if there's no cache hit, restore a cache by this prefix - restore-prefixes-first-match: nix-${{ runner.os }} - # collect garbage until the Nix store size (in bytes) is at most this number - # before trying to save a new cache - gc-max-store-size-linux: 5G - - - uses: cachix/cachix-action@v15 - with: - name: hyprland - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - - - name: Run test VM - run: nix build 'github:${{ github.repository }}?ref=${{ github.ref }}#checks.x86_64-linux.tests' -L --extra-substituters "https://hyprland.cachix.org" - - - name: Check exit status - run: grep 0 result/exit_status - - - name: Upload artifacts - if: always() - uses: actions/upload-artifact@v4 - with: - name: logs - path: result diff --git a/.github/workflows/nix-update-inputs.yml b/.github/workflows/nix-update-inputs.yml index a3084b27..a8f68f3b 100644 --- a/.github/workflows/nix-update-inputs.yml +++ b/.github/workflows/nix-update-inputs.yml @@ -13,32 +13,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Clone repository - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: token: ${{ secrets.PAT }} - - name: Install Nix - uses: nixbuild/nix-quick-install-action@v31 - with: - nix_conf: | - keep-env-derivations = true - keep-outputs = true - - - name: Restore and save Nix store - uses: nix-community/cache-nix-action@v6 - with: - # restore and save a cache using this key (per job) - primary-key: nix-${{ runner.os }}-${{ github.job }} - # if there's no cache hit, restore a cache by this prefix - restore-prefixes-first-match: nix-${{ runner.os }} - # collect garbage until the Nix store size (in bytes) is at most this number - # before trying to save a new cache - gc-max-store-size-linux: 5G - + - uses: DeterminateSystems/nix-installer-action@main - name: Update inputs run: nix/update-inputs.sh - name: Commit - uses: stefanzweifel/git-auto-commit-action@v5 + uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: "[gha] Nix: update inputs" diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml deleted file mode 100644 index b46b3795..00000000 --- a/.github/workflows/nix.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Build - -on: - workflow_call: - inputs: - command: - required: true - type: string - description: Command to run - secrets: - CACHIX_AUTH_TOKEN: - required: false - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Install Nix - uses: nixbuild/nix-quick-install-action@v31 - with: - nix_conf: | - keep-env-derivations = true - keep-outputs = true - - - name: Restore and save Nix store - uses: nix-community/cache-nix-action@v6 - with: - # restore and save a cache using this key (per job) - primary-key: nix-${{ runner.os }}-${{ github.job }} - # if there's no cache hit, restore a cache by this prefix - restore-prefixes-first-match: nix-${{ runner.os }} - # collect garbage until the Nix store size (in bytes) is at most this number - # before trying to save a new cache - gc-max-store-size-linux: 5G - - - uses: cachix/cachix-action@v15 - with: - name: hyprland - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - - - run: ${{ inputs.command }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 09aae111..1f52b4ff 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -9,36 +9,18 @@ jobs: source-tarball: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v5 + - name: Checkout Hyprland + id: checkout + uses: actions/checkout@v3 with: - fetch-depth: 0 submodules: recursive - - name: Populate git info in version.h.in + - name: Generate version + id: genversion run: | - git fetch --tags --unshallow || true - - COMMIT_HASH=$(git rev-parse HEAD) - BRANCH="${GITHUB_REF_NAME:-$(git rev-parse --abbrev-ref HEAD)}" - COMMIT_MSG=$(git show -s --format=%s | sed 's/[&/]/\\&/g') - COMMIT_DATE=$(git show -s --format=%cd --date=local) - GIT_DIRTY=$(git diff-index --quiet HEAD -- && echo "clean" || echo "dirty") - GIT_TAG=$(git describe --tags --always || echo "unknown") - GIT_COMMITS=$(git rev-list --count HEAD) - - echo "Branch: $BRANCH" - echo "Tag: $GIT_TAG" - - sed -i \ - -e "s|@GIT_COMMIT_HASH@|$COMMIT_HASH|" \ - -e "s|@GIT_BRANCH@|$BRANCH|" \ - -e "s|@GIT_COMMIT_MESSAGE@|$COMMIT_MSG|" \ - -e "s|@GIT_COMMIT_DATE@|$COMMIT_DATE|" \ - -e "s|@GIT_DIRTY@|$GIT_DIRTY|" \ - -e "s|@GIT_TAG@|$GIT_TAG|" \ - -e "s|@GIT_COMMITS@|$GIT_COMMITS|" \ - src/version.h.in + git fetch --unshallow || echo "failed unshallowing" + bash -c scripts/generateVersion.sh + mv scripts/generateVersion.sh scripts/generateVersion.sh.bak - name: Create tarball with submodules id: tar diff --git a/.github/workflows/security-checks.yml b/.github/workflows/security-checks.yml index 284500e6..4f539132 100644 --- a/.github/workflows/security-checks.yml +++ b/.github/workflows/security-checks.yml @@ -13,7 +13,7 @@ jobs: security-events: write steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v3 - name: Scan with Flawfinder uses: david-a-wheeler/flawfinder@8e4a779ad59dbfaee5da586aa9210853b701959c diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..b8be5f55 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,28 @@ +# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. +# +# You can adjust the behavior by modifying this file. +# For more information, see: +# https://github.com/actions/stale +name: Mark stale issues and pull requests + +on: + schedule: + - cron: "7 */4 * * *" + workflow_dispatch: + +jobs: + stale: + if: github.repository == 'hyprwm/Hyprland' + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + + steps: + - uses: actions/stale@v5 + with: + repo-token: ${{ secrets.STALEBOT_PAT }} + stale-issue-label: "stale" + stale-pr-label: "stale" + operations-per-run: 40 + days-before-close: -1 diff --git a/.github/workflows/translation-ai-check.yml b/.github/workflows/translation-ai-check.yml deleted file mode 100644 index d6a62a60..00000000 --- a/.github/workflows/translation-ai-check.yml +++ /dev/null @@ -1,139 +0,0 @@ -name: AI Translation Check - -on: - # pull_request_target: - # types: - # - opened - issue_comment: - types: - - created - -permissions: - contents: read - pull-requests: write - issues: write - -jobs: - review: - name: Review Translation - if: ${{ github.event_name == 'pull_request_target' || (github.event_name == 'issue_comment' && github.event.action == 'created' && github.event.issue.pull_request != null && github.event.comment.user.login == 'vaxerski' && github.event.comment.body == 'ai, please recheck' ) }} - runs-on: ubuntu-latest - env: - OPENAI_MODEL: gpt-5-mini - SYSTEM_PROMPT: | - You are a programmer and a translator. Your job is to review the attached patch for adding translation to a piece of software and make sure the submitted translation is not malicious, and that it makes sense. If the translation is not malicious, and doesn't contain obvious grammatical mistakes, say "Translation check OK". Otherwise, say "Translation check not ok" and list bad entries. - Examples of bad translations include obvious trolling (slurs, etc) or nonsense sentences. Meaningful improvements may be suggested, but if there are only minor improvements, just reply with "Translation check OK". Do not provide anything but the result and (if applicable) the bad entries or improvements. - - AI_PROMPT: Translation patch below. - - steps: - - name: Checkout source code - uses: actions/checkout@v5 - - - uses: dorny/paths-filter@v3 - id: changes - with: - filters: | - i18n: - - 'src/i18n/**' - - - name: Stop if i18n not changed - if: steps.changes.outputs.i18n != 'true' - run: echo "No i18n changes in this PR; skipping." && exit 0 - - - name: Determine PR number - id: pr - run: | - if [ "${{ github.event_name }}" = "pull_request_target" ]; then - echo "number=${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT" - else - echo "number=${{ github.event.issue.number }}" >> "$GITHUB_OUTPUT" - fi - - - name: Download combined PR diff - id: get_diff - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ steps.pr.outputs.number }} - run: | - # Get the combined diff for the entire PR - curl -sSL \ - -H "Authorization: token $GITHUB_TOKEN" \ - -H "Accept: application/vnd.github.v3.diff" \ - "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER" \ - -o pr.diff - - # Compute character length - LEN=$(wc -c < pr.diff | tr -d ' ') - echo "len=$LEN" >> "$GITHUB_OUTPUT" - if [ "$LEN" -gt 25000 ]; then - echo "too_long=true" >> "$GITHUB_OUTPUT" - else - echo "too_long=false" >> "$GITHUB_OUTPUT" - fi - - echo "got diff:" - cat pr.diff - - - name: Comment when diff length exceeded - if: steps.get_diff.outputs.too_long == 'true' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ steps.pr.outputs.number }} - run: | - jq -n --arg body "Diff length exceeded, can't query API" '{body: ("AI translation check result:\n\n" + $body)}' > body.json - curl -sS -X POST \ - -H "Authorization: token $GITHUB_TOKEN" \ - -H "Content-Type: application/json" \ - "https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/comments" \ - --data @body.json - - - name: Query OpenAI and post review - if: steps.get_diff.outputs.too_long == 'false' - env: - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - OPENAI_MODEL: ${{ env.OPENAI_MODEL }} - SYSTEM_PROMPT: ${{ env.SYSTEM_PROMPT }} - AI_PROMPT: ${{ env.AI_PROMPT }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ steps.pr.outputs.number }} - run: | - # Prepare OpenAI chat request payload (embed diff safely) - jq -n \ - --arg model "$OPENAI_MODEL" \ - --arg sys "$SYSTEM_PROMPT" \ - --arg prompt "$AI_PROMPT" \ - --rawfile diff pr.diff \ - '{model:$model, - messages:[ - {role:"system", content:$sys}, - {role:"user", content: ($prompt + "\n\n```diff\n" + $diff + "\n```")} - ] - }' > payload.json - - # Call OpenAI - curl -sS https://api.openai.com/v1/chat/completions \ - -H "Authorization: Bearer $OPENAI_API_KEY" \ - -H "Content-Type: application/json" \ - -d @payload.json > response.json - - # Extract response text - COMMENT=$(jq -r '.choices[0].message.content // empty' response.json) - if [ -z "$COMMENT" ]; then - COMMENT="AI did not return a response." - fi - - # If failed, add a note - ADDITIONAL_NOTE="" - if [[ "$COMMENT" == *"not ok"* ]]; then - ADDITIONAL_NOTE=$(echo -ne "\n\nPlease note this check is a guideline, not a hard requirement. It is here to help you translate. If you disagree with some points, just state that. Any typos should be fixed.") - fi - - # Post the review as a PR comment - jq -n --arg body "$COMMENT" --arg note "$ADDITIONAL_NOTE" '{body: ("AI translation check result:\n\n" + $body + $note)}' > body.json - echo "CURLing https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/comments" - curl -sS -X POST \ - -H "Authorization: token $GITHUB_TOKEN" \ - -H "Content-Type: application/json" \ - "https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/comments" \ - --data @body.json diff --git a/.gitignore b/.gitignore index 4e5c2323..2e158a4e 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ _deps build/ result* -/.pre-commit-config.yaml /.vscode/ /.idea/ .envrc @@ -28,12 +27,8 @@ protocols/*.c* protocols/*.h* .ccls-cache *.so -src/render/shaders/*.inc -src/render/shaders/Shaders.hpp hyprctl/hyprctl -hyprctl/hw-protocols/*.c* -hyprctl/hw-protocols/*.h* gmon.out *.out @@ -44,7 +39,3 @@ PKGBUILD src/version.h hyprpm/Makefile hyprctl/Makefile -example/hyprland.desktop - -**/.#*.* -**/#*.*# diff --git a/CMakeLists.txt b/CMakeLists.txt index 87574b82..3440af4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,29 +9,21 @@ project( DESCRIPTION "A Modern C++ Wayland Compositor" VERSION ${VER}) -include(CTest) include(CheckIncludeFile) include(GNUInstallDirs) set(HYPRLAND_VERSION ${VER}) set(PREFIX ${CMAKE_INSTALL_PREFIX}) set(INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}) -set(BINDIR ${CMAKE_INSTALL_BINDIR}) +configure_file(hyprland.pc.in hyprland.pc @ONLY) set(CMAKE_MESSAGE_LOG_LEVEL "STATUS") message(STATUS "Gathering git info") -# Make shader files includable -execute_process(COMMAND ./scripts/generateShaderIncludes.sh - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - RESULT_VARIABLE HYPR_SHADER_GEN_RESULT) -if(NOT HYPR_SHADER_GEN_RESULT EQUAL 0) - message( - FATAL_ERROR - "Failed to generate shader includes (scripts/generateShaderIncludes.sh), exit code: ${HYPR_SHADER_GEN_RESULT}" - ) -endif() +# Get git info hash and branch +execute_process(COMMAND ./scripts/generateVersion.sh + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) find_package(PkgConfig REQUIRED) @@ -39,23 +31,11 @@ find_package(PkgConfig REQUIRED) # provide a .pc file and won't be detected this way pkg_check_modules(udis_dep IMPORTED_TARGET udis86>=1.7.2) -# Find non-pkgconfig udis86, otherwise fallback to subproject +# Fallback to subproject if(NOT udis_dep_FOUND) - find_library(udis_nopc udis86) - if(NOT("${udis_nopc}" MATCHES "udis_nopc-NOTFOUND")) - message(STATUS "Found udis86 at ${udis_nopc}") - else() - add_subdirectory("subprojects/udis86") - include_directories("subprojects/udis86") - message(STATUS "udis86 dependency not found, falling back to subproject") - endif() -endif() - -find_library(librt rt) -if("${librt}" MATCHES "librt-NOTFOUND") - unset(LIBRT) -else() - set(LIBRT rt) + add_subdirectory("subprojects/udis86") + include_directories("subprojects/udis86") + message(STATUS "udis86 dependency not found, falling back to subproject") endif() if(CMAKE_BUILD_TYPE) @@ -86,36 +66,24 @@ message( if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG) message(STATUS "Configuring Hyprland in Debug with CMake") add_compile_definitions(HYPRLAND_DEBUG) - set(BUILD_TESTING ON) else() add_compile_options(-O3) message(STATUS "Configuring Hyprland in Release with CMake") - set(BUILD_TESTING OFF) endif() -add_compile_definitions(HYPRLAND_VERSION="${HYPRLAND_VERSION}") - include_directories(. "src/" "protocols/") set(CMAKE_CXX_STANDARD 26) -set(CXX_STANDARD_REQUIRED ON) add_compile_options( -Wall -Wextra - -Wpedantic -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers - -Wno-gnu-zero-variadic-macro-arguments -Wno-narrowing -Wno-pointer-arith - -Wno-clobbered - -frtti -fmacro-prefix-map=${CMAKE_SOURCE_DIR}/=) -# disable lto as it may break plugins -add_compile_options(-fno-lto) - set(CMAKE_EXECUTABLE_ENABLE_EXPORTS TRUE) set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE) @@ -123,158 +91,43 @@ message(STATUS "Checking deps...") find_package(Threads REQUIRED) -set(GLES_VERSION "GLES3") +if(LEGACY_RENDERER) + set(GLES_VERSION "GLES2") +else() + set(GLES_VERSION "GLES3") +endif() find_package(OpenGL REQUIRED COMPONENTS ${GLES_VERSION}) -find_package(glslang CONFIG REQUIRED) -set(AQUAMARINE_MINIMUM_VERSION 0.9.3) -set(HYPRLANG_MINIMUM_VERSION 0.6.7) -set(HYPRCURSOR_MINIMUM_VERSION 0.1.7) -set(HYPRUTILS_MINIMUM_VERSION 0.11.0) -set(HYPRGRAPHICS_MINIMUM_VERSION 0.1.6) +pkg_check_modules(hyprctl_deps REQUIRED IMPORTED_TARGET hyprutils>=0.2.1) -pkg_check_modules(aquamarine_dep REQUIRED IMPORTED_TARGET aquamarine>=${AQUAMARINE_MINIMUM_VERSION}) -pkg_check_modules(hyprlang_dep REQUIRED IMPORTED_TARGET hyprlang>=${HYPRLANG_MINIMUM_VERSION}) -pkg_check_modules(hyprcursor_dep REQUIRED IMPORTED_TARGET hyprcursor>=${HYPRCURSOR_MINIMUM_VERSION}) -pkg_check_modules(hyprutils_dep REQUIRED IMPORTED_TARGET hyprutils>=${HYPRUTILS_MINIMUM_VERSION}) -pkg_check_modules(hyprgraphics_dep REQUIRED IMPORTED_TARGET hyprgraphics>=${HYPRGRAPHICS_MINIMUM_VERSION}) +pkg_check_modules(aquamarine_dep REQUIRED IMPORTED_TARGET aquamarine) -string(REPLACE "." ";" AQ_VERSION_LIST ${aquamarine_dep_VERSION}) -list(GET AQ_VERSION_LIST 0 AQ_VERSION_MAJOR) -list(GET AQ_VERSION_LIST 1 AQ_VERSION_MINOR) -list(GET AQ_VERSION_LIST 2 AQ_VERSION_PATCH) - -set(AQUAMARINE_VERSION "${aquamarine_dep_VERSION}") -set(AQUAMARINE_VERSION_MAJOR "${AQ_VERSION_MAJOR}") -set(AQUAMARINE_VERSION_MINOR "${AQ_VERSION_MINOR}") -set(AQUAMARINE_VERSION_PATCH "${AQ_VERSION_PATCH}") -set(HYPRLANG_VERSION "${hyprlang_dep_VERSION}") -set(HYPRUTILS_VERSION "${hyprutils_dep_VERSION}") -set(HYPRCURSOR_VERSION "${hyprcursor_dep_VERSION}") -set(HYPRGRAPHICS_VERSION "${hyprgraphics_dep_VERSION}") - - -find_package(Git QUIET) - -# Populate variables with env vars if present -set(GIT_COMMIT_HASH "$ENV{GIT_COMMIT_HASH}") -if(NOT GIT_COMMIT_HASH) - set(GIT_COMMIT_HASH "unknown") -endif() - -set(GIT_BRANCH "$ENV{GIT_BRANCH}") -if(NOT GIT_BRANCH) - set(GIT_BRANCH "unknown") -endif() - -set(GIT_COMMIT_MESSAGE "$ENV{GIT_COMMIT_MESSAGE}") -if(NOT GIT_COMMIT_MESSAGE) - set(GIT_COMMIT_MESSAGE "unknown") -endif() - -set(GIT_COMMIT_DATE "$ENV{GIT_COMMIT_DATE}") -if(NOT GIT_COMMIT_DATE) - set(GIT_COMMIT_DATE "unknown") -endif() - -set(GIT_DIRTY "$ENV{GIT_DIRTY}") -if(NOT GIT_DIRTY) - set(GIT_DIRTY "unknown") -endif() - -set(GIT_TAG "$ENV{GIT_TAG}") -if(NOT GIT_TAG) - set(GIT_TAG "unknown") -endif() - -set(GIT_COMMITS "$ENV{GIT_COMMITS}") -if(NOT GIT_COMMITS) - set(GIT_COMMITS "0") -endif() - -if(Git_FOUND) - execute_process( - COMMAND ${GIT_EXECUTABLE} rev-parse --show-toplevel - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_TOPLEVEL - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_QUIET - RESULT_VARIABLE GIT_TOPLEVEL_RESULT - ) - - if(GIT_TOPLEVEL_RESULT EQUAL 0) - message(STATUS "Detected git repository root: ${GIT_TOPLEVEL}") - - execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD - WORKING_DIRECTORY ${GIT_TOPLEVEL} - OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${GIT_EXECUTABLE} branch --show-current - WORKING_DIRECTORY ${GIT_TOPLEVEL} - OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND sh "-c" "${GIT_EXECUTABLE} show -s --format=%s --no-show-signature | sed \"s/\\\"/\'/g\"" - WORKING_DIRECTORY ${GIT_TOPLEVEL} - OUTPUT_VARIABLE GIT_COMMIT_MESSAGE OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${GIT_EXECUTABLE} show -s --format=%cd --date=local --no-show-signature - WORKING_DIRECTORY ${GIT_TOPLEVEL} - OUTPUT_VARIABLE GIT_COMMIT_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${GIT_EXECUTABLE} diff-index --quiet HEAD -- - WORKING_DIRECTORY ${GIT_TOPLEVEL} - RESULT_VARIABLE GIT_DIRTY_RESULT) - if(NOT GIT_DIRTY_RESULT EQUAL 0) - set(GIT_DIRTY "dirty") - else() - set(GIT_DIRTY "clean") - endif() - execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags - WORKING_DIRECTORY ${GIT_TOPLEVEL} - OUTPUT_VARIABLE GIT_TAG OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD - WORKING_DIRECTORY ${GIT_TOPLEVEL} - OUTPUT_VARIABLE GIT_COMMITS OUTPUT_STRIP_TRAILING_WHITESPACE) - else() - message(WARNING "No Git repository detected in ${CMAKE_SOURCE_DIR}") - endif() -endif() - -configure_file( - ${CMAKE_SOURCE_DIR}/src/version.h.in - ${CMAKE_SOURCE_DIR}/src/version.h - @ONLY -) - -set_source_files_properties(${CMAKE_SOURCE_DIR}/src/version.h PROPERTIES GENERATED TRUE) - -set(XKBCOMMON_MINIMUM_VERSION 1.11.0) -set(WAYLAND_SERVER_MINIMUM_VERSION 1.22.91) -set(WAYLAND_SERVER_PROTOCOLS_MINIMUM_VERSION 1.45) -set(LIBINPUT_MINIMUM_VERSION 1.28) +add_compile_definitions(AQUAMARINE_VERSION="${aquamarine_dep_VERSION}") pkg_check_modules( deps REQUIRED - IMPORTED_TARGET GLOBAL - xkbcommon>=${XKBCOMMON_MINIMUM_VERSION} + IMPORTED_TARGET + xkbcommon uuid - wayland-server>=${WAYLAND_SERVER_MINIMUM_VERSION} - wayland-protocols>=${WAYLAND_SERVER_PROTOCOLS_MINIMUM_VERSION} + wayland-server>=1.22.90 + wayland-protocols cairo pango pangocairo pixman-1 xcursor libdrm - libinput>=${LIBINPUT_MINIMUM_VERSION} + libinput gbm gio-2.0 - re2 - muparser - lcms2) + hyprlang>=0.3.2 + hyprcursor>=0.1.7 + hyprutils>=0.2.3) find_package(hyprwayland-scanner 0.3.10 REQUIRED) file(GLOB_RECURSE SRCFILES "src/*.cpp") -get_filename_component(FULL_MAIN_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp ABSOLUTE) -list(REMOVE_ITEM SRCFILES "${FULL_MAIN_PATH}") set(TRACY_CPP_FILES "") if(USE_TRACY) @@ -282,14 +135,9 @@ if(USE_TRACY) message(STATUS "Tracy enabled, TRACY_CPP_FILES: " ${TRACY_CPP_FILES}) endif() -add_library(hyprland_lib STATIC ${SRCFILES}) -add_executable(Hyprland src/main.cpp ${TRACY_CPP_FILES}) -target_link_libraries(Hyprland hyprland_lib) +add_executable(Hyprland ${SRCFILES} ${TRACY_CPP_FILES}) -target_include_directories(hyprland_lib PUBLIC ${deps_INCLUDE_DIRS}) -target_include_directories(Hyprland PUBLIC ${deps_INCLUDE_DIRS}) - -set(USE_GPROF OFF) +set(USE_GPROF ON) if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG) message(STATUS "Setting debug flags") @@ -297,8 +145,23 @@ if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG) if(WITH_ASAN) message(STATUS "Enabling ASan") - target_link_libraries(hyprland_lib PUBLIC asan) - target_compile_options(hyprland_lib PUBLIC -fsanitize=address) + target_link_libraries(Hyprland asan) + target_compile_options(Hyprland PUBLIC -fsanitize=address) + endif() + + if(USE_TRACY) + message(STATUS "Tracy is turned on") + + option(TRACY_ENABLE "" ON) + option(TRACY_ON_DEMAND "" ON) + add_subdirectory(subprojects/tracy) + + target_link_libraries(Hyprland Tracy::TracyClient) + + if(USE_TRACY_GPU) + message(STATUS "Tracy GPU Profiling is turned on") + add_compile_definitions(USE_TRACY_GPU) + endif() endif() add_compile_options(-fno-pie -fno-builtin) @@ -309,27 +172,6 @@ if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG) endif() endif() -if(USE_TRACY) - message(STATUS "Tracy is turned on") - - option(TRACY_ENABLE "" ON) - option(TRACY_ON_DEMAND "" ON) - add_subdirectory(subprojects/tracy) - - add_compile_options(-fno-omit-frame-pointer) - - target_link_libraries(hyprland_lib PUBLIC Tracy::TracyClient) - - if(USE_TRACY_GPU) - message(STATUS "Tracy GPU Profiling is turned on") - add_compile_definitions(USE_TRACY_GPU) - endif() -endif() - -if(BUILT_WITH_NIX) - add_compile_definitions(BUILT_WITH_NIX) -endif() - check_include_file("execinfo.h" EXECINFOH) if(EXECINFOH) message(STATUS "Configuration supports execinfo") @@ -339,19 +181,18 @@ endif() include(CheckLibraryExists) check_library_exists(execinfo backtrace "" HAVE_LIBEXECINFO) if(HAVE_LIBEXECINFO) - target_link_libraries(hyprland_lib PUBLIC execinfo) + target_link_libraries(Hyprland execinfo) endif() check_include_file("sys/timerfd.h" HAS_TIMERFD) pkg_check_modules(epoll IMPORTED_TARGET epoll-shim) if(NOT HAS_TIMERFD AND epoll_FOUND) - target_link_libraries(hyprland_lib PUBLIC PkgConfig::epoll) + target_link_libraries(Hyprland PkgConfig::epoll) endif() -check_include_file("sys/inotify.h" HAS_INOTIFY) -pkg_check_modules(inotify IMPORTED_TARGET libinotify) -if(NOT HAS_INOTIFY AND inotify_FOUND) - target_link_libraries(hyprland_lib PUBLIC PkgConfig::inotify) +if(LEGACY_RENDERER) + message(STATUS "Using the legacy GLES2 renderer!") + add_compile_definitions(LEGACY_RENDERER) endif() if(NO_XWAYLAND) @@ -359,7 +200,10 @@ if(NO_XWAYLAND) add_compile_definitions(NO_XWAYLAND) else() message(STATUS "XWAYLAND Enabled (NO_XWAYLAND not defined) checking deps...") - set(XWAYLAND_DEPENDENCIES + pkg_check_modules( + xdeps + REQUIRED + IMPORTED_TARGET xcb xcb-render xcb-xfixes @@ -367,77 +211,36 @@ else() xcb-composite xcb-res xcb-errors) - - pkg_check_modules( - xdeps - REQUIRED - IMPORTED_TARGET - ${XWAYLAND_DEPENDENCIES}) - - string(JOIN ", " PKGCONFIG_XWAYLAND_DEPENDENCIES ${XWAYLAND_DEPENDENCIES}) - string(PREPEND PKGCONFIG_XWAYLAND_DEPENDENCIES ", ") - - target_link_libraries(hyprland_lib PUBLIC PkgConfig::xdeps) + target_link_libraries(Hyprland PkgConfig::xdeps) endif() -configure_file(hyprland.pc.in hyprland.pc @ONLY) - if(NO_SYSTEMD) message(STATUS "SYSTEMD support is disabled...") else() message(STATUS "SYSTEMD support is requested (NO_SYSTEMD not defined)...") add_compile_definitions(USES_SYSTEMD) - - # session file -uwsm - if(NO_UWSM) - message(STATUS "UWSM support is disabled...") - else() - message(STATUS "UWSM support is enabled (NO_UWSM not defined)...") - install(FILES ${CMAKE_SOURCE_DIR}/systemd/hyprland-uwsm.desktop - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/wayland-sessions) - endif() endif() set(CPACK_PROJECT_NAME ${PROJECT_NAME}) set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) include(CPack) -if(CMAKE_DISABLE_PRECOMPILE_HEADERS) - message(STATUS "Not using precompiled headers") -else() - message(STATUS "Setting precompiled headers") - target_precompile_headers(hyprland_lib PRIVATE - $<$:src/pch/pch.hpp>) -endif() +message(STATUS "Setting precompiled headers") + +target_precompile_headers(Hyprland PRIVATE + $<$:src/pch/pch.hpp>) message(STATUS "Setting link libraries") -target_link_libraries( - hyprland_lib - PUBLIC - PkgConfig::aquamarine_dep - PkgConfig::hyprlang_dep - PkgConfig::hyprutils_dep - PkgConfig::hyprcursor_dep - PkgConfig::hyprgraphics_dep - PkgConfig::deps -) - -target_link_libraries( - Hyprland - ${LIBRT} - hyprland_lib) +target_link_libraries(Hyprland rt PkgConfig::aquamarine_dep PkgConfig::deps) if(udis_dep_FOUND) - target_link_libraries(hyprland_lib PUBLIC PkgConfig::udis_dep) -elseif(NOT("${udis_nopc}" MATCHES "udis_nopc-NOTFOUND")) - target_link_libraries(hyprland_lib PUBLIC ${udis_nopc}) + target_link_libraries(Hyprland PkgConfig::udis_dep) else() - target_link_libraries(hyprland_lib PUBLIC libudis86) + target_link_libraries(Hyprland libudis86) endif() # used by `make installheaders`, to ensure the headers are generated add_custom_target(generate-protocol-headers) -set(PROTOCOL_SOURCES "") function(protocolnew protoPath protoName external) if(external) @@ -451,15 +254,10 @@ function(protocolnew protoPath protoName external) COMMAND hyprwayland-scanner ${path}/${protoName}.xml ${CMAKE_SOURCE_DIR}/protocols/ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) - target_sources(hyprland_lib PRIVATE protocols/${protoName}.cpp + target_sources(Hyprland PRIVATE protocols/${protoName}.cpp protocols/${protoName}.hpp) target_sources(generate-protocol-headers PRIVATE ${CMAKE_SOURCE_DIR}/protocols/${protoName}.hpp) - - list(APPEND PROTOCOL_SOURCES "${CMAKE_SOURCE_DIR}/protocols/${protoName}.cpp") - set(PROTOCOL_SOURCES "${PROTOCOL_SOURCES}" PARENT_SCOPE) - list(APPEND PROTOCOL_SOURCES "${CMAKE_SOURCE_DIR}/protocols/${protoName}.hpp") - set(PROTOCOL_SOURCES "${PROTOCOL_SOURCES}" PARENT_SCOPE) endfunction() function(protocolWayland) add_custom_command( @@ -469,23 +267,14 @@ function(protocolWayland) hyprwayland-scanner --wayland-enums ${WAYLAND_SCANNER_PKGDATA_DIR}/wayland.xml ${CMAKE_SOURCE_DIR}/protocols/ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) - target_sources(hyprland_lib PRIVATE protocols/wayland.cpp protocols/wayland.hpp) + target_sources(Hyprland PRIVATE protocols/wayland.cpp protocols/wayland.hpp) target_sources(generate-protocol-headers PRIVATE ${CMAKE_SOURCE_DIR}/protocols/wayland.hpp) - - list(APPEND PROTOCOL_SOURCES "${CMAKE_SOURCE_DIR}/protocols/wayland.hpp") - set(PROTOCOL_SOURCES "${PROTOCOL_SOURCES}" PARENT_SCOPE) - list(APPEND PROTOCOL_SOURCES "${CMAKE_SOURCE_DIR}/protocols/wayland.cpp") - set(PROTOCOL_SOURCES "${PROTOCOL_SOURCES}" PARENT_SCOPE) endfunction() -if(TARGET OpenGL::GL) - target_link_libraries(hyprland_lib PUBLIC OpenGL::EGL OpenGL::GL glslang::glslang glslang::glslang-default-resource-limits glslang::SPIRV Threads::Threads) -else() - target_link_libraries(hyprland_lib PUBLIC OpenGL::EGL OpenGL::GLES3 glslang::glslang glslang::glslang-default-resource-limits glslang::SPIRV Threads::Threads) -endif() +target_link_libraries(Hyprland OpenGL::EGL OpenGL::GL Threads::Threads) -pkg_check_modules(hyprland_protocols_dep hyprland-protocols>=0.6.4) +pkg_check_modules(hyprland_protocols_dep hyprland-protocols>=0.2.0) if(hyprland_protocols_dep_FOUND) pkg_get_variable(HYPRLAND_PROTOCOLS hyprland-protocols pkgdatadir) message(STATUS "hyprland-protocols dependency set to ${HYPRLAND_PROTOCOLS}") @@ -512,12 +301,6 @@ protocolnew("protocols" "wlr-data-control-unstable-v1" true) protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-focus-grab-v1" true) protocolnew("protocols" "wlr-layer-shell-unstable-v1" true) protocolnew("protocols" "wayland-drm" true) -protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-ctm-control-v1" true) -protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-surface-v1" true) -protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-lock-notify-v1" true) -protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-toplevel-mapping-v1" - true) - protocolnew("staging/tearing-control" "tearing-control-v1" false) protocolnew("staging/fractional-scale" "fractional-scale-v1" false) protocolnew("unstable/xdg-output" "xdg-output-unstable-v1" false) @@ -548,31 +331,12 @@ protocolnew("staging/drm-lease" "drm-lease-v1" false) protocolnew("staging/linux-drm-syncobj" "linux-drm-syncobj-v1" false) protocolnew("staging/xdg-dialog" "xdg-dialog-v1" false) protocolnew("staging/single-pixel-buffer" "single-pixel-buffer-v1" false) -protocolnew("staging/security-context" "security-context-v1" false) -protocolnew("staging/content-type" "content-type-v1" false) -protocolnew("staging/color-management" "color-management-v1" false) -protocolnew("staging/xdg-toplevel-tag" "xdg-toplevel-tag-v1" false) -protocolnew("staging/xdg-system-bell" "xdg-system-bell-v1" false) -protocolnew("staging/ext-workspace" "ext-workspace-v1" false) -protocolnew("staging/ext-data-control" "ext-data-control-v1" false) -protocolnew("staging/pointer-warp" "pointer-warp-v1" false) -protocolnew("staging/fifo" "fifo-v1" false) -protocolnew("staging/commit-timing" "commit-timing-v1" false) -protocolnew("staging/ext-image-capture-source" "ext-image-capture-source-v1" false) -protocolnew("staging/ext-image-copy-capture" "ext-image-copy-capture-v1" false) protocolwayland() # tools add_subdirectory(hyprctl) -add_subdirectory(start) - -if(NO_HYPRPM) - message(STATUS "hyprpm is disabled") -else() - add_subdirectory(hyprpm) - message(STATUS "hyprpm is enabled (NO_HYPRPM not defined)") -endif() +add_subdirectory(hyprpm) # binary and symlink install(TARGETS Hyprland) @@ -583,12 +347,8 @@ install( ${CMAKE_INSTALL_FULL_BINDIR}/Hyprland \ \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/hyprland\" \ )") + # session file -configure_file( - ${CMAKE_SOURCE_DIR}/example/hyprland.desktop.in - ${CMAKE_SOURCE_DIR}/example/hyprland.desktop - @ONLY -) install(FILES ${CMAKE_SOURCE_DIR}/example/hyprland.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/wayland-sessions) @@ -597,6 +357,7 @@ add_compile_definitions(DATAROOTDIR="${CMAKE_INSTALL_FULL_DATAROOTDIR}") # installable assets file(GLOB_RECURSE INSTALLABLE_ASSETS "assets/install/*") +list(FILTER INSTALLABLE_ASSETS EXCLUDE REGEX "meson.build") install(FILES ${INSTALLABLE_ASSETS} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/hypr) @@ -630,51 +391,4 @@ install( DIRECTORY ${HEADERS_SRC} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hyprland FILES_MATCHING - PATTERN "*.h" - PATTERN "*.hpp" - PATTERN "*.inc") - -if(BUILD_TESTING OR WITH_TESTS) - message(STATUS "Building tests") - - # hyprtester - add_subdirectory(hyprtester) - - # GTest - find_package(GTest CONFIG REQUIRED) - include(GoogleTest) - file(GLOB_RECURSE TESTFILES "tests/*.cpp") - add_executable(hyprland_gtests ${TESTFILES}) - target_compile_options(hyprland_gtests PRIVATE --coverage) - target_link_options(hyprland_gtests PRIVATE --coverage) - target_include_directories( - hyprland_gtests - PUBLIC "./include" - PRIVATE "./src" "./src/include" "./protocols" "${CMAKE_BINARY_DIR}") - - target_link_libraries(hyprland_gtests hyprland_lib GTest::gtest_main) - - gtest_discover_tests(hyprland_gtests) - - # Enable coverage in main hyprland lib - target_compile_options(hyprland_lib PRIVATE --coverage) - target_link_options(hyprland_lib PRIVATE --coverage) - target_link_libraries(hyprland_lib PUBLIC gcov) - - # Enable coverage in hyprland exe - target_compile_options(Hyprland PRIVATE --coverage) - target_link_options(Hyprland PRIVATE --coverage) - target_link_libraries(Hyprland gcov) -endif() - -if(BUILD_TESTING) - message(STATUS "Testing is enabled") - - enable_testing() - add_custom_target(tests) - - add_dependencies(tests hyprland_gtests) - -else() - message(STATUS "Testing is disabled") -endif() + PATTERN "*.h*") diff --git a/LICENSE b/LICENSE index efdec21a..a34afebb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2022-2026, vaxerski +Copyright (c) 2022-2024, vaxerski All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/Makefile b/Makefile index 852fcddf..59efc0ef 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,19 @@ PREFIX = /usr/local -stub: - @echo "Do not run $(MAKE) directly without any arguments. Please refer to the wiki on how to compile Hyprland." +legacyrenderer: + cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./buildZ + cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` + +legacyrendererdebug: + cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./build + cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` release: cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` debug: - cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DTESTS=true -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build + cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build cmake --build ./build --config Debug --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` nopch: @@ -18,7 +23,6 @@ nopch: clear: rm -rf build rm -f ./protocols/*.h ./protocols/*.c ./protocols/*.cpp ./protocols/*.hpp - rm -f ./hyprctl/hw-protocols/*.cpp ./hyprctl/hw-protocols/*.hpp all: $(MAKE) clear @@ -45,7 +49,7 @@ installheaders: cmake --build ./build --config Release --target generate-protocol-headers - find src -type f \( -name '*.hpp' -o -name '*.h' -o -name '*.inc' \) -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland + find src -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland cp ./protocols/*.h* ${PREFIX}/include/hyprland/protocols cp ./build/hyprland.pc ${PREFIX}/share/pkgconfig if [ -d /usr/share/pkgconfig ]; then cp ./build/hyprland.pc /usr/share/pkgconfig 2>/dev/null || true; fi @@ -88,12 +92,8 @@ asan: @echo "Wayland done" patch -p1 < ./scripts/hyprlandStaticAsan.diff - cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DWITH_ASAN:STRING=True -DUSE_TRACY:STRING=False -DUSE_TRACY_GPU:STRING=False -S . -B ./build + cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DWITH_ASAN:STRING=True -DUSE_TRACY:STRING=False -DUSE_TRACY_GPU:STRING=False -S . -B ./build -G Ninja cmake --build ./build --config Debug --target all @echo "Hyprland done" ASAN_OPTIONS="detect_odr_violation=0,log_path=asan.log" HYPRLAND_NO_CRASHREPORTER=1 ./build/Hyprland -c ~/.config/hypr/hyprland.conf - -test: - $(MAKE) debug - ./build/hyprtester/hyprtester -c hyprtester/test.conf -b ./build/Hyprland -p hyprtester/plugin/hyprtestplugin.so diff --git a/README.md b/README.md index bb74c4e4..f271c29c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@
-[![Badge Workflow]][Workflow] +![Badge Workflow] [![Badge License]][License] ![Badge Language] [![Badge Pull Requests]][Pull Requests] @@ -100,7 +100,7 @@ easy IPC, much more QoL stuff than other compositors and more... -[Configure]: https://wiki.hypr.land/Configuring/ +[Configure]: https://wiki.hyprland.org/Configuring/Configuring-Hyprland/ [Stars]: https://starchart.cc/hyprwm/Hyprland [Hypr]: https://github.com/hyprwm/Hypr @@ -108,10 +108,9 @@ easy IPC, much more QoL stuff than other compositors and more... [Issues]: https://github.com/hyprwm/Hyprland/issues [Todo]: https://github.com/hyprwm/Hyprland/projects?type=beta -[Contribute]: https://wiki.hypr.land/Contributing-and-Debugging/ -[Install]: https://wiki.hypr.land/Getting-Started/Installation/ -[Quick Start]: https://wiki.hypr.land/Getting-Started/Master-Tutorial/ -[Workflow]: https://github.com/hyprwm/Hyprland/actions/workflows/ci.yaml +[Contribute]: https://wiki.hyprland.org/Contributing-and-Debugging/ +[Install]: https://wiki.hyprland.org/Getting-Started/Installation/ +[Quick Start]: https://wiki.hyprland.org/Getting-Started/Master-Tutorial/ [License]: LICENSE @@ -126,9 +125,9 @@ easy IPC, much more QoL stuff than other compositors and more... -[Preview A]: https://i.ibb.co/XxFY75Mk/greerggergerhtrytghjnyhjn.png -[Preview B]: https://i.ibb.co/C1yTb0r/falf.png -[Preview C]: https://i.ibb.co/2Yc4q835/hyprland-preview-b.png +[Preview A]: https://i.ibb.co/C1yTb0r/falf.png +[Preview B]: https://linfindel.github.io/cdn/hyprland-preview-b.png +[Preview C]: https://i.ibb.co/B3GJg28/20221126-20h53m26s-grim.png diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 187165ce..00000000 --- a/SECURITY.md +++ /dev/null @@ -1,32 +0,0 @@ -# Hyprland Development Security Policy - -If you have a bug that affects the security of your system, you may -want to privately disclose it instead of making it immediately public. - -## Supported versions - -_Only_ the most recent release on Github is supported. There are no LTS releases. - -## What is not a security issue - -Some examples of issues that should not be reported as security issues: - -- An app can execute a command when ran outside of a sandbox -- An app can write / read hyprland sockets when ran outside of a sandbox -- Crashes -- Things that are protected via permissions when the permission system is disabled - -## What is a security issue - -Some examples of issues that should be reported as security issues: - -- Sandboxed application executing arbitrary code via Hyprland -- Application being able to modify Hyprland's code on the fly -- Application being able to keylog / track user's activity beyond what the wayland protocols allow - -## How to report security issues - -Please report your security issues via either of these channels: -- Mail: `vaxry [at] vaxry [dot] net` -- Matrix: `@vaxry:matrix.vaxry.net` -- Discord: `@vaxry` diff --git a/VERSION b/VERSION index 524456c7..a8ab6c96 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.54.0 +0.44.0 diff --git a/assets/header.svg b/assets/header.svg index a2b32551..c8cf8222 100644 --- a/assets/header.svg +++ b/assets/header.svg @@ -1,64 +1,72 @@ - - -
# Reporting suggestions Suggestions are welcome. -Many features can be implemented using bash scripts and Hyprland sockets, read up on those [Here](https://wiki.hypr.land/IPC). Please do not suggest features that can be implemented as such. +Many features can be implemented using bash scripts and Hyprland sockets, read up on those [Here](https://wiki.hyprland.org/IPC). Please do not suggest features that can be implemented as such.
@@ -70,7 +70,7 @@ A debug coredump provides more information for debugging and may speed up the pr Make sure you're on latest git. Run `git pull --recurse-submodules` to sync everything. -1. [Compile Hyprland with debug mode](http://wiki.hypr.land/Contributing-and-Debugging/#build-in-debug-mode) +1. [Compile Hyprland with debug mode](http://wiki.hyprland.org/Contributing-and-Debugging/#build-in-debug-mode) > Note: The config file used will be `hyprlandd.conf` instead of `hyprland.conf` 2. `cd ~` diff --git a/docs/hyprctl.1 b/docs/hyprctl.1 index 61cb84fd..8c9f3a23 100644 --- a/docs/hyprctl.1 +++ b/docs/hyprctl.1 @@ -1,19 +1,5 @@ -.\" Automatically generated by Pandoc 3.1.3 +.\" Automatically generated by Pandoc 2.9.2.1 .\" -.\" Define V font for inline verbatim, using C font in formats -.\" that render this, and otherwise B font. -.ie "\f[CB]x\f[]"x" \{\ -. ftr V B -. ftr VI BI -. ftr VB B -. ftr VBI BI -.\} -.el \{\ -. ftr V CR -. ftr VI CI -. ftr VB CB -. ftr VBI CBI -.\} .TH "hyprctl" "1" "" "" "hyprctl User Manual" .hy .SH NAME diff --git a/docs/meson.build b/docs/meson.build new file mode 100644 index 00000000..6ff51d1a --- /dev/null +++ b/docs/meson.build @@ -0,0 +1,2 @@ +install_man('Hyprland.1') +install_man('hyprctl.1') diff --git a/example/hyprland-session.service b/example/hyprland-session.service new file mode 100644 index 00000000..7d33f5b3 --- /dev/null +++ b/example/hyprland-session.service @@ -0,0 +1,14 @@ +[Unit] +Description=Hyprland - Tiling compositor with the looks +Documentation=man:Hyprland(1) +BindsTo=graphical-session.target +Before=graphical-session.target +Wants=graphical-session-pre.target +After=graphical-session-pre.target + +[Service] +Type=notify +ExecStart=/usr/bin/Hyprland +ExecStop=/usr/bin/hyprctl dispatch exit +Restart=on-failure +Slice=session.slice diff --git a/example/hyprland-systemd.desktop b/example/hyprland-systemd.desktop new file mode 100644 index 00000000..b36a87b2 --- /dev/null +++ b/example/hyprland-systemd.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Name=Hyprland +Comment=An intelligent dynamic tiling Wayland compositor +Exec=systemctl --user start --wait hyprland-session +Type=Application diff --git a/example/hyprland.conf b/example/hyprland.conf index 15b0e4f7..4adc2d40 100644 --- a/example/hyprland.conf +++ b/example/hyprland.conf @@ -1,6 +1,6 @@ # This is an example Hyprland config file. # Refer to the wiki for more information. -# https://wiki.hypr.land/Configuring/ +# https://wiki.hyprland.org/Configuring/Configuring-Hyprland/ # Please note not all available settings / options are set here. # For a full list, see the wiki @@ -14,7 +14,7 @@ ### MONITORS ### ################ -# See https://wiki.hypr.land/Configuring/Monitors/ +# See https://wiki.hyprland.org/Configuring/Monitors/ monitor=,preferred,auto,auto @@ -22,12 +22,12 @@ monitor=,preferred,auto,auto ### MY PROGRAMS ### ################### -# See https://wiki.hypr.land/Configuring/Keywords/ +# See https://wiki.hyprland.org/Configuring/Keywords/ # Set programs that you use $terminal = kitty $fileManager = dolphin -$menu = hyprlauncher +$menu = wofi --show drun ################# @@ -46,72 +46,52 @@ $menu = hyprlauncher ### ENVIRONMENT VARIABLES ### ############################# -# See https://wiki.hypr.land/Configuring/Environment-variables/ +# See https://wiki.hyprland.org/Configuring/Environment-variables/ env = XCURSOR_SIZE,24 env = HYPRCURSOR_SIZE,24 -################### -### PERMISSIONS ### -################### - -# See https://wiki.hypr.land/Configuring/Permissions/ -# Please note permission changes here require a Hyprland restart and are not applied on-the-fly -# for security reasons - -# ecosystem { -# enforce_permissions = 1 -# } - -# permission = /usr/(bin|local/bin)/grim, screencopy, allow -# permission = /usr/(lib|libexec|lib64)/xdg-desktop-portal-hyprland, screencopy, allow -# permission = /usr/(bin|local/bin)/hyprpm, plugin, allow - - ##################### ### LOOK AND FEEL ### ##################### -# Refer to https://wiki.hypr.land/Configuring/Variables/ +# Refer to https://wiki.hyprland.org/Configuring/Variables/ -# https://wiki.hypr.land/Configuring/Variables/#general +# https://wiki.hyprland.org/Configuring/Variables/#general general { gaps_in = 5 gaps_out = 20 border_size = 2 - # https://wiki.hypr.land/Configuring/Variables/#variable-types for info about colors + # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg col.inactive_border = rgba(595959aa) # Set to true enable resizing windows by clicking and dragging on borders and gaps resize_on_border = false - # Please see https://wiki.hypr.land/Configuring/Tearing/ before you turn this on + # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on allow_tearing = false layout = dwindle } -# https://wiki.hypr.land/Configuring/Variables/#decoration +# https://wiki.hyprland.org/Configuring/Variables/#decoration decoration { rounding = 10 - rounding_power = 2 # Change transparency of focused and unfocused windows active_opacity = 1.0 inactive_opacity = 1.0 - shadow { - enabled = true - range = 4 - render_power = 3 - color = rgba(1a1a1aee) - } + drop_shadow = true + shadow_range = 4 + shadow_render_power = 3 + col.shadow = rgba(1a1a1aee) - # https://wiki.hypr.land/Configuring/Variables/#blur + # https://wiki.hyprland.org/Configuring/Variables/#blur blur { enabled = true size = 3 @@ -121,74 +101,34 @@ decoration { } } -# https://wiki.hypr.land/Configuring/Variables/#animations +# https://wiki.hyprland.org/Configuring/Variables/#animations animations { - enabled = yes, please :) + enabled = true - # Default curves, see https://wiki.hypr.land/Configuring/Animations/#curves - # NAME, X0, Y0, X1, Y1 - bezier = easeOutQuint, 0.23, 1, 0.32, 1 - bezier = easeInOutCubic, 0.65, 0.05, 0.36, 1 - bezier = linear, 0, 0, 1, 1 - bezier = almostLinear, 0.5, 0.5, 0.75, 1 - bezier = quick, 0.15, 0, 0.1, 1 + # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more - # Default animations, see https://wiki.hypr.land/Configuring/Animations/ - # NAME, ONOFF, SPEED, CURVE, [STYLE] - animation = global, 1, 10, default - animation = border, 1, 5.39, easeOutQuint - animation = windows, 1, 4.79, easeOutQuint - animation = windowsIn, 1, 4.1, easeOutQuint, popin 87% - animation = windowsOut, 1, 1.49, linear, popin 87% - animation = fadeIn, 1, 1.73, almostLinear - animation = fadeOut, 1, 1.46, almostLinear - animation = fade, 1, 3.03, quick - animation = layers, 1, 3.81, easeOutQuint - animation = layersIn, 1, 4, easeOutQuint, fade - animation = layersOut, 1, 1.5, linear, fade - animation = fadeLayersIn, 1, 1.79, almostLinear - animation = fadeLayersOut, 1, 1.39, almostLinear - animation = workspaces, 1, 1.94, almostLinear, fade - animation = workspacesIn, 1, 1.21, almostLinear, fade - animation = workspacesOut, 1, 1.94, almostLinear, fade - animation = zoomFactor, 1, 7, quick + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 + + animation = windows, 1, 7, myBezier + animation = windowsOut, 1, 7, default, popin 80% + animation = border, 1, 10, default + animation = borderangle, 1, 8, default + animation = fade, 1, 7, default + animation = workspaces, 1, 6, default } -# Ref https://wiki.hypr.land/Configuring/Workspace-Rules/ -# "Smart gaps" / "No gaps when only" -# uncomment all if you wish to use that. -# workspace = w[tv1], gapsout:0, gapsin:0 -# workspace = f[1], gapsout:0, gapsin:0 -# windowrule { -# name = no-gaps-wtv1 -# match:float = false -# match:workspace = w[tv1] -# -# border_size = 0 -# rounding = 0 -# } -# -# windowrule { -# name = no-gaps-f1 -# match:float = false -# match:workspace = f[1] -# -# border_size = 0 -# rounding = 0 -# } - -# See https://wiki.hypr.land/Configuring/Dwindle-Layout/ for more +# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more dwindle { pseudotile = true # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below preserve_split = true # You probably want this } -# See https://wiki.hypr.land/Configuring/Master-Layout/ for more +# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more master { new_status = master } -# https://wiki.hypr.land/Configuring/Variables/#misc +# https://wiki.hyprland.org/Configuring/Variables/#misc misc { force_default_wallpaper = -1 # Set to 0 or 1 to disable the anime mascot wallpapers disable_hyprland_logo = false # If true disables the random hyprland logo / anime girl background. :( @@ -199,7 +139,7 @@ misc { ### INPUT ### ############# -# https://wiki.hypr.land/Configuring/Variables/#input +# https://wiki.hyprland.org/Configuring/Variables/#input input { kb_layout = us kb_variant = @@ -216,11 +156,13 @@ input { } } -# See https://wiki.hypr.land/Configuring/Gestures -gesture = 3, horizontal, workspace +# https://wiki.hyprland.org/Configuring/Variables/#gestures +gestures { + workspace_swipe = false +} # Example per-device config -# See https://wiki.hypr.land/Configuring/Keywords/#per-device-input-configs for more +# See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more device { name = epic-mouse-v1 sensitivity = -0.5 @@ -231,18 +173,18 @@ device { ### KEYBINDINGS ### ################### -# See https://wiki.hypr.land/Configuring/Keywords/ +# See https://wiki.hyprland.org/Configuring/Keywords/ $mainMod = SUPER # Sets "Windows" key as main modifier -# Example binds, see https://wiki.hypr.land/Configuring/Binds/ for more +# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more bind = $mainMod, Q, exec, $terminal bind = $mainMod, C, killactive, -bind = $mainMod, M, exec, command -v hyprshutdown >/dev/null 2>&1 && hyprshutdown || hyprctl dispatch exit +bind = $mainMod, M, exit, bind = $mainMod, E, exec, $fileManager bind = $mainMod, V, togglefloating, bind = $mainMod, R, exec, $menu bind = $mainMod, P, pseudo, # dwindle -bind = $mainMod, J, layoutmsg, togglesplit # dwindle +bind = $mainMod, J, togglesplit, # dwindle # Move focus with mainMod + arrow keys bind = $mainMod, left, movefocus, l @@ -291,8 +233,8 @@ bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle -bindel = ,XF86MonBrightnessUp, exec, brightnessctl -e4 -n2 set 5%+ -bindel = ,XF86MonBrightnessDown, exec, brightnessctl -e4 -n2 set 5%- +bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 10%+ +bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%- # Requires playerctl bindl = , XF86AudioNext, exec, playerctl next @@ -304,38 +246,13 @@ bindl = , XF86AudioPrev, exec, playerctl previous ### WINDOWS AND WORKSPACES ### ############################## -# See https://wiki.hypr.land/Configuring/Window-Rules/ for more -# See https://wiki.hypr.land/Configuring/Workspace-Rules/ for workspace rules +# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more +# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules -# Example windowrules that are useful +# Example windowrule v1 +# windowrule = float, ^(kitty)$ -windowrule { - # Ignore maximize requests from all apps. You'll probably like this. - name = suppress-maximize-events - match:class = .* +# Example windowrule v2 +# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ - suppress_event = maximize -} - -windowrule { - # Fix some dragging issues with XWayland - name = fix-xwayland-drags - match:class = ^$ - match:title = ^$ - match:xwayland = true - match:float = true - match:fullscreen = false - match:pin = false - - no_focus = true -} - -# Hyprland-run windowrule -windowrule { - name = move-hyprland-run - - match:class = hyprland-run - - move = 20 monitor_h-120 - float = yes -} +windowrulev2 = suppressevent maximize, class:.* # You'll probably like this. diff --git a/example/hyprland.desktop b/example/hyprland.desktop new file mode 100644 index 00000000..57ad076f --- /dev/null +++ b/example/hyprland.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Name=Hyprland +Comment=An intelligent dynamic tiling Wayland compositor +Exec=Hyprland +Type=Application \ No newline at end of file diff --git a/example/hyprland.desktop.in b/example/hyprland.desktop.in deleted file mode 100644 index d8e87d60..00000000 --- a/example/hyprland.desktop.in +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Name=Hyprland -Comment=An intelligent dynamic tiling Wayland compositor -Exec=@PREFIX@/@CMAKE_INSTALL_BINDIR@/start-hyprland -Type=Application -DesktopNames=Hyprland -Keywords=tiling;wayland;compositor; diff --git a/example/launch.json b/example/launch.json index e60cc900..c47bdb72 100644 --- a/example/launch.json +++ b/example/launch.json @@ -22,6 +22,5 @@ } ] }, - ] } \ No newline at end of file diff --git a/example/meson.build b/example/meson.build new file mode 100644 index 00000000..a338644e --- /dev/null +++ b/example/meson.build @@ -0,0 +1,10 @@ +install_data( + 'hyprland.conf', + install_dir: join_paths(get_option('datadir'), 'hypr'), + install_tag: 'runtime', +) +install_data( + 'hyprland.desktop', + install_dir: join_paths(get_option('datadir'), 'wayland-sessions'), + install_tag: 'runtime', +) diff --git a/example/screenShader.frag b/example/screenShader.frag index 71598e51..5eeac17a 100644 --- a/example/screenShader.frag +++ b/example/screenShader.frag @@ -1,19 +1,16 @@ // // Example blue light filter shader. -// - -#version 300 es +// precision mediump float; -in vec2 v_texcoord; -layout(location = 0) out vec4 fragColor; +varying vec2 v_texcoord; uniform sampler2D tex; void main() { - vec4 pixColor = texture(tex, v_texcoord); + vec4 pixColor = texture2D(tex, v_texcoord); pixColor[2] *= 0.8; - fragColor = pixColor; + gl_FragColor = pixColor; } diff --git a/flake.lock b/flake.lock index 4a89c0fc..2579dd11 100644 --- a/flake.lock +++ b/flake.lock @@ -16,11 +16,11 @@ ] }, "locked": { - "lastModified": 1772292445, - "narHash": "sha256-4F1Q7U313TKUDDovCC96m/Za4wZcJ3yqtu4eSrj8lk8=", + "lastModified": 1727261104, + "narHash": "sha256-rxDI7WrxIRV9it9mDCHcLa7xQykf1JloXnoXr5xQ8zI=", "owner": "hyprwm", "repo": "aquamarine", - "rev": "1dbbba659c1cef0b0202ce92cadfe13bae550e8f", + "rev": "b82fdaff917582a9d568969e15e61b398c71e990", "type": "github" }, "original": { @@ -29,43 +29,6 @@ "type": "github" } }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1767039857, - "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", - "owner": "NixOS", - "repo": "flake-compat", - "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "flake-compat", - "type": "github" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "pre-commit-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1709087332, - "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, "hyprcursor": { "inputs": { "hyprlang": [ @@ -79,11 +42,11 @@ ] }, "locked": { - "lastModified": 1753964049, - "narHash": "sha256-lIqabfBY7z/OANxHoPeIrDJrFyYy9jAM4GQLzZ2feCM=", + "lastModified": 1727532803, + "narHash": "sha256-ZaZ7h7PY8mQc4vtGmVqWLAq9CAO02gHMyNR5yY8zDmM=", "owner": "hyprwm", "repo": "hyprcursor", - "rev": "44e91d467bdad8dcf8bbd2ac7cf49972540980a5", + "rev": "b98726e431d4d3ed58bd58bee1047cdb81cec69f", "type": "github" }, "original": { @@ -92,71 +55,6 @@ "type": "github" } }, - "hyprgraphics": { - "inputs": { - "hyprutils": [ - "hyprutils" - ], - "nixpkgs": [ - "nixpkgs" - ], - "systems": [ - "systems" - ] - }, - "locked": { - "lastModified": 1770511807, - "narHash": "sha256-suKmSbSk34uPOJDTg/GbPrKEJutzK08vj0VoTvAFBCA=", - "owner": "hyprwm", - "repo": "hyprgraphics", - "rev": "7c75487edd43a71b61adb01cae8326d277aab683", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprgraphics", - "type": "github" - } - }, - "hyprland-guiutils": { - "inputs": { - "aquamarine": [ - "aquamarine" - ], - "hyprgraphics": [ - "hyprgraphics" - ], - "hyprlang": [ - "hyprlang" - ], - "hyprtoolkit": "hyprtoolkit", - "hyprutils": [ - "hyprutils" - ], - "hyprwayland-scanner": [ - "hyprwayland-scanner" - ], - "nixpkgs": [ - "nixpkgs" - ], - "systems": [ - "systems" - ] - }, - "locked": { - "lastModified": 1767023960, - "narHash": "sha256-R2HgtVS1G3KSIKAQ77aOZ+Q0HituOmPgXW9nBNkpp3Q=", - "owner": "hyprwm", - "repo": "hyprland-guiutils", - "rev": "c2e906261142f5dd1ee0bfc44abba23e2754c660", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprland-guiutils", - "type": "github" - } - }, "hyprland-protocols": { "inputs": { "nixpkgs": [ @@ -167,11 +65,36 @@ ] }, "locked": { - "lastModified": 1765214753, - "narHash": "sha256-P9zdGXOzToJJgu5sVjv7oeOGPIIwrd9hAUAP3PsmBBs=", + "lastModified": 1727451107, + "narHash": "sha256-qV9savtHwmZUa0eJE294WYJjKPGB2+bJhwByFShsVyo=", "owner": "hyprwm", "repo": "hyprland-protocols", - "rev": "3f3860b869014c00e8b9e0528c7b4ddc335c21ab", + "rev": "6b3261ee13a6d2b99de79a31d352f6996e35bde3", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprland-protocols_2": { + "inputs": { + "nixpkgs": [ + "xdph", + "nixpkgs" + ], + "systems": [ + "xdph", + "systems" + ] + }, + "locked": { + "lastModified": 1721326555, + "narHash": "sha256-zCu4R0CSHEactW9JqYki26gy8h9f6rHmSwj4XJmlHgg=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "5a11232266bf1a1f5952d5b179c3f4b2facaaa84", "type": "github" }, "original": { @@ -193,11 +116,11 @@ ] }, "locked": { - "lastModified": 1771866172, - "narHash": "sha256-fYFoXhQLrm1rD8vSFKQBOEX4OGCuJdLt1amKfHd5GAw=", + "lastModified": 1725997860, + "narHash": "sha256-d/rZ/fHR5l1n7PeyLw0StWMNLXVU9c4HFyfskw568so=", "owner": "hyprwm", "repo": "hyprlang", - "rev": "0b219224910e7642eb0ed49f0db5ec3d008e3e41", + "rev": "dfeb5811dd6485490cce18d6cc1e38a055eea876", "type": "github" }, "original": { @@ -206,51 +129,6 @@ "type": "github" } }, - "hyprtoolkit": { - "inputs": { - "aquamarine": [ - "hyprland-guiutils", - "aquamarine" - ], - "hyprgraphics": [ - "hyprland-guiutils", - "hyprgraphics" - ], - "hyprlang": [ - "hyprland-guiutils", - "hyprlang" - ], - "hyprutils": [ - "hyprland-guiutils", - "hyprutils" - ], - "hyprwayland-scanner": [ - "hyprland-guiutils", - "hyprwayland-scanner" - ], - "nixpkgs": [ - "hyprland-guiutils", - "nixpkgs" - ], - "systems": [ - "hyprland-guiutils", - "systems" - ] - }, - "locked": { - "lastModified": 1764592794, - "narHash": "sha256-7CcO+wbTJ1L1NBQHierHzheQGPWwkIQug/w+fhTAVuU=", - "owner": "hyprwm", - "repo": "hyprtoolkit", - "rev": "5cfe0743f0e608e1462972303778d8a0859ee63e", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprtoolkit", - "type": "github" - } - }, "hyprutils": { "inputs": { "nixpkgs": [ @@ -261,11 +139,11 @@ ] }, "locked": { - "lastModified": 1771271487, - "narHash": "sha256-41gEiUS0Pyw3L/ge1l8MXn61cK14VAhgWB/JV8s/oNI=", + "lastModified": 1727300645, + "narHash": "sha256-OvAtVLaSRPnbXzOwlR1fVqCXR7i+ICRX3aPMCdIiv+c=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "340a792e3b3d482c4ae5f66d27a9096bdee6d76d", + "rev": "3f5293432b6dc6a99f26aca2eba3876d2660665c", "type": "github" }, "original": { @@ -284,11 +162,11 @@ ] }, "locked": { - "lastModified": 1770501770, - "narHash": "sha256-NWRM6+YxTRv+bT9yvlhhJ2iLae1B1pNH3mAL5wi2rlQ=", + "lastModified": 1726874836, + "narHash": "sha256-VKR0sf0PSNCB0wPHVKSAn41mCNVCnegWmgkrneKDhHM=", "owner": "hyprwm", "repo": "hyprwayland-scanner", - "rev": "0bd8b6cde9ec27d48aad9e5b4deefb3746909d40", + "rev": "500c81a9e1a76760371049a8d99e008ea77aa59e", "type": "github" }, "original": { @@ -297,39 +175,13 @@ "type": "github" } }, - "hyprwire": { - "inputs": { - "hyprutils": [ - "hyprutils" - ], - "nixpkgs": [ - "nixpkgs" - ], - "systems": [ - "systems" - ] - }, - "locked": { - "lastModified": 1771606233, - "narHash": "sha256-F3PLUqQ/TwgR70U+UeOqJnihJZ2EuunzojYC4g5xHr0=", - "owner": "hyprwm", - "repo": "hyprwire", - "rev": "06c7f1f8c4194786c8400653c4efc49dc14c0f3a", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprwire", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1772198003, - "narHash": "sha256-I45esRSssFtJ8p/gLHUZ1OUaaTaVLluNkABkk6arQwE=", + "lastModified": 1727348695, + "narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "dd9b079222d43e1943b6ebd802f04fd959dc8e61", + "rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784", "type": "github" }, "original": { @@ -339,41 +191,15 @@ "type": "github" } }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": "flake-compat", - "gitignore": "gitignore", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1772024342, - "narHash": "sha256-+eXlIc4/7dE6EcPs9a2DaSY3fTA9AE526hGqkNID3Wg=", - "owner": "cachix", - "repo": "git-hooks.nix", - "rev": "6e34e97ed9788b17796ee43ccdbaf871a5c2b476", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "git-hooks.nix", - "type": "github" - } - }, "root": { "inputs": { "aquamarine": "aquamarine", "hyprcursor": "hyprcursor", - "hyprgraphics": "hyprgraphics", - "hyprland-guiutils": "hyprland-guiutils", "hyprland-protocols": "hyprland-protocols", "hyprlang": "hyprlang", "hyprutils": "hyprutils", "hyprwayland-scanner": "hyprwayland-scanner", - "hyprwire": "hyprwire", "nixpkgs": "nixpkgs", - "pre-commit-hooks": "pre-commit-hooks", "systems": "systems", "xdph": "xdph" } @@ -395,9 +221,7 @@ }, "xdph": { "inputs": { - "hyprland-protocols": [ - "hyprland-protocols" - ], + "hyprland-protocols": "hyprland-protocols_2", "hyprlang": [ "hyprlang" ], @@ -415,11 +239,11 @@ ] }, "locked": { - "lastModified": 1761431178, - "narHash": "sha256-xzjC1CV3+wpUQKNF+GnadnkeGUCJX+vgaWIZsnz9tzI=", + "lastModified": 1727524473, + "narHash": "sha256-1DGktDtSWIJpnDbVoj/qpvJSH5zg6JbOfuh6xqZMap0=", "owner": "hyprwm", "repo": "xdg-desktop-portal-hyprland", - "rev": "4b8801228ff958d028f588f0c2b911dbf32297f9", + "rev": "7e500e679ede40e79cf2d89b5f5fa3e34923bd26", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 6d695bfb..ee5af6a1 100644 --- a/flake.nix +++ b/flake.nix @@ -22,30 +22,12 @@ inputs.hyprlang.follows = "hyprlang"; }; - hyprgraphics = { - url = "github:hyprwm/hyprgraphics"; - inputs.nixpkgs.follows = "nixpkgs"; - inputs.systems.follows = "systems"; - inputs.hyprutils.follows = "hyprutils"; - }; - hyprland-protocols = { url = "github:hyprwm/hyprland-protocols"; inputs.nixpkgs.follows = "nixpkgs"; inputs.systems.follows = "systems"; }; - hyprland-guiutils = { - url = "github:hyprwm/hyprland-guiutils"; - inputs.nixpkgs.follows = "nixpkgs"; - inputs.systems.follows = "systems"; - inputs.aquamarine.follows = "aquamarine"; - inputs.hyprgraphics.follows = "hyprgraphics"; - inputs.hyprutils.follows = "hyprutils"; - inputs.hyprlang.follows = "hyprlang"; - inputs.hyprwayland-scanner.follows = "hyprwayland-scanner"; - }; - hyprlang = { url = "github:hyprwm/hyprlang"; inputs.nixpkgs.follows = "nixpkgs"; @@ -65,145 +47,84 @@ inputs.systems.follows = "systems"; }; - hyprwire = { - url = "github:hyprwm/hyprwire"; - inputs.nixpkgs.follows = "nixpkgs"; - inputs.systems.follows = "systems"; - inputs.hyprutils.follows = "hyprutils"; - }; - xdph = { url = "github:hyprwm/xdg-desktop-portal-hyprland"; inputs.nixpkgs.follows = "nixpkgs"; inputs.systems.follows = "systems"; - inputs.hyprland-protocols.follows = "hyprland-protocols"; inputs.hyprlang.follows = "hyprlang"; inputs.hyprutils.follows = "hyprutils"; inputs.hyprwayland-scanner.follows = "hyprwayland-scanner"; }; - - pre-commit-hooks = { - url = "github:cachix/git-hooks.nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; }; - outputs = - inputs@{ - self, - nixpkgs, - systems, - ... - }: - let - inherit (nixpkgs) lib; - eachSystem = lib.genAttrs (import systems); - pkgsFor = eachSystem ( - system: - import nixpkgs { - localSystem = system; - overlays = with self.overlays; [ - hyprland-packages - hyprland-extras - ]; - } - ); - pkgsCrossFor = eachSystem ( - system: crossSystem: - import nixpkgs { - localSystem = system; - inherit crossSystem; - overlays = with self.overlays; [ - hyprland-packages - hyprland-extras - ]; - } - ); - pkgsDebugFor = eachSystem ( - system: - import nixpkgs { - localSystem = system; - overlays = with self.overlays; [ - hyprland-debug - ]; - } - ); - pkgsDebugCrossFor = eachSystem ( - system: crossSystem: - import nixpkgs { - localSystem = system; - inherit crossSystem; - overlays = with self.overlays; [ - hyprland-debug - ]; - } - ); - in - { - overlays = import ./nix/overlays.nix { inherit self lib inputs; }; + outputs = inputs @ { + self, + nixpkgs, + systems, + ... + }: let + inherit (nixpkgs) lib; + eachSystem = lib.genAttrs (import systems); + pkgsFor = eachSystem (system: + import nixpkgs { + localSystem = system; + overlays = with self.overlays; [ + hyprland-packages + hyprland-extras + ]; + }); + pkgsCrossFor = eachSystem (system: crossSystem: + import nixpkgs { + localSystem = system; + crossSystem = crossSystem; + overlays = with self.overlays; [ + hyprland-packages + hyprland-extras + ]; + }); + in { + overlays = import ./nix/overlays.nix {inherit self lib inputs;}; - checks = eachSystem ( - system: - (lib.filterAttrs ( - n: _: (lib.hasPrefix "hyprland" n) && !(lib.hasSuffix "debug" n) - ) self.packages.${system}) - // { - inherit (self.packages.${system}) xdg-desktop-portal-hyprland; - pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run { - src = ./.; - hooks = { - hyprland-treewide-formatter = { - enable = true; - entry = "${self.formatter.${system}}/bin/hyprland-treewide-formatter"; - pass_filenames = false; - excludes = [ "subprojects" ]; - always_run = true; - }; - }; - }; - } - // (import ./nix/tests inputs pkgsFor.${system}) - ); - - packages = eachSystem (system: { - default = self.packages.${system}.hyprland; - inherit (pkgsFor.${system}) - # hyprland-packages - hyprland - hyprland-unwrapped - hyprland-with-tests - # hyprland-extras - xdg-desktop-portal-hyprland - ; - inherit (pkgsDebugFor.${system}) hyprland-debug; - hyprland-cross = (pkgsCrossFor.${system} "aarch64-linux").hyprland; - hyprland-debug-cross = (pkgsDebugCrossFor.${system} "aarch64-linux").hyprland-debug; + checks = eachSystem (system: + (lib.filterAttrs + (n: _: (lib.hasPrefix "hyprland" n) && !(lib.hasSuffix "debug" n)) + self.packages.${system}) + // { + inherit (self.packages.${system}) xdg-desktop-portal-hyprland; }); - devShells = eachSystem (system: { - default = - pkgsFor.${system}.mkShell.override - { - inherit (self.packages.${system}.default) stdenv; - } - { - name = "hyprland-shell"; - hardeningDisable = [ "fortify" ]; - inputsFrom = [ pkgsFor.${system}.hyprland ]; - packages = [ pkgsFor.${system}.clang-tools ]; - inherit (self.checks.${system}.pre-commit-check) shellHook; - }; - }); + packages = eachSystem (system: { + default = self.packages.${system}.hyprland; + inherit + (pkgsFor.${system}) + # hyprland-packages + + hyprland + hyprland-debug + hyprland-legacy-renderer + hyprland-unwrapped + # hyprland-extras + + xdg-desktop-portal-hyprland + ; + hyprland-cross = (pkgsCrossFor.${system} "aarch64-linux").hyprland; + }); - formatter = eachSystem (system: pkgsFor.${system}.callPackage ./nix/formatter.nix { }); + devShells = eachSystem (system: { + default = + pkgsFor.${system}.mkShell.override { + inherit (self.packages.${system}.default) stdenv; + } { + name = "hyprland-shell"; + hardeningDisable = ["fortify"]; + inputsFrom = [pkgsFor.${system}.hyprland]; + packages = [pkgsFor.${system}.clang-tools]; + }; + }); - nixosModules.default = import ./nix/module.nix inputs; - homeManagerModules.default = import ./nix/hm-module.nix self; + formatter = eachSystem (system: nixpkgs.legacyPackages.${system}.alejandra); - # Hydra build jobs - # Recent versions of Hydra can aggregate jobsets from 'hydraJobs' instead of a release.nix - # or similar. Remember to filter large or incompatible attributes here. More eval jobs can - # be added by merging, e.g., self.packages // self.devShells. - hydraJobs = self.packages; - }; + nixosModules.default = import ./nix/module.nix inputs; + homeManagerModules.default = import ./nix/hm-module.nix self; + }; } diff --git a/hyprctl/CMakeLists.txt b/hyprctl/CMakeLists.txt index 7071ede9..aaffe411 100644 --- a/hyprctl/CMakeLists.txt +++ b/hyprctl/CMakeLists.txt @@ -5,32 +5,11 @@ project( DESCRIPTION "Control utility for Hyprland" ) -pkg_check_modules(hyprctl_deps REQUIRED IMPORTED_TARGET hyprutils>=0.2.4 hyprwire re2) +pkg_check_modules(deps REQUIRED IMPORTED_TARGET hyprutils>=0.1.1) -file(GLOB_RECURSE HYPRCTL_SRCFILES CONFIGURE_DEPENDS "src/*.cpp" "hw-protocols/*.cpp" "include/*.hpp") - -add_executable(hyprctl ${HYPRCTL_SRCFILES}) +add_executable(hyprctl "main.cpp") target_link_libraries(hyprctl PUBLIC PkgConfig::hyprctl_deps) -target_include_directories(hyprctl PRIVATE "hw-protocols") - -# Hyprwire - -function(hyprprotocol protoPath protoName) - set(path ${CMAKE_CURRENT_SOURCE_DIR}/${protoPath}) - add_custom_command( - OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/hw-protocols/${protoName}-client.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/hw-protocols/${protoName}-client.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/hw-protocols/${protoName}-spec.hpp - COMMAND hyprwire-scanner --client ${path}/${protoName}.xml - ${CMAKE_CURRENT_SOURCE_DIR}/hw-protocols/ - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - target_sources(hyprctl PRIVATE hw-protocols/${protoName}-client.cpp - hw-protocols/${protoName}-client.hpp - hw-protocols/${protoName}-spec.hpp) -endfunction() - -hyprprotocol(hw-protocols hyprpaper_core) # binary install(TARGETS hyprctl) diff --git a/hyprctl/src/Strings.hpp b/hyprctl/Strings.hpp similarity index 87% rename from hyprctl/src/Strings.hpp rename to hyprctl/Strings.hpp index 549d84bb..17725e77 100644 --- a/hyprctl/src/Strings.hpp +++ b/hyprctl/Strings.hpp @@ -1,7 +1,5 @@ #pragma once -#include - const std::string_view USAGE = R"#(usage: hyprctl [flags] [args...|--help] commands: @@ -22,7 +20,6 @@ commands: getoption