mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2025-05-13 05:40:41 +01:00
all: chase hyprland
This commit is contained in:
parent
d2dad5b434
commit
7634792d19
7 changed files with 18 additions and 15 deletions
|
@ -20,7 +20,7 @@ void onNewWindow(void* self, std::any data) {
|
||||||
// data is guaranteed
|
// data is guaranteed
|
||||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||||
|
|
||||||
HyprlandAPI::addWindowDecoration(PHANDLE, PWINDOW, std::make_unique<CBordersPlusPlus>(PWINDOW));
|
HyprlandAPI::addWindowDecoration(PHANDLE, PWINDOW, makeUnique<CBordersPlusPlus>(PWINDOW));
|
||||||
}
|
}
|
||||||
|
|
||||||
APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
|
@ -51,7 +51,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
if (w->isHidden() || !w->m_bIsMapped)
|
if (w->isHidden() || !w->m_bIsMapped)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
HyprlandAPI::addWindowDecoration(PHANDLE, w, std::make_unique<CBordersPlusPlus>(w));
|
HyprlandAPI::addWindowDecoration(PHANDLE, w, makeUnique<CBordersPlusPlus>(w));
|
||||||
}
|
}
|
||||||
|
|
||||||
HyprlandAPI::addNotification(PHANDLE, "[borders-plus-plus] Initialized successfully!", CHyprColor{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);
|
||||||
|
|
|
@ -43,7 +43,7 @@ CHyprBar::~CHyprBar() {
|
||||||
HyprlandAPI::unregisterCallback(PHANDLE, m_pTouchUpCallback);
|
HyprlandAPI::unregisterCallback(PHANDLE, m_pTouchUpCallback);
|
||||||
HyprlandAPI::unregisterCallback(PHANDLE, m_pTouchMoveCallback);
|
HyprlandAPI::unregisterCallback(PHANDLE, m_pTouchMoveCallback);
|
||||||
HyprlandAPI::unregisterCallback(PHANDLE, m_pMouseMoveCallback);
|
HyprlandAPI::unregisterCallback(PHANDLE, m_pMouseMoveCallback);
|
||||||
std::erase(g_pGlobalState->bars, this);
|
std::erase(g_pGlobalState->bars, m_self);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDecorationPositioningInfo CHyprBar::getPositioningInfo() {
|
SDecorationPositioningInfo CHyprBar::getPositioningInfo() {
|
||||||
|
|
|
@ -43,6 +43,8 @@ class CHyprBar : public IHyprWindowDecoration {
|
||||||
void updateRules();
|
void updateRules();
|
||||||
void applyRule(const SP<CWindowRule>&);
|
void applyRule(const SP<CWindowRule>&);
|
||||||
|
|
||||||
|
WP<CHyprBar> m_self;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SBoxExtents m_seExtents;
|
SBoxExtents m_seExtents;
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@ struct SHyprButton {
|
||||||
class CHyprBar;
|
class CHyprBar;
|
||||||
|
|
||||||
struct SGlobalState {
|
struct SGlobalState {
|
||||||
std::vector<SHyprButton> buttons;
|
std::vector<SHyprButton> buttons;
|
||||||
std::vector<CHyprBar*> bars;
|
std::vector<WP<CHyprBar>> bars;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::unique_ptr<SGlobalState> g_pGlobalState;
|
inline UP<SGlobalState> g_pGlobalState;
|
||||||
|
|
|
@ -21,8 +21,9 @@ static void onNewWindow(void* self, std::any data) {
|
||||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||||
|
|
||||||
if (!PWINDOW->m_bX11DoesntWantBorders) {
|
if (!PWINDOW->m_bX11DoesntWantBorders) {
|
||||||
std::unique_ptr<CHyprBar> bar = std::make_unique<CHyprBar>(PWINDOW);
|
auto bar = makeUnique<CHyprBar>(PWINDOW);
|
||||||
g_pGlobalState->bars.push_back(bar.get());
|
g_pGlobalState->bars.emplace_back(bar);
|
||||||
|
bar->m_self = bar;
|
||||||
HyprlandAPI::addWindowDecoration(PHANDLE, PWINDOW, std::move(bar));
|
HyprlandAPI::addWindowDecoration(PHANDLE, PWINDOW, std::move(bar));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +38,7 @@ static void onCloseWindow(void* self, std::any data) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// we could use the API but this is faster + it doesn't matter here that much.
|
// we could use the API but this is faster + it doesn't matter here that much.
|
||||||
PWINDOW->removeWindowDeco(*BARIT);
|
PWINDOW->removeWindowDeco(BARIT->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void onPreConfigReload() {
|
static void onPreConfigReload() {
|
||||||
|
@ -114,7 +115,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
throw std::runtime_error("[hb] Version mismatch");
|
throw std::runtime_error("[hb] Version mismatch");
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pGlobalState = std::make_unique<SGlobalState>();
|
g_pGlobalState = makeUnique<SGlobalState>();
|
||||||
|
|
||||||
static auto P = 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); });
|
||||||
static auto P2 = 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); });
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
inline HANDLE PHANDLE = nullptr;
|
inline HANDLE PHANDLE = nullptr;
|
||||||
|
|
||||||
struct SGlobalState {
|
struct SGlobalState {
|
||||||
CShader trailShader;
|
CShader trailShader;
|
||||||
wl_event_source* tick = nullptr;
|
wl_event_source* tick = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::unique_ptr<SGlobalState> g_pGlobalState;
|
inline UP<SGlobalState> g_pGlobalState;
|
|
@ -23,7 +23,7 @@ void onNewWindow(void* self, std::any data) {
|
||||||
// data is guaranteed
|
// data is guaranteed
|
||||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||||
|
|
||||||
HyprlandAPI::addWindowDecoration(PHANDLE, PWINDOW, std::make_unique<CTrail>(PWINDOW));
|
HyprlandAPI::addWindowDecoration(PHANDLE, PWINDOW, makeUnique<CTrail>(PWINDOW));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint CompileShader(const GLuint& type, std::string src) {
|
GLuint CompileShader(const GLuint& type, std::string src) {
|
||||||
|
@ -117,7 +117,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
|
|
||||||
static auto P = 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); });
|
||||||
|
|
||||||
g_pGlobalState = std::make_unique<SGlobalState>();
|
g_pGlobalState = makeUnique<SGlobalState>();
|
||||||
initGlobal();
|
initGlobal();
|
||||||
|
|
||||||
// add deco to existing windows
|
// add deco to existing windows
|
||||||
|
@ -125,7 +125,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
if (w->isHidden() || !w->m_bIsMapped)
|
if (w->isHidden() || !w->m_bIsMapped)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
HyprlandAPI::addWindowDecoration(PHANDLE, w, std::make_unique<CTrail>(w));
|
HyprlandAPI::addWindowDecoration(PHANDLE, w, makeUnique<CTrail>(w));
|
||||||
}
|
}
|
||||||
|
|
||||||
HyprlandAPI::reloadConfig();
|
HyprlandAPI::reloadConfig();
|
||||||
|
|
Loading…
Reference in a new issue