2024-02-20 21:16:07 +01:00
|
|
|
---
|
2024-04-16 21:32:40 +02:00
|
|
|
weight: 13
|
2024-02-20 21:16:07 +01:00
|
|
|
title: Contributing and Debugging
|
|
|
|
---
|
|
|
|
|
2022-08-12 20:46:36 +02:00
|
|
|
# Contributing guidelines
|
|
|
|
|
2024-03-17 13:44:39 +01:00
|
|
|
PR, code styling and code FAQs are [here](./PR-Guidelines)
|
2022-08-12 20:46:36 +02:00
|
|
|
|
|
|
|
For issues, please see
|
|
|
|
[the guidelines](https://github.com/hyprwm/Hyprland/blob/main/docs/ISSUE_GUIDELINES.md)
|
|
|
|
|
2022-10-23 16:35:39 +02:00
|
|
|
## Build in debug mode
|
2022-08-12 20:46:36 +02:00
|
|
|
|
2022-10-23 16:35:39 +02:00
|
|
|
### Required packages
|
2022-08-12 20:46:36 +02:00
|
|
|
|
|
|
|
`xcb` stuff, check with your local package provider.
|
|
|
|
|
|
|
|
`wayland` - of course.
|
|
|
|
|
2022-10-23 16:35:39 +02:00
|
|
|
_Arch_:
|
2022-08-12 20:46:36 +02:00
|
|
|
|
2023-12-08 19:14:36 +01:00
|
|
|
`yay -S gdb ninja gcc cmake libxcb xcb-proto xcb-util xcb-util-keysyms libxfixes libx11 libxcomposite xorg-xinput libxrender pixman wayland-protocols cairo pango seatd tomlplusplus`
|
2022-08-12 20:46:36 +02:00
|
|
|
|
|
|
|
(If any are missing hmu)
|
|
|
|
|
2022-10-23 16:35:39 +02:00
|
|
|
### Recommended, CMake
|
2022-08-12 20:46:36 +02:00
|
|
|
|
2022-08-13 19:38:30 +02:00
|
|
|
Install the VSCode C/C++ and CMake Tools extensions and use that.
|
2022-08-12 20:46:36 +02:00
|
|
|
|
2024-02-20 21:16:07 +01:00
|
|
|
I've attached a
|
|
|
|
[example/launch.json](https://github.com/hyprwm/Hyprland/blob/main/example/launch.json)
|
2022-08-13 19:38:30 +02:00
|
|
|
that you can copy to your .vscode/ folder in the repo root.
|
2022-08-12 20:46:36 +02:00
|
|
|
|
|
|
|
With that, you can build in debug, go to the debugging tab and hit
|
|
|
|
`(gdb) Launch`.
|
|
|
|
|
2024-05-05 22:45:06 +02:00
|
|
|
*note:* You probably want to set `watchdog_timeout = 0` in the debug {} section
|
|
|
|
of your config. Otherwise Hyprland will notice its hanging when you hit a
|
|
|
|
breakpoint and it will crash after you continue out of it.
|
|
|
|
|
2022-10-23 16:35:39 +02:00
|
|
|
### Custom, CLI
|
2022-08-12 20:46:36 +02:00
|
|
|
|
|
|
|
`make debug`
|
|
|
|
|
2024-04-21 16:35:48 +02:00
|
|
|
Attach and profile in your preferred way.
|
2022-08-12 20:46:36 +02:00
|
|
|
|
2023-09-04 21:30:00 +02:00
|
|
|
### Meson
|
|
|
|
|
|
|
|
```console
|
|
|
|
meson setup build -Dbuildtype=debug
|
|
|
|
ninja -C build
|
|
|
|
```
|
|
|
|
|
|
|
|
### Nix
|
|
|
|
|
|
|
|
To build the package in debug mode, you have to override it like this:
|
|
|
|
|
|
|
|
```nix
|
|
|
|
hyprland.override {
|
|
|
|
debug = true;
|
|
|
|
};
|
|
|
|
```
|
|
|
|
|
|
|
|
This code can go in the `package` attribute of the NixOS/Home Manager modules.
|
|
|
|
|
2022-10-23 16:35:39 +02:00
|
|
|
## Running
|
2022-08-12 20:46:36 +02:00
|
|
|
|
2024-04-21 16:35:48 +02:00
|
|
|
When running Hyprland in Debug mode, the config is
|
2022-08-12 20:46:36 +02:00
|
|
|
`~/.config/hypr/hyprlandd.conf` and the logs can be found at
|
2024-04-28 23:25:40 +02:00
|
|
|
`$XDG_RUNTIME_DIR/hypr/[INSTANCE SIGNATURE]/hyprlandd.log`.
|
2022-08-12 20:46:36 +02:00
|
|
|
|
2024-05-05 22:45:06 +02:00
|
|
|
## LSP and Formatting
|
|
|
|
|
|
|
|
If you want proper LSP support in an editor that doesn't automatically set it
|
|
|
|
up, use clangd. You'll probably notice there will be a bunch of warnings
|
|
|
|
because we haven't generated compile commands, to do this run:
|
|
|
|
|
|
|
|
```
|
|
|
|
cmake -S . -B build/ -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
|
|
|
```
|
|
|
|
|
|
|
|
Also, before submitting a PR please format with clang-format, to run this only
|
|
|
|
on your changes run `git-clang-format` in your projects root directory.
|
|
|
|
|
2022-10-23 16:35:39 +02:00
|
|
|
## Logs, dumps, etc
|
2022-08-12 20:46:36 +02:00
|
|
|
|
|
|
|
You can use the logs and the GDB debugger, but running Hyprland in debug compile
|
|
|
|
as a driver and using it for a while might give more insight to the more random
|
|
|
|
bugs.
|
|
|
|
|
|
|
|
When Hyprland crashes, use `coredumpctl` and then `coredumpctl info PID` to see
|
2022-10-23 16:35:39 +02:00
|
|
|
the dump. See the instructions below for more info about `coredumpctl`.
|
2022-08-12 20:46:36 +02:00
|
|
|
|
2022-10-23 16:35:39 +02:00
|
|
|
You can also use the amazing command
|
2022-08-12 20:46:36 +02:00
|
|
|
|
2022-08-13 19:38:30 +02:00
|
|
|
```sh
|
2024-04-28 23:25:40 +02:00
|
|
|
watch -n 0.1 "grep -v \"arranged\" $XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/hyprland.log | tail -n 40"
|
2022-08-13 19:38:30 +02:00
|
|
|
```
|
2022-08-12 20:46:36 +02:00
|
|
|
|
|
|
|
for live logs. (replace `hyprland` with `hyprlandd` for debug builds)
|
|
|
|
|
2022-10-23 16:35:39 +02:00
|
|
|
### How do I get a coredump?
|
|
|
|
|
2024-02-20 21:16:07 +01:00
|
|
|
See
|
|
|
|
[`ISSUE_GUIDELINES.md`](https://github.com/hyprwm/Hyprland/blob/main/docs/ISSUE_GUIDELINES.md).
|
2022-10-23 16:35:39 +02:00
|
|
|
|
|
|
|
## Nesting Hyprland
|
2022-08-12 20:46:36 +02:00
|
|
|
|
|
|
|
Hyprland can run nested in a window. For that, make sure you did the following:
|
|
|
|
|
2022-08-13 01:47:48 +02:00
|
|
|
- built in debug
|
|
|
|
- removed ALL `exec=` and `exec-once=` keywords from your debug config
|
|
|
|
(`hyprlandd.conf`)
|
2023-02-27 13:32:56 +01:00
|
|
|
- set a resolution for `WL-1` and are not using `preferred`
|
2024-02-20 21:16:07 +01:00
|
|
|
- made sure no keybinds overlap (use a different mod for your keybinds
|
|
|
|
altogether)
|
2022-08-12 20:46:36 +02:00
|
|
|
|
2024-02-20 21:16:07 +01:00
|
|
|
Once you launch, the display might be cropped. This can be fixed by setting the
|
|
|
|
resolution for `WL-1` to the exact dimensions of the window as reported by
|
|
|
|
`hyprctl clients`.
|