Skip to content

Commit

Permalink
Merge branch 'hyprwm:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
caffeine01 authored Jan 11, 2025
2 parents 5d1fef9 + b4c0fa3 commit 04a6644
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
3 changes: 2 additions & 1 deletion borders-plus-plus/borderDeco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ void CBordersPlusPlus::drawPass(PHLMONITOR pMonitor, const float& a) {
const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_bPinned ? PWORKSPACE->m_vRenderOffset->value() : Vector2D();

auto rounding = PWINDOW->rounding() == 0 ? 0 : (PWINDOW->rounding() + **PBORDERSIZE) * pMonitor->scale;
const auto ROUNDINGPOWER = PWINDOW->roundingPower();
const auto ORIGINALROUND = rounding == 0 ? 0 : (PWINDOW->rounding() + **PBORDERSIZE) * pMonitor->scale;

CBox fullBox = m_bAssignedGeometry;
Expand Down Expand Up @@ -136,7 +137,7 @@ void CBordersPlusPlus::drawPass(PHLMONITOR pMonitor, const float& a) {

g_pHyprOpenGL->scissor((CBox*)nullptr);

g_pHyprOpenGL->renderBorder(&fullBox, CHyprColor{(uint64_t)**PCOLORS[i]}, **PNATURALROUND ? ORIGINALROUND : rounding, THISBORDERSIZE, a,
g_pHyprOpenGL->renderBorder(&fullBox, CHyprColor{(uint64_t)**PCOLORS[i]}, **PNATURALROUND ? ORIGINALROUND : rounding, ROUNDINGPOWER, THISBORDERSIZE, a,
**PNATURALROUND ? ORIGINALROUND : -1);
}

Expand Down
2 changes: 1 addition & 1 deletion hyprtrails/trail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void CTrail::renderPass(PHLMONITOR pMonitor, const float& a) {
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);

glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
g_pHyprOpenGL->renderRect(&wlrbox, CHyprColor(0, 0, 0, 0), PWINDOW->rounding() * pMonitor->scale);
g_pHyprOpenGL->renderRect(&wlrbox, CHyprColor(0, 0, 0, 0), PWINDOW->rounding() * pMonitor->scale, PWINDOW->roundingPower());
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);

glStencilFunc(GL_NOTEQUAL, 1, -1);
Expand Down
5 changes: 4 additions & 1 deletion xtra-dispatchers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ Adds some additional dispatchers to Hyprland.

## Dispatchers

All dispatchers here are called `plugin:xtd:name` e.g. `plugin:xtd:moveorexec`.

| name | description | params |
| -- | -- | -- |
| moveorexec | moves window to the current workspace, or executes if it's not found. `WINDOW` cannot contain commas | `WINDOW,CMD` |
| throwunfocused | throws all unfocused windows on the current workspace to the given workspace | `WORKSPACE` |
| bringallfrom | kinda inverse of throwunfocused. Bring all windows from a given workspace to the current one. | `WORKSPACE` |
| bringallfrom | kinda inverse of throwunfocused. Bring all windows from a given workspace to the current one. | `WORKSPACE` |
| closeunfocused | close all unfocused windows on the current workspace. | none |
15 changes: 15 additions & 0 deletions xtra-dispatchers/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@ static SDispatchResult bringAllFrom(std::string in) {
return SDispatchResult{};
}

static SDispatchResult closeUnfocused(std::string in) {
if (!g_pCompositor->m_pLastMonitor)
return SDispatchResult{.success = false, .error = "No focused monitor"};

for (const auto& w : g_pCompositor->m_vWindows) {
if (w->m_pWorkspace != g_pCompositor->m_pLastMonitor->activeWorkspace || w->m_pMonitor != g_pCompositor->m_pLastMonitor || !w->m_bIsMapped)
continue;

g_pCompositor->closeWindow(w);
}

return SDispatchResult{};
}

APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
PHANDLE = handle;

Expand All @@ -114,6 +128,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
success = success && HyprlandAPI::addDispatcherV2(PHANDLE, "plugin:xtd:moveorexec", ::moveOrExec);
success = success && HyprlandAPI::addDispatcherV2(PHANDLE, "plugin:xtd:throwunfocused", ::throwUnfocused);
success = success && HyprlandAPI::addDispatcherV2(PHANDLE, "plugin:xtd:bringallfrom", ::bringAllFrom);
success = success && HyprlandAPI::addDispatcherV2(PHANDLE, "plugin:xtd:closeunfocused", ::closeUnfocused);

if (success)
HyprlandAPI::addNotification(PHANDLE, "[xtra-dispatchers] Initialized successfully!", CHyprColor{0.2, 1.0, 0.2, 1.0}, 5000);
Expand Down

0 comments on commit 04a6644

Please sign in to comment.