all: chase hyprland (#252)

This commit is contained in:
Amaan Qureshi 2024-12-04 09:58:09 -05:00 committed by GitHub
parent 0bc619b2c3
commit 2530394e67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 74 additions and 74 deletions

View file

@ -59,7 +59,7 @@ std::string CBordersPlusPlus::getDisplayName() {
return "Borders++"; return "Borders++";
} }
void CBordersPlusPlus::draw(PHLMONITOR pMonitor, const float &a) { void CBordersPlusPlus::draw(PHLMONITOR pMonitor, const float& a) {
if (!validMapped(m_pWindow)) if (!validMapped(m_pWindow))
return; return;
@ -125,7 +125,7 @@ void CBordersPlusPlus::draw(PHLMONITOR pMonitor, const float &a) {
g_pHyprOpenGL->scissor((CBox*)nullptr); g_pHyprOpenGL->scissor((CBox*)nullptr);
g_pHyprOpenGL->renderBorder(&fullBox, CColor{(uint64_t) * *PCOLORS[i]}, **PNATURALROUND ? ORIGINALROUND : rounding, THISBORDERSIZE, a, g_pHyprOpenGL->renderBorder(&fullBox, CHyprColor{(uint64_t)**PCOLORS[i]}, **PNATURALROUND ? ORIGINALROUND : rounding, THISBORDERSIZE, a,
**PNATURALROUND ? ORIGINALROUND : -1); **PNATURALROUND ? ORIGINALROUND : -1);
} }

View file

@ -2,4 +2,4 @@
#include <hyprland/src/plugins/PluginAPI.hpp> #include <hyprland/src/plugins/PluginAPI.hpp>
inline HANDLE PHANDLE = nullptr; inline HANDLE PHANDLE = nullptr;

View file

@ -29,7 +29,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
if (HASH != GIT_COMMIT_HASH) { if (HASH != GIT_COMMIT_HASH) {
HyprlandAPI::addNotification(PHANDLE, "[borders-plus-plus] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)", HyprlandAPI::addNotification(PHANDLE, "[borders-plus-plus] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)",
CColor{1.0, 0.2, 0.2, 1.0}, 5000); CHyprColor{1.0, 0.2, 0.2, 1.0}, 5000);
throw std::runtime_error("[bpp] Version mismatch"); throw std::runtime_error("[bpp] Version mismatch");
} }
@ -53,7 +53,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
HyprlandAPI::addWindowDecoration(PHANDLE, w, std::make_unique<CBordersPlusPlus>(w)); HyprlandAPI::addWindowDecoration(PHANDLE, w, std::make_unique<CBordersPlusPlus>(w));
} }
HyprlandAPI::addNotification(PHANDLE, "[borders-plus-plus] Initialized successfully!", CColor{0.2, 1.0, 0.2, 1.0}, 5000); HyprlandAPI::addNotification(PHANDLE, "[borders-plus-plus] Initialized successfully!", CHyprColor{0.2, 1.0, 0.2, 1.0}, 5000);
return {"borders-plus-plus", "A plugin to add more borders to windows.", "Vaxry", "1.0"}; return {"borders-plus-plus", "A plugin to add more borders to windows.", "Vaxry", "1.0"};
} }

View file

@ -88,7 +88,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
if (HASH != GIT_COMMIT_HASH) { if (HASH != GIT_COMMIT_HASH) {
HyprlandAPI::addNotification(PHANDLE, "[csgo-vulkan-fix] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)", HyprlandAPI::addNotification(PHANDLE, "[csgo-vulkan-fix] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)",
CColor{1.0, 0.2, 0.2, 1.0}, 5000); CHyprColor{1.0, 0.2, 0.2, 1.0}, 5000);
throw std::runtime_error("[vkfix] Version mismatch"); throw std::runtime_error("[vkfix] Version mismatch");
} }
@ -126,7 +126,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
bool success = g_pSurfaceSizeHook && g_pWLSurfaceDamageHook && g_pMouseMotionHook; bool success = g_pSurfaceSizeHook && g_pWLSurfaceDamageHook && g_pMouseMotionHook;
if (!success) { if (!success) {
HyprlandAPI::addNotification(PHANDLE, "[csgo-vulkan-fix] Failure in initialization: Failed to find required hook fns", CColor{1.0, 0.2, 0.2, 1.0}, 5000); HyprlandAPI::addNotification(PHANDLE, "[csgo-vulkan-fix] Failure in initialization: Failed to find required hook fns", CHyprColor{1.0, 0.2, 0.2, 1.0}, 5000);
throw std::runtime_error("[vkfix] Hooks fn init failed"); throw std::runtime_error("[vkfix] Hooks fn init failed");
} }
@ -135,9 +135,9 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
success = success && g_pSurfaceSizeHook->hook(); success = success && g_pSurfaceSizeHook->hook();
if (success) if (success)
HyprlandAPI::addNotification(PHANDLE, "[csgo-vulkan-fix] Initialized successfully! (Anything version)", CColor{0.2, 1.0, 0.2, 1.0}, 5000); HyprlandAPI::addNotification(PHANDLE, "[csgo-vulkan-fix] Initialized successfully! (Anything version)", CHyprColor{0.2, 1.0, 0.2, 1.0}, 5000);
else { else {
HyprlandAPI::addNotification(PHANDLE, "[csgo-vulkan-fix] Failure in initialization (hook failed)!", CColor{1.0, 0.2, 0.2, 1.0}, 5000); HyprlandAPI::addNotification(PHANDLE, "[csgo-vulkan-fix] Failure in initialization (hook failed)!", CHyprColor{1.0, 0.2, 0.2, 1.0}, 5000);
throw std::runtime_error("[csgo-vk-fix] Hooks failed"); throw std::runtime_error("[csgo-vk-fix] Hooks failed");
} }

View file

@ -138,7 +138,7 @@ void CHyprBar::onMouseMove(Vector2D coords) {
} }
} }
void CHyprBar::renderText(SP<CTexture> out, const std::string& text, const CColor& color, const Vector2D& bufferSize, const float scale, const int fontSize) { void CHyprBar::renderText(SP<CTexture> out, const std::string& text, const CHyprColor& color, const Vector2D& bufferSize, const float scale, const int fontSize) {
const auto CAIROSURFACE = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, bufferSize.x, bufferSize.y); const auto CAIROSURFACE = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, bufferSize.x, bufferSize.y);
const auto CAIRO = cairo_create(CAIROSURFACE); const auto CAIRO = cairo_create(CAIROSURFACE);
@ -215,16 +215,16 @@ void CHyprBar::renderBarTitle(const Vector2D& bufferSize, const float scale) {
buttonSizes += b.size + **PBARBUTTONPADDING; buttonSizes += b.size + **PBARBUTTONPADDING;
} }
const auto scaledSize = **PSIZE * scale; const auto scaledSize = **PSIZE * scale;
const auto scaledBorderSize = BORDERSIZE * scale; const auto scaledBorderSize = BORDERSIZE * scale;
const auto scaledButtonsSize = buttonSizes * scale; const auto scaledButtonsSize = buttonSizes * scale;
const auto scaledButtonsPad = **PBARBUTTONPADDING * scale; const auto scaledButtonsPad = **PBARBUTTONPADDING * scale;
const auto scaledBarPadding = **PBARPADDING * scale; const auto scaledBarPadding = **PBARPADDING * scale;
const CColor COLOR = m_bForcedTitleColor.value_or(**PCOLOR); const CHyprColor COLOR = m_bForcedTitleColor.value_or(**PCOLOR);
const auto CAIROSURFACE = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, bufferSize.x, bufferSize.y); const auto CAIROSURFACE = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, bufferSize.x, bufferSize.y);
const auto CAIRO = cairo_create(CAIROSURFACE); const auto CAIRO = cairo_create(CAIROSURFACE);
// clear the pixmap // clear the pixmap
cairo_save(CAIRO); cairo_save(CAIRO);
@ -365,7 +365,7 @@ void CHyprBar::renderBarButtonsText(CBox* barBox, const float scale, const float
const bool LIGHT = button.col.r + button.col.g + button.col.b < 1; const bool LIGHT = button.col.r + button.col.g + button.col.b < 1;
renderText(button.iconTex, button.icon, LIGHT ? CColor(0xFFFFFFFF) : CColor(0xFF000000), BUFSIZE, scale, button.size * 0.62); renderText(button.iconTex, button.icon, LIGHT ? CHyprColor(0xFFFFFFFF) : CHyprColor(0xFF000000), BUFSIZE, scale, button.size * 0.62);
} }
if (button.iconTex->m_iTexID == 0) if (button.iconTex->m_iTexID == 0)
@ -384,7 +384,7 @@ void CHyprBar::renderBarButtonsText(CBox* barBox, const float scale, const float
} }
} }
void CHyprBar::draw(PHLMONITOR pMonitor, const float &a) { void CHyprBar::draw(PHLMONITOR pMonitor, const float& a) {
if (m_bHidden || !validMapped(m_pWindow)) if (m_bHidden || !validMapped(m_pWindow))
return; return;
@ -413,7 +413,7 @@ void CHyprBar::draw(PHLMONITOR pMonitor, const float &a) {
const auto scaledRounding = ROUNDING > 0 ? ROUNDING * pMonitor->scale - 2 /* idk why but otherwise it looks bad due to the gaps */ : 0; const auto scaledRounding = ROUNDING > 0 ? ROUNDING * pMonitor->scale - 2 /* idk why but otherwise it looks bad due to the gaps */ : 0;
CColor color = m_bForcedBarColor.value_or(**PCOLOR); CHyprColor color = m_bForcedBarColor.value_or(**PCOLOR);
color.a *= a; color.a *= a;
m_seExtents = {{0, **PHEIGHT}, {}}; m_seExtents = {{0, **PHEIGHT}, {}};
@ -452,7 +452,7 @@ void CHyprBar::draw(PHLMONITOR pMonitor, const float &a) {
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
windowBox.translate(WORKSPACEOFFSET).scale(pMonitor->scale).round(); windowBox.translate(WORKSPACEOFFSET).scale(pMonitor->scale).round();
g_pHyprOpenGL->renderRect(&windowBox, CColor(0, 0, 0, 0), scaledRounding); g_pHyprOpenGL->renderRect(&windowBox, CHyprColor(0, 0, 0, 0), scaledRounding);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glStencilFunc(GL_NOTEQUAL, 1, -1); glStencilFunc(GL_NOTEQUAL, 1, -1);
@ -568,7 +568,7 @@ void CHyprBar::applyRule(const SWindowRule& r) {
if (r.szRule == "plugin:hyprbars:nobar") if (r.szRule == "plugin:hyprbars:nobar")
m_bHidden = true; m_bHidden = true;
else if (r.szRule.starts_with("plugin:hyprbars:bar_color")) else if (r.szRule.starts_with("plugin:hyprbars:bar_color"))
m_bForcedBarColor = CColor(configStringToInt(arg).value_or(0)); m_bForcedBarColor = CHyprColor(configStringToInt(arg).value_or(0));
else if (r.szRule.starts_with("plugin:hyprbars:title_color")) else if (r.szRule.starts_with("plugin:hyprbars:title_color"))
m_bForcedTitleColor = CColor(configStringToInt(arg).value_or(0)); m_bForcedTitleColor = CHyprColor(configStringToInt(arg).value_or(0));
} }

View file

@ -38,39 +38,39 @@ class CHyprBar : public IHyprWindowDecoration {
void applyRule(const SWindowRule&); void applyRule(const SWindowRule&);
private: private:
SBoxExtents m_seExtents; SBoxExtents m_seExtents;
PHLWINDOWREF m_pWindow; PHLWINDOWREF m_pWindow;
CBox m_bAssignedBox; CBox m_bAssignedBox;
SP<CTexture> m_pTextTex; SP<CTexture> m_pTextTex;
SP<CTexture> m_pButtonsTex; SP<CTexture> m_pButtonsTex;
bool m_bWindowSizeChanged = false; bool m_bWindowSizeChanged = false;
bool m_bHidden = false; bool m_bHidden = false;
bool m_bTitleColorChanged = false; bool m_bTitleColorChanged = false;
std::optional<CColor> m_bForcedBarColor; std::optional<CHyprColor> m_bForcedBarColor;
std::optional<CColor> m_bForcedTitleColor; std::optional<CHyprColor> m_bForcedTitleColor;
Vector2D cursorRelativeToBar(); Vector2D cursorRelativeToBar();
void renderBarTitle(const Vector2D& bufferSize, const float scale); void renderBarTitle(const Vector2D& bufferSize, const float scale);
void renderText(SP<CTexture> out, const std::string& text, const CColor& color, const Vector2D& bufferSize, const float scale, const int fontSize); void renderText(SP<CTexture> out, const std::string& text, const CHyprColor& color, const Vector2D& bufferSize, const float scale, const int fontSize);
void renderBarButtons(const Vector2D& bufferSize, const float scale); void renderBarButtons(const Vector2D& bufferSize, const float scale);
void renderBarButtonsText(CBox* barBox, const float scale, const float a); void renderBarButtonsText(CBox* barBox, const float scale, const float a);
void onMouseDown(SCallbackInfo& info, IPointer::SButtonEvent e); void onMouseDown(SCallbackInfo& info, IPointer::SButtonEvent e);
void onMouseMove(Vector2D coords); void onMouseMove(Vector2D coords);
CBox assignedBoxGlobal(); CBox assignedBoxGlobal();
SP<HOOK_CALLBACK_FN> m_pMouseButtonCallback; SP<HOOK_CALLBACK_FN> m_pMouseButtonCallback;
SP<HOOK_CALLBACK_FN> m_pMouseMoveCallback; SP<HOOK_CALLBACK_FN> m_pMouseMoveCallback;
std::string m_szLastTitle; std::string m_szLastTitle;
bool m_bDraggingThis = false; bool m_bDraggingThis = false;
bool m_bDragPending = false; bool m_bDragPending = false;
bool m_bCancelledDown = false; bool m_bCancelledDown = false;
// for dynamic updates // for dynamic updates
int m_iLastHeight = 0; int m_iLastHeight = 0;

View file

@ -7,7 +7,7 @@ inline HANDLE PHANDLE = nullptr;
struct SHyprButton { struct SHyprButton {
std::string cmd = ""; std::string cmd = "";
CColor col = CColor(0, 0, 0, 0); CHyprColor col = CHyprColor(0, 0, 0, 0);
float size = 10; float size = 10;
std::string icon = ""; std::string icon = "";
SP<CTexture> iconTex = makeShared<CTexture>(); SP<CTexture> iconTex = makeShared<CTexture>();
@ -20,4 +20,4 @@ struct SGlobalState {
std::vector<CHyprBar*> bars; std::vector<CHyprBar*> bars;
}; };
inline std::unique_ptr<SGlobalState> g_pGlobalState; inline std::unique_ptr<SGlobalState> g_pGlobalState;

View file

@ -95,7 +95,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
if (HASH != GIT_COMMIT_HASH) { if (HASH != GIT_COMMIT_HASH) {
HyprlandAPI::addNotification(PHANDLE, "[hyprbars] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)", HyprlandAPI::addNotification(PHANDLE, "[hyprbars] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)",
CColor{1.0, 0.2, 0.2, 1.0}, 5000); CHyprColor{1.0, 0.2, 0.2, 1.0}, 5000);
throw std::runtime_error("[hb] Version mismatch"); throw std::runtime_error("[hb] Version mismatch");
} }
@ -132,7 +132,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
HyprlandAPI::reloadConfig(); HyprlandAPI::reloadConfig();
HyprlandAPI::addNotification(PHANDLE, "[hyprbars] Initialized successfully!", CColor{0.2, 1.0, 0.2, 1.0}, 5000); HyprlandAPI::addNotification(PHANDLE, "[hyprbars] Initialized successfully!", CHyprColor{0.2, 1.0, 0.2, 1.0}, 5000);
return {"hyprbars", "A plugin to add title bars to windows.", "Vaxry", "1.0"}; return {"hyprbars", "A plugin to add title bars to windows.", "Vaxry", "1.0"};
} }

View file

@ -155,7 +155,7 @@ static void onExpoDispatcher(std::string arg) {
} }
static void failNotif(const std::string& reason) { static void failNotif(const std::string& reason) {
HyprlandAPI::addNotification(PHANDLE, "[hyprexpo] Failure in initialization: " + reason, CColor{1.0, 0.2, 0.2, 1.0}, 5000); HyprlandAPI::addNotification(PHANDLE, "[hyprexpo] Failure in initialization: " + reason, CHyprColor{1.0, 0.2, 0.2, 1.0}, 5000);
} }
APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {

View file

@ -35,13 +35,13 @@ COverview::COverview(PHLWORKSPACE startedOn_, bool swipe_) : startedOn(startedOn
BG_COLOR = **PCOL; BG_COLOR = **PCOL;
// process the method // process the method
bool methodCenter = true; bool methodCenter = true;
int methodStartID = pMonitor->activeWorkspaceID(); int methodStartID = pMonitor->activeWorkspaceID();
CVarList method{*PMETHOD, 0, 's', true}; CVarList method{*PMETHOD, 0, 's', true};
if (method.size() < 2) if (method.size() < 2)
Debug::log(ERR, "[he] invalid workspace_method"); Debug::log(ERR, "[he] invalid workspace_method");
else { else {
methodCenter = method[0] == "center"; methodCenter = method[0] == "center";
methodStartID = getWorkspaceIDNameFromString(method[1]).id; methodStartID = getWorkspaceIDNameFromString(method[1]).id;
if (methodStartID == WORKSPACE_INVALID) if (methodStartID == WORKSPACE_INVALID)
methodStartID = pMonitor->activeWorkspaceID(); methodStartID = pMonitor->activeWorkspaceID();
@ -65,7 +65,7 @@ COverview::COverview(PHLWORKSPACE startedOn_, bool swipe_) : startedOn(startedOn
} }
for (size_t i = 0; i < SIDE_LENGTH * SIDE_LENGTH; ++i) { for (size_t i = 0; i < SIDE_LENGTH * SIDE_LENGTH; ++i) {
auto& image = images[i]; auto& image = images[i];
currentID = currentID =
getWorkspaceIDNameFromString("r" + ((int64_t)i - backtracked < 0 ? std::to_string((int64_t)i - backtracked) : "+" + std::to_string((int64_t)i - backtracked))).id; getWorkspaceIDNameFromString("r" + ((int64_t)i - backtracked < 0 ? std::to_string((int64_t)i - backtracked) : "+" + std::to_string((int64_t)i - backtracked))).id;
image.workspaceID = currentID; image.workspaceID = currentID;
@ -81,7 +81,7 @@ COverview::COverview(PHLWORKSPACE startedOn_, bool swipe_) : startedOn(startedOn
pMonitor->activeWorkspace = PWORKSPACESTART; pMonitor->activeWorkspace = PWORKSPACESTART;
for (size_t i = 1; i < SIDE_LENGTH * SIDE_LENGTH; ++i) { for (size_t i = 1; i < SIDE_LENGTH * SIDE_LENGTH; ++i) {
auto& image = images[i]; auto& image = images[i];
currentID = getWorkspaceIDNameFromString("r+" + std::to_string(i)).id; currentID = getWorkspaceIDNameFromString("r+" + std::to_string(i)).id;
image.workspaceID = currentID; image.workspaceID = currentID;
} }
@ -115,7 +115,7 @@ COverview::COverview(PHLWORKSPACE startedOn_, bool swipe_) : startedOn(startedOn
CRegion fakeDamage{0, 0, INT16_MAX, INT16_MAX}; CRegion fakeDamage{0, 0, INT16_MAX, INT16_MAX};
g_pHyprRenderer->beginRender(PMONITOR, fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &image.fb); g_pHyprRenderer->beginRender(PMONITOR, fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &image.fb);
g_pHyprOpenGL->clear(CColor{0, 0, 0, 1.0}); g_pHyprOpenGL->clear(CHyprColor{0, 0, 0, 1.0});
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(image.workspaceID); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(image.workspaceID);
@ -243,7 +243,7 @@ void COverview::redrawID(int id, bool forcelowres) {
CRegion fakeDamage{0, 0, INT16_MAX, INT16_MAX}; CRegion fakeDamage{0, 0, INT16_MAX, INT16_MAX};
g_pHyprRenderer->beginRender(pMonitor.lock(), fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &image.fb); g_pHyprRenderer->beginRender(pMonitor.lock(), fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &image.fb);
g_pHyprOpenGL->clear(CColor{0, 0, 0, 1.0}); g_pHyprOpenGL->clear(CHyprColor{0, 0, 0, 1.0});
const auto PWORKSPACE = image.pWorkspace; const auto PWORKSPACE = image.pWorkspace;

View file

@ -37,15 +37,15 @@ class COverview {
PHLMONITORREF pMonitor; PHLMONITORREF pMonitor;
private: private:
void redrawID(int id, bool forcelowres = false); void redrawID(int id, bool forcelowres = false);
void redrawAll(bool forcelowres = false); void redrawAll(bool forcelowres = false);
void onWorkspaceChange(); void onWorkspaceChange();
int SIDE_LENGTH = 3; int SIDE_LENGTH = 3;
int GAP_WIDTH = 5; int GAP_WIDTH = 5;
CColor BG_COLOR = CColor{0.1, 0.1, 0.1, 1.0}; CHyprColor BG_COLOR = CHyprColor{0.1, 0.1, 0.1, 1.0};
bool damageDirty = false; bool damageDirty = false;
struct SWorkspaceImage { struct SWorkspaceImage {
CFramebuffer fb; CFramebuffer fb;
@ -77,4 +77,4 @@ class COverview {
bool swipeWasCommenced = false; bool swipeWasCommenced = false;
}; };
inline std::unique_ptr<COverview> g_pOverview; inline std::unique_ptr<COverview> g_pOverview;

View file

@ -102,7 +102,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
const std::string HASH = __hyprland_api_get_hash(); const std::string HASH = __hyprland_api_get_hash();
if (HASH != GIT_COMMIT_HASH) { if (HASH != GIT_COMMIT_HASH) {
HyprlandAPI::addNotification(PHANDLE, "[ht] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)", CColor{1.0, 0.2, 0.2, 1.0}, HyprlandAPI::addNotification(PHANDLE, "[ht] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)", CHyprColor{1.0, 0.2, 0.2, 1.0},
5000); 5000);
throw std::runtime_error("[ht] Version mismatch"); throw std::runtime_error("[ht] Version mismatch");
} }
@ -128,7 +128,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
HyprlandAPI::reloadConfig(); HyprlandAPI::reloadConfig();
HyprlandAPI::addNotification(PHANDLE, "[hyprtrails] Initialized successfully!", CColor{0.2, 1.0, 0.2, 1.0}, 5000); HyprlandAPI::addNotification(PHANDLE, "[hyprtrails] Initialized successfully!", CHyprColor{0.2, 1.0, 0.2, 1.0}, 5000);
return {"hyprtrails", "A plugin to add trails behind moving windows", "Vaxry", "1.0"}; return {"hyprtrails", "A plugin to add trails behind moving windows", "Vaxry", "1.0"};
} }

View file

@ -78,7 +78,7 @@ Vector2D vecForBezierT(const float& t, const std::vector<Vector2D>& verts) {
return pts[0]; return pts[0];
} }
void CTrail::draw(PHLMONITOR pMonitor, const float &a) { void CTrail::draw(PHLMONITOR pMonitor, const float& a) {
if (!validMapped(m_pWindow)) if (!validMapped(m_pWindow))
return; return;
@ -91,7 +91,7 @@ void CTrail::draw(PHLMONITOR pMonitor, const float &a) {
static auto* const PPOINTSPERSTEP = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprtrails:points_per_step")->getDataStaticPtr(); static auto* const PPOINTSPERSTEP = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprtrails:points_per_step")->getDataStaticPtr();
static auto* const PCOLOR = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprtrails:color")->getDataStaticPtr(); static auto* const PCOLOR = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprtrails:color")->getDataStaticPtr();
const CColor COLOR = **PCOLOR; const CHyprColor COLOR = **PCOLOR;
if (m_dLastGeoms.size() < 2) if (m_dLastGeoms.size() < 2)
return; return;
@ -111,7 +111,7 @@ void CTrail::draw(PHLMONITOR pMonitor, const float &a) {
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
g_pHyprOpenGL->renderRect(&wlrbox, CColor(0, 0, 0, 0), PWINDOW->rounding() * pMonitor->scale); g_pHyprOpenGL->renderRect(&wlrbox, CHyprColor(0, 0, 0, 0), PWINDOW->rounding() * pMonitor->scale);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glStencilFunc(GL_NOTEQUAL, 1, -1); glStencilFunc(GL_NOTEQUAL, 1, -1);

View file

@ -137,7 +137,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
if (HASH != GIT_COMMIT_HASH) { if (HASH != GIT_COMMIT_HASH) {
HyprlandAPI::addNotification(PHANDLE, "[hyprwinwrap] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)", HyprlandAPI::addNotification(PHANDLE, "[hyprwinwrap] Failure in initialization: Version mismatch (headers ver is not equal to running hyprland ver)",
CColor{1.0, 0.2, 0.2, 1.0}, 5000); CHyprColor{1.0, 0.2, 0.2, 1.0}, 5000);
throw std::runtime_error("[hww] Version mismatch"); throw std::runtime_error("[hww] Version mismatch");
} }
@ -170,7 +170,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprwinwrap:class", Hyprlang::STRING{"kitty-bg"}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprwinwrap:class", Hyprlang::STRING{"kitty-bg"});
HyprlandAPI::addNotification(PHANDLE, "[hyprwinwrap] Initialized successfully!", CColor{0.2, 1.0, 0.2, 1.0}, 5000); HyprlandAPI::addNotification(PHANDLE, "[hyprwinwrap] Initialized successfully!", CHyprColor{0.2, 1.0, 0.2, 1.0}, 5000);
return {"hyprwinwrap", "A clone of xwinwrap for Hyprland", "Vaxry", "1.0"}; return {"hyprwinwrap", "A clone of xwinwrap for Hyprland", "Vaxry", "1.0"};
} }