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

@ -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

@ -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);
@ -221,7 +221,7 @@ void CHyprBar::renderBarTitle(const Vector2D& bufferSize, const float 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);
@ -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)
@ -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

@ -50,13 +50,13 @@ class CHyprBar : public IHyprWindowDecoration {
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);

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>();

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

@ -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

@ -43,7 +43,7 @@ class COverview {
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;

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

@ -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"};
} }