# What Programming Language Is Hyprland Written In? Inside the C++20 Wayland Codebase

> Discover the programming language behind Hyprland. Explore the C++20 Wayland compositor and its modern codebase. Understand the technology driving this dynamic window manager.

- Repository: [Hypr Development/Hyprland](https://github.com/hyprwm/Hyprland)
- Tags: internals
- Published: 2026-07-29

---

**Hyprland is implemented entirely in modern C++20**, utilizing the CMake build system and extensive C++ Standard Library features across its Wayland compositor architecture.

The hyprwm/Hyprland repository is a high-performance Wayland compositor whose core is written in native C++. By examining the source tree, you will find `.cpp` implementation files and `.hpp` headers that leverage C++20 capabilities, smart pointers, and standard library containers to manage complex window state and rendering pipelines.

## C++20 as the Core Language

Hyprland is explicitly configured to compile as **C++20**. In the root [`CMakeLists.txt`](https://github.com/hyprwm/Hyprland/blob/main/CMakeLists.txt), the project sets the `-std=c++20` compiler flag (lines 20-26), which enables modern language features required throughout the codebase. This standard unlocks `std::format` for string formatting, `constexpr` compile-time evaluation, and improved lambda captures.

The compositor makes heavy use of **C++ Standard Library** idioms. Throughout [`src/Compositor.cpp`](https://github.com/hyprwm/Hyprland/blob/main/src/Compositor.cpp) and [`src/Compositor.hpp`](https://github.com/hyprwm/Hyprland/blob/main/src/Compositor.hpp), you will find `std::unique_ptr` and `std::shared_ptr` managing Wayland object lifecycles, `std::vector` and `std::string` handling dynamic data, and range-based `for` loops iterating over window collections. These patterns confirm a modern C++ philosophy rather than traditional C-style memory management.

## Key Source Files Demonstrating C++ Usage

Several critical files illustrate Hyprland’s commitment to C++:

- **[`src/Compositor.cpp`](https://github.com/hyprwm/Hyprland/blob/main/src/Compositor.cpp)** – The main compositor implementation featuring class definitions, namespace scoping, and STL containers like `std::unordered_map` for client tracking.
- **[`src/Compositor.hpp`](https://github.com/hyprwm/Hyprland/blob/main/src/Compositor.hpp)** – Header file declaring the `CCompositor` class with inline methods, template usage, and C++ access specifiers.
- **[`src/includes.hpp`](https://github.com/hyprwm/Hyprland/blob/main/src/includes.hpp)** – Central header aggregating C++ utility headers and forward declarations using `#pragma once` guards.
- **[`src/defines.hpp`](https://github.com/hyprwm/Hyprland/blob/main/src/defines.hpp)** – Macro definitions and `enum class` declarations scoped within C++ namespaces.
- **[`src/init/initHelpers.cpp`](https://github.com/hyprwm/Hyprland/blob/main/src/init/initHelpers.cpp)** – Initialization routines using `<filesystem>` and `<chrono>` from the C++20 standard library.
- **[`hyprpm/CMakeLists.txt`](https://github.com/hyprwm/Hyprland/blob/main/hyprpm/CMakeLists.txt)** – Proves that even the Hyprland package manager sub-module is built as C++.

## Modern C++ Features in Practice

Hyprland employs specific C++20 and modern C++ patterns that distinguish it from C-based compositors:

**Memory Management via RAII** – The codebase eschews raw pointers for `std::unique_ptr` and `std::shared_ptr`, ensuring automatic resource cleanup when compositor objects go out of scope.

**Template Metaprogramming** – Utilities in `src/helpers/` use function templates and class templates for type-safe callbacks and event handlers.

**Standard Library Algorithms** – Rather than manual loops, Hyprland uses `std::ranges` algorithms and `std::find_if` for window lookup operations.

## Code Examples from the Hyprland Source

Below are representative patterns found in the repository, demonstrating how Hyprland utilizes C++:

### Logger Implementation Using Hyprutils

This pattern mirrors the logging found in [`src/Compositor.cpp`](https://github.com/hyprwm/Hyprland/blob/main/src/Compositor.cpp), using the `Hyprutils::String::format` helper:

```cpp
#include <hyprutils/string/String.hpp>
#include <iostream>

int main() {
    const std::string msg = "Hyprland logger test";
    std::cout << Hyprutils::String::format("[DEBUG] {}\n", msg);
    return 0;
}

```

### Wayland Server Initialization

The core event loop structure matches `CCompositor::initServer()`, showing raw Wayland C API wrapped in C++ control flow:

```cpp
#include <wayland-server-core.h>

int main() {
    wl_display *display = wl_display_create();
    wl_display_add_socket_auto(display);
    wl_display_run(display);   // event loop – same pattern used in CCompositor::initServer()
    wl_display_destroy(display);
    return 0;
}

```

### C++20 std::format for Instance Signatures

Hyprland generates unique instance signatures in the `CCompositor` constructor using formatting similar to this:

```cpp
#include <format>
#include <iostream>

int main() {
    std::string instance = std::format("{}_{:%Y%m%d_%H%M%S}", "Hyprland", std::chrono::system_clock::now());
    std::cout << "Instance signature: " << instance << '\n';
    return 0;
}

```

### Plugin System with Smart Pointers

The plugin architecture in [`plugins/PluginSystem.hpp`](https://github.com/hyprwm/Hyprland/blob/main/plugins/PluginSystem.hpp) uses `std::unique_ptr` for automatic memory management:

```cpp
#include "plugins/PluginSystem.hpp"

int main() {
    auto pluginSystem = std::make_unique<CPluginSystem>();
    pluginSystem->load("myplugin.so");   // loads a shared object compiled as C++
    return 0;
}

```

## Build System Configuration

Hyprland relies on **CMake** as its native build system for C++ projects. The top-level [`CMakeLists.txt`](https://github.com/hyprwm/Hyprland/blob/main/CMakeLists.txt) not only enforces the C++20 standard but also links against C++ libraries like `hyprutils` and `hyprlang`. The build process compiles dozens of `.cpp` files in `src/` into a single native binary, linking with Wayland and DRM libraries via C++ linkage.

## Summary

- Hyprland is written in **C++20**, confirmed by the `-std=c++20` flag in [`CMakeLists.txt`](https://github.com/hyprwm/Hyprland/blob/main/CMakeLists.txt).
- Core implementation resides in `.cpp` files like [`src/Compositor.cpp`](https://github.com/hyprwm/Hyprland/blob/main/src/Compositor.cpp), using classes and smart pointers.
- The codebase leverages **RAII**, **templates**, and **STL containers** for memory-safe window management.
- **CMake** handles compilation of the pure C++ source tree, including sub-modules like `hyprpm`.

## Frequently Asked Questions

### Is Hyprland written in C or C++?

Hyprland is written in **C++**, not C. While it interfaces with C-based system libraries like Wayland and libdrm, the compositor core uses C++ classes, namespaces, and the standard library. All source files use `.cpp` and `.hpp` extensions, and the project requires a C++20 compiler.

### What C++ standard version does Hyprland require?

Hyprland requires **C++20**. The build configuration explicitly sets this standard in [`CMakeLists.txt`](https://github.com/hyprwm/Hyprland/blob/main/CMakeLists.txt), enabling features like `std::format`, `constexpr` functions, and designated initializers. Compiling with C++17 or earlier would result in build failures due to missing language features used in [`src/init/initHelpers.cpp`](https://github.com/hyprwm/Hyprland/blob/main/src/init/initHelpers.cpp) and other files.

### Why does Hyprland use C++ instead of C?

The developers chose C++ to gain **zero-cost abstractions** and **type safety** through RAII (Resource Acquisition Is Initialization). Using `std::unique_ptr` and `std::shared_ptr` eliminates manual memory management errors, while C++ templates provide compile-time polymorphism for event handling and rendering logic that would be verbose and error-prone in C.

### Are there other programming languages used in Hyprland?

The core compositor and its tools are **exclusively C++**. While Hyprland parses configuration files written in its own custom syntax, the parser implementation in `src/config/` is itself C++. Even auxiliary tools like `hyprpm` (the package manager) are built from C++ source, as evidenced by [`hyprpm/CMakeLists.txt`](https://github.com/hyprwm/Hyprland/blob/main/hyprpm/CMakeLists.txt). There is no Rust, Python, or other language in the critical rendering path.