Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/config/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3124,3 +3124,10 @@ std::optional<Vector2D> CConfigManager::getStoredFloatingSize(PHLWINDOW window)
}
return std::nullopt;
}

CCssGapData CConfigManager::getGapsForWorkspace(const PHLWORKSPACE& pWorkspace) {
const auto WORKSPACERULE = getWorkspaceRuleFor(pWorkspace);
static auto PGAPSOUTDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_out");
auto* const PGAPSOUT = sc<CCssGapData*>((PGAPSOUTDATA.ptr())->getData());
return WORKSPACERULE.gapsOut.value_or(*PGAPSOUT);
}
2 changes: 2 additions & 0 deletions src/config/ConfigManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ class CConfigManager {
void storeFloatingSize(PHLWINDOW window, const Vector2D& size);
std::optional<Vector2D> getStoredFloatingSize(PHLWINDOW window);

CCssGapData getGapsForWorkspace(const PHLWORKSPACE& pWorkspace);

private:
UP<Hyprlang::CConfig> m_config;

Expand Down
7 changes: 1 addition & 6 deletions src/layout/IHyprLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,14 +1050,9 @@ CBox IHyprLayout::workAreaOnWorkspace(const PHLWORKSPACE& pWorkspace) {
if (!pWorkspace || !pWorkspace->m_monitor)
return {};

const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(pWorkspace);

auto workArea = pWorkspace->m_monitor->logicalBoxMinusReserved();

static auto PGAPSOUTDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_out");
auto* const PGAPSOUT = sc<CCssGapData*>((PGAPSOUTDATA.ptr())->getData());
auto gapsOut = WORKSPACERULE.gapsOut.value_or(*PGAPSOUT);

auto gapsOut = g_pConfigManager->getGapsForWorkspace(pWorkspace);
Desktop::CReservedArea reservedGaps{gapsOut.m_top, gapsOut.m_right, gapsOut.m_bottom, gapsOut.m_left};

reservedGaps.applyip(workArea);
Expand Down
13 changes: 7 additions & 6 deletions src/layout/MasterLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,19 +443,20 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) {
nextX += WIDTH;
}
} else { // orientation left, right or center
float WIDTH = *PIGNORERESERVED && centerMasterWindow ? PMONITOR->m_size.x : WORKAREA.w;
float heightLeft = WORKAREA.h;
int mastersLeft = MASTERS;
float nextX = 0;
float nextY = 0;
const float TOTAL_WIDTH = *PIGNORERESERVED && centerMasterWindow ? PMONITOR->m_size.x : WORKAREA.w;
float WIDTH = TOTAL_WIDTH;
float heightLeft = WORKAREA.h;
int mastersLeft = MASTERS;
float nextX = *PIGNORERESERVED && centerMasterWindow ? g_pConfigManager->getGapsForWorkspace(pWorkspace).m_left : 0;
float nextY = *PIGNORERESERVED && centerMasterWindow ? WORKAREA.y : 0;

if (STACKWINDOWS > 0 || centerMasterWindow)
WIDTH *= PMASTERNODE->percMaster;

if (orientation == ORIENTATION_RIGHT)
nextX = WORKAREA.w - WIDTH;
else if (centerMasterWindow)
nextX = ((*PIGNORERESERVED && centerMasterWindow ? PMONITOR->m_size.x : WORKAREA.w) - WIDTH) / 2;
nextX += (TOTAL_WIDTH - WIDTH) / 2;

for (auto& nd : m_masterNodesData) {
if (nd.workspaceID != pWorkspace->m_id || !nd.isMaster)
Expand Down
Loading