From 90283112bf0aa5b6a84e14b4299cc50e752d054c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Zag=C3=B3rowski?= Date: Mon, 8 May 2023 12:49:49 +0200 Subject: [PATCH] update for pkg-config --- README.md | 29 +++++++++++------------------ include/customDecoration.hpp | 2 +- include/customLayout.hpp | 2 +- include/globals.hpp | 4 ++-- src/customDecoration.cpp | 4 ++-- src/customLayout.cpp | 2 +- src/main.cpp | 4 ++-- 7 files changed, 20 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 5521b6a..e67a71b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ # Hyprland Plugin Template -# WARNING: Due to changes in the way Hyprland distributes headers, this is broken right now. The goal of this repository is to create a robust `Hyprland` plugin template, with - A working, extensible `Makefile` @@ -31,26 +30,22 @@ which is a bit more granular. > like `cannot cast from type 'void (CCompositor::*)(CWindow *, wlr_surface *)' to pointer type 'void *'` > This won't happen when building with GCC and can be ignored. -#### HYPRLAND_HEADERS -The most important part of setting up plugin builds is the `HYPRLAND_HEADERS` variable. +#### Hyprland headers +The most important part of setting up plugin builds is getting access to Hyprland headers Plugins can hook directly into Hyprland's C++ code, which is what makes them so powerful. -Because of that, they need to be able to *see* the Hyprland source. `HYPRLAND_HEADERS` ensures -that. +Because of that, they need to be able to *see* the Hyprland source. -When building your own plugins for testing, you will need to manually define it using -`export HYPRLAND_HEADERS=(PATH_TO_HYPRLAND_SOURCE_ROOT)` before running `make` commands. You -can use a local path if you keep `Hyprland` source anyway, but I'd definitely recommend using -`hyprload`. If you use your local source different from the `hyprload` one, make sure to -run `make pluginenv` in the Hyprland folder. +When building your own plugins for testing, make sure you have the pkg-config path set up correctly +and that your installation of Hyprland has the headers in `/usr/local/include/hyprland`. This +requires running `make pluginenv`. #### Hyprload, and why it's useful for plugin development -If you use `hyprload`, handing `HYPRLOAD_HEADERS` becomes a bit easier and more reliable. +If you use `hyprload`, it makes sure that the pkg-config path and headers are always available. By design it keeps a copy of Hyprland source code up to date with the Hyprland version you're -running in `$HOME/.local/share/hyprload/hyprland`, and you can use that as your -`HYPRLAND_HEADERS` path. +running in `$HOME/.local/share/hyprload/hyprland`, and builds pluginenv whenever needed. -When users install your plugin via `hyprload`, it will automatically define `HYPRLAND_HEADERS` -to that path to ensure maximum compatibility. +When users install your plugin via `hyprload`, it will also automatically set up everything +to ensure maximum compatibility. When developing plugins and frequently changing them, the `make install` command will automatically place your plugin build in the directory `hyprload` automatically loads. You can @@ -69,9 +64,7 @@ changing (I would like to streamline it somehow, but it's manageable for now) For more info, see [hyprload docs](https://github.com/Duckonaut/hyprload#format) ## Building and testing -After making sure you have defined `HYPRLAND_HEADERS` (you might need to do this *every time -you open a new terminal* if you don't put it in your `.bashrc` or `.zshrc` or whatever), the -steps to build are simple +After having the headers available, the steps to build are simple ### Manually - `make`: This will build the `PLUGIN_NAME.so` file. diff --git a/include/customDecoration.hpp b/include/customDecoration.hpp index dbd6341..4d89cfc 100644 --- a/include/customDecoration.hpp +++ b/include/customDecoration.hpp @@ -2,7 +2,7 @@ #define WLR_USE_UNSTABLE -#include +#include class CCustomDecoration : public IHyprWindowDecoration { public: diff --git a/include/customLayout.hpp b/include/customLayout.hpp index 8128128..57d0770 100644 --- a/include/customLayout.hpp +++ b/include/customLayout.hpp @@ -2,7 +2,7 @@ #define WLR_USE_UNSTABLE -#include +#include struct SWindowData { CWindow* pWindow = nullptr; diff --git a/include/globals.hpp b/include/globals.hpp index 37e8363..66c4f04 100644 --- a/include/globals.hpp +++ b/include/globals.hpp @@ -1,5 +1,5 @@ #pragma once -#include +#include -inline HANDLE PHANDLE = nullptr; \ No newline at end of file +inline HANDLE PHANDLE = nullptr; diff --git a/src/customDecoration.cpp b/src/customDecoration.cpp index fd4a76f..c579af3 100644 --- a/src/customDecoration.cpp +++ b/src/customDecoration.cpp @@ -1,6 +1,6 @@ #include "customDecoration.hpp" -#include -#include +#include +#include #include "globals.hpp" CCustomDecoration::CCustomDecoration(CWindow* pWindow) { diff --git a/src/customLayout.cpp b/src/customLayout.cpp index a3fbe78..595dd0d 100644 --- a/src/customLayout.cpp +++ b/src/customLayout.cpp @@ -1,5 +1,5 @@ #include "customLayout.hpp" -#include +#include #include "globals.hpp" void CHyprCustomLayout::onWindowCreatedTiling(CWindow* pWindow) { diff --git a/src/main.cpp b/src/main.cpp index 5e76542..a46a4d7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,8 +2,8 @@ #include "globals.hpp" -#include -#include +#include +#include #include "customLayout.hpp" #include "customDecoration.hpp"