plugins: incorporate hyprdep ABI into plugin info (#12001)
This commit is contained in:
parent
d560c26419
commit
892f642f58
3 changed files with 46 additions and 3 deletions
|
|
@ -17,7 +17,18 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
APICALL const char* __hyprland_api_get_hash() {
|
APICALL const char* __hyprland_api_get_hash() {
|
||||||
return GIT_COMMIT_HASH;
|
static auto stripPatch = [](const char* ver) -> std::string {
|
||||||
|
std::string_view v = ver;
|
||||||
|
if (!v.contains('.'))
|
||||||
|
return std::string{v};
|
||||||
|
|
||||||
|
return std::string{v.substr(0, v.find_last_of('.'))};
|
||||||
|
};
|
||||||
|
|
||||||
|
static const std::string ver = (std::string{GIT_COMMIT_HASH} + "_aq_" + stripPatch(AQUAMARINE_VERSION) + "_hu_" + stripPatch(HYPRUTILS_VERSION) + "_hg_" +
|
||||||
|
stripPatch(HYPRGRAPHICS_VERSION) + "_hc_" + stripPatch(HYPRCURSOR_VERSION) + "_hlg_" + stripPatch(HYPRLANG_VERSION));
|
||||||
|
|
||||||
|
return ver.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
APICALL SP<HOOK_CALLBACK_FN> HyprlandAPI::registerCallbackDynamic(HANDLE handle, const std::string& event, HOOK_CALLBACK_FN fn) {
|
APICALL SP<HOOK_CALLBACK_FN> HyprlandAPI::registerCallbackDynamic(HANDLE handle, const std::string& event, HOOK_CALLBACK_FN fn) {
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ Feel like the API is missing something you'd like to use in your plugin? Open an
|
||||||
#include <any>
|
#include <any>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
#include <hyprlang.hpp>
|
#include <hyprlang.hpp>
|
||||||
|
|
||||||
using PLUGIN_DESCRIPTION_INFO = struct {
|
using PLUGIN_DESCRIPTION_INFO = struct {
|
||||||
|
|
@ -309,7 +310,7 @@ namespace HyprlandAPI {
|
||||||
|
|
||||||
// NOLINTBEGIN
|
// NOLINTBEGIN
|
||||||
/*
|
/*
|
||||||
Get the hash this plugin/server was compiled with.
|
Get the descriptive string this plugin/server was compiled with.
|
||||||
|
|
||||||
This function will end up in both hyprland and any/all plugins,
|
This function will end up in both hyprland and any/all plugins,
|
||||||
and can be found by a simple dlsym()
|
and can be found by a simple dlsym()
|
||||||
|
|
@ -319,7 +320,18 @@ namespace HyprlandAPI {
|
||||||
*/
|
*/
|
||||||
APICALL EXPORT const char* __hyprland_api_get_hash();
|
APICALL EXPORT const char* __hyprland_api_get_hash();
|
||||||
APICALL inline EXPORT const char* __hyprland_api_get_client_hash() {
|
APICALL inline EXPORT const char* __hyprland_api_get_client_hash() {
|
||||||
return GIT_COMMIT_HASH;
|
static auto stripPatch = [](const char* ver) -> std::string {
|
||||||
|
std::string_view v = ver;
|
||||||
|
if (!v.contains('.'))
|
||||||
|
return std::string{v};
|
||||||
|
|
||||||
|
return std::string{v.substr(0, v.find_last_of('.'))};
|
||||||
|
};
|
||||||
|
|
||||||
|
static const std::string ver = (std::string{GIT_COMMIT_HASH} + "_aq_" + stripPatch(AQUAMARINE_VERSION) + "_hu_" + stripPatch(HYPRUTILS_VERSION) + "_hg_" +
|
||||||
|
stripPatch(HYPRGRAPHICS_VERSION) + "_hc_" + stripPatch(HYPRCURSOR_VERSION) + "_hlg_" + stripPatch(HYPRLANG_VERSION));
|
||||||
|
|
||||||
|
return ver.c_str();
|
||||||
}
|
}
|
||||||
// NOLINTEND
|
// NOLINTEND
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,3 +6,23 @@
|
||||||
#define GIT_DIRTY "@DIRTY@"
|
#define GIT_DIRTY "@DIRTY@"
|
||||||
#define GIT_TAG "@TAG@"
|
#define GIT_TAG "@TAG@"
|
||||||
#define GIT_COMMITS "@COMMITS@"
|
#define GIT_COMMITS "@COMMITS@"
|
||||||
|
|
||||||
|
#ifndef HYPRCURSOR_VERSION
|
||||||
|
#define HYPRCURSOR_VERSION "@HYPRCURSOR_VERSION@"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HYPRGRAPHICS_VERSION
|
||||||
|
#define HYPRGRAPHICS_VERSION "@HYPRGRAPHICS_VERSION@"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HYPRLANG_VERSION
|
||||||
|
#define HYPRLANG_VERSION "@HYPRLANG_VERSION@"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HYPRUTILS_VERSION
|
||||||
|
#define HYPRUTILS_VERSION "@HYPRUTILS_VERSION@"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef AQUAMARINE_VERSION
|
||||||
|
#define AQUAMARINE_VERSION "@AQUAMARINE_VERSION@"
|
||||||
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue