mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2024-11-21 18:25:58 +01:00
all: chase hyprland
This commit is contained in:
parent
9971fec974
commit
be8f8d81ef
9 changed files with 51 additions and 54 deletions
|
@ -43,7 +43,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
|
|
||||||
HyprlandAPI::reloadConfig();
|
HyprlandAPI::reloadConfig();
|
||||||
|
|
||||||
HyprlandAPI::registerCallbackDynamic(PHANDLE, "openWindow", [&](void* self, SCallbackInfo& info, std::any data) { onNewWindow(self, data); });
|
static auto P = HyprlandAPI::registerCallbackDynamic(PHANDLE, "openWindow", [&](void* self, SCallbackInfo& info, std::any data) { onNewWindow(self, data); });
|
||||||
|
|
||||||
// add deco to existing windows
|
// add deco to existing windows
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
|
|
|
@ -34,35 +34,35 @@ class CHyprBar : public IHyprWindowDecoration {
|
||||||
CWindow* getOwner();
|
CWindow* getOwner();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SWindowDecorationExtents m_seExtents;
|
SWindowDecorationExtents m_seExtents;
|
||||||
|
|
||||||
CWindow* m_pWindow = nullptr;
|
CWindow* m_pWindow = nullptr;
|
||||||
|
|
||||||
CBox m_bAssignedBox;
|
CBox m_bAssignedBox;
|
||||||
|
|
||||||
CTexture m_tTextTex;
|
CTexture m_tTextTex;
|
||||||
CTexture m_tButtonsTex;
|
CTexture m_tButtonsTex;
|
||||||
|
|
||||||
bool m_bWindowSizeChanged = false;
|
bool m_bWindowSizeChanged = false;
|
||||||
|
|
||||||
Vector2D cursorRelativeToBar();
|
Vector2D cursorRelativeToBar();
|
||||||
|
|
||||||
void renderBarTitle(const Vector2D& bufferSize, const float scale);
|
void renderBarTitle(const Vector2D& bufferSize, const float scale);
|
||||||
void renderText(CTexture& out, const std::string& text, const CColor& color, const Vector2D& bufferSize, const float scale, const int fontSize);
|
void renderText(CTexture& out, const std::string& text, const CColor& 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, wlr_pointer_button_event* e);
|
void onMouseDown(SCallbackInfo& info, wlr_pointer_button_event* e);
|
||||||
void onMouseMove(Vector2D coords);
|
void onMouseMove(Vector2D coords);
|
||||||
CBox assignedBoxGlobal();
|
CBox assignedBoxGlobal();
|
||||||
|
|
||||||
HOOK_CALLBACK_FN* m_pMouseButtonCallback;
|
std::shared_ptr<HOOK_CALLBACK_FN> m_pMouseButtonCallback;
|
||||||
HOOK_CALLBACK_FN* m_pMouseMoveCallback;
|
std::shared_ptr<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;
|
||||||
|
|
|
@ -86,8 +86,8 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
|
|
||||||
g_pGlobalState = std::make_unique<SGlobalState>();
|
g_pGlobalState = std::make_unique<SGlobalState>();
|
||||||
|
|
||||||
HyprlandAPI::registerCallbackDynamic(PHANDLE, "openWindow", [&](void* self, SCallbackInfo& info, std::any data) { onNewWindow(self, data); });
|
static auto P = HyprlandAPI::registerCallbackDynamic(PHANDLE, "openWindow", [&](void* self, SCallbackInfo& info, std::any data) { onNewWindow(self, data); });
|
||||||
HyprlandAPI::registerCallbackDynamic(PHANDLE, "closeWindow", [&](void* self, SCallbackInfo& info, std::any data) { onCloseWindow(self, data); });
|
static auto P2 = HyprlandAPI::registerCallbackDynamic(PHANDLE, "closeWindow", [&](void* self, SCallbackInfo& info, std::any data) { onCloseWindow(self, data); });
|
||||||
|
|
||||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_color", Hyprlang::INT{configStringToInt("rgba(33333388)")});
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_color", Hyprlang::INT{configStringToInt("rgba(33333388)")});
|
||||||
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_height", Hyprlang::INT{15});
|
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_height", Hyprlang::INT{15});
|
||||||
|
|
|
@ -138,8 +138,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,
|
HyprlandAPI::addNotification(PHANDLE, "[hyprexpo] Failure in initialization: " + reason, CColor{1.0, 0.2, 0.2, 1.0}, 5000);
|
||||||
CColor{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) {
|
||||||
|
@ -185,15 +184,15 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
throw std::runtime_error("[he] Failed initializing hooks");
|
throw std::runtime_error("[he] Failed initializing hooks");
|
||||||
}
|
}
|
||||||
|
|
||||||
HyprlandAPI::registerCallbackDynamic(PHANDLE, "preRender", [](void* self, SCallbackInfo& info, std::any param) {
|
static auto P = HyprlandAPI::registerCallbackDynamic(PHANDLE, "preRender", [](void* self, SCallbackInfo& info, std::any param) {
|
||||||
if (!g_pOverview)
|
if (!g_pOverview)
|
||||||
return;
|
return;
|
||||||
g_pOverview->onPreRender();
|
g_pOverview->onPreRender();
|
||||||
});
|
});
|
||||||
|
|
||||||
HyprlandAPI::registerCallbackDynamic(PHANDLE, "swipeBegin", [](void* self, SCallbackInfo& info, std::any data) { swipeBegin(self, info, data); });
|
static auto P2 = HyprlandAPI::registerCallbackDynamic(PHANDLE, "swipeBegin", [](void* self, SCallbackInfo& info, std::any data) { swipeBegin(self, info, data); });
|
||||||
HyprlandAPI::registerCallbackDynamic(PHANDLE, "swipeEnd", [](void* self, SCallbackInfo& info, std::any data) { swipeEnd(self, info, data); });
|
static auto P3 = HyprlandAPI::registerCallbackDynamic(PHANDLE, "swipeEnd", [](void* self, SCallbackInfo& info, std::any data) { swipeEnd(self, info, data); });
|
||||||
HyprlandAPI::registerCallbackDynamic(PHANDLE, "swipeUpdate", [](void* self, SCallbackInfo& info, std::any data) { swipeUpdate(self, info, data); });
|
static auto P4 = HyprlandAPI::registerCallbackDynamic(PHANDLE, "swipeUpdate", [](void* self, SCallbackInfo& info, std::any data) { swipeUpdate(self, info, data); });
|
||||||
|
|
||||||
HyprlandAPI::addDispatcher(PHANDLE, "hyprexpo:expo", onExpoDispatcher);
|
HyprlandAPI::addDispatcher(PHANDLE, "hyprexpo:expo", onExpoDispatcher);
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,6 @@ static void removeOverview(void*) {
|
||||||
COverview::~COverview() {
|
COverview::~COverview() {
|
||||||
g_pHyprRenderer->makeEGLCurrent();
|
g_pHyprRenderer->makeEGLCurrent();
|
||||||
images.clear(); // otherwise we get a vram leak
|
images.clear(); // otherwise we get a vram leak
|
||||||
g_pHookSystem->unhook(touchUpHook);
|
|
||||||
g_pHookSystem->unhook(touchMoveHook);
|
|
||||||
g_pHookSystem->unhook(mouseButtonHook);
|
|
||||||
g_pHookSystem->unhook(mouseMoveHook);
|
|
||||||
g_pInputManager->unsetCursorImage();
|
g_pInputManager->unsetCursorImage();
|
||||||
g_pHyprOpenGL->markBlurDirtyForMonitor(pMonitor);
|
g_pHyprOpenGL->markBlurDirtyForMonitor(pMonitor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,27 +54,27 @@ class COverview {
|
||||||
CBox box;
|
CBox box;
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector2D lastMousePosLocal = Vector2D{};
|
Vector2D lastMousePosLocal = Vector2D{};
|
||||||
|
|
||||||
int openedID = -1;
|
int openedID = -1;
|
||||||
int closeOnID = -1;
|
int closeOnID = -1;
|
||||||
|
|
||||||
std::vector<SWorkspaceImage> images;
|
std::vector<SWorkspaceImage> images;
|
||||||
|
|
||||||
PHLWORKSPACE startedOn;
|
PHLWORKSPACE startedOn;
|
||||||
|
|
||||||
CAnimatedVariable<Vector2D> size;
|
CAnimatedVariable<Vector2D> size;
|
||||||
CAnimatedVariable<Vector2D> pos;
|
CAnimatedVariable<Vector2D> pos;
|
||||||
|
|
||||||
bool closing = false;
|
bool closing = false;
|
||||||
|
|
||||||
HOOK_CALLBACK_FN* mouseMoveHook = nullptr;
|
std::shared_ptr<HOOK_CALLBACK_FN> mouseMoveHook;
|
||||||
HOOK_CALLBACK_FN* mouseButtonHook = nullptr;
|
std::shared_ptr<HOOK_CALLBACK_FN> mouseButtonHook;
|
||||||
HOOK_CALLBACK_FN* touchMoveHook = nullptr;
|
std::shared_ptr<HOOK_CALLBACK_FN> touchMoveHook;
|
||||||
HOOK_CALLBACK_FN* touchUpHook = nullptr;
|
std::shared_ptr<HOOK_CALLBACK_FN> touchUpHook;
|
||||||
|
|
||||||
bool swipe = false;
|
bool swipe = false;
|
||||||
bool swipeWasCommenced = false;
|
bool swipeWasCommenced = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::unique_ptr<COverview> g_pOverview;
|
inline std::unique_ptr<COverview> g_pOverview;
|
|
@ -31,12 +31,12 @@ CTrail::CTrail(CWindow* pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWi
|
||||||
m_vLastWindowPos = pWindow->m_vRealPosition.value();
|
m_vLastWindowPos = pWindow->m_vRealPosition.value();
|
||||||
m_vLastWindowSize = pWindow->m_vRealSize.value();
|
m_vLastWindowSize = pWindow->m_vRealSize.value();
|
||||||
|
|
||||||
pTickCb = g_pHookSystem->hookDynamic("trailTick", [this](void* self, SCallbackInfo& info, std::any data) { this->onTick(); });
|
pTickCb = HyprlandAPI::registerCallbackDynamic(PHANDLE, "trailTick", [this](void* self, SCallbackInfo& info, std::any data) { this->onTick(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
CTrail::~CTrail() {
|
CTrail::~CTrail() {
|
||||||
damageEntire();
|
damageEntire();
|
||||||
g_pHookSystem->unhook(pTickCb);
|
HyprlandAPI::unregisterCallback(PHANDLE, pTickCb);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDecorationPositioningInfo CTrail::getPositioningInfo() {
|
SDecorationPositioningInfo CTrail::getPositioningInfo() {
|
||||||
|
|
|
@ -46,7 +46,7 @@ class CTrail : public IHyprWindowDecoration {
|
||||||
virtual void damageEntire();
|
virtual void damageEntire();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HOOK_CALLBACK_FN* pTickCb = nullptr;
|
std::shared_ptr<HOOK_CALLBACK_FN> pTickCb;
|
||||||
void onTick();
|
void onTick();
|
||||||
|
|
||||||
std::deque<std::pair<box, std::chrono::system_clock::time_point>> m_dLastGeoms;
|
std::deque<std::pair<box, std::chrono::system_clock::time_point>> m_dLastGeoms;
|
||||||
|
|
|
@ -138,10 +138,12 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
throw std::runtime_error("[hww] Version mismatch");
|
throw std::runtime_error("[hww] Version mismatch");
|
||||||
}
|
}
|
||||||
|
|
||||||
HyprlandAPI::registerCallbackDynamic(PHANDLE, "openWindow", [&](void* self, SCallbackInfo& info, std::any data) { onNewWindow(std::any_cast<CWindow*>(data)); });
|
// clang-format off
|
||||||
HyprlandAPI::registerCallbackDynamic(PHANDLE, "closeWindow", [&](void* self, SCallbackInfo& info, std::any data) { onCloseWindow(std::any_cast<CWindow*>(data)); });
|
static auto P = HyprlandAPI::registerCallbackDynamic(PHANDLE, "openWindow", [&](void* self, SCallbackInfo& info, std::any data) { onNewWindow(std::any_cast<CWindow*>(data)); });
|
||||||
HyprlandAPI::registerCallbackDynamic(PHANDLE, "render", [&](void* self, SCallbackInfo& info, std::any data) { onRenderStage(std::any_cast<eRenderStage>(data)); });
|
static auto P2 = HyprlandAPI::registerCallbackDynamic(PHANDLE, "closeWindow", [&](void* self, SCallbackInfo& info, std::any data) { onCloseWindow(std::any_cast<CWindow*>(data)); });
|
||||||
HyprlandAPI::registerCallbackDynamic(PHANDLE, "configReloaded", [&](void* self, SCallbackInfo& info, std::any data) { onConfigReloaded(); });
|
static auto P3 = HyprlandAPI::registerCallbackDynamic(PHANDLE, "render", [&](void* self, SCallbackInfo& info, std::any data) { onRenderStage(std::any_cast<eRenderStage>(data)); });
|
||||||
|
static auto P4 = HyprlandAPI::registerCallbackDynamic(PHANDLE, "configReloaded", [&](void* self, SCallbackInfo& info, std::any data) { onConfigReloaded(); });
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
auto fns = HyprlandAPI::findFunctionsByName(PHANDLE, "onCommit");
|
auto fns = HyprlandAPI::findFunctionsByName(PHANDLE, "onCommit");
|
||||||
if (fns.size() < 1)
|
if (fns.size() < 1)
|
||||||
|
|
Loading…
Reference in a new issue