mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-16 12:33:48 -07:00
master: add option to keep master window position (#9537)
This commit is contained in:
@@ -374,8 +374,22 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) {
|
||||
|
||||
// compute placement of master window(s)
|
||||
if (WINDOWS == 1 && !centerMasterWindow) {
|
||||
PMASTERNODE->size = WSSIZE;
|
||||
PMASTERNODE->position = WSPOS;
|
||||
static auto PALWAYSKEEPPOSITION = CConfigValue<Hyprlang::INT>("master:always_keep_position");
|
||||
if (*PALWAYSKEEPPOSITION) {
|
||||
const float WIDTH = WSSIZE.x * PMASTERNODE->percMaster;
|
||||
float nextX = 0;
|
||||
|
||||
if (orientation == ORIENTATION_RIGHT)
|
||||
nextX = WSSIZE.x - WIDTH;
|
||||
else if (orientation == ORIENTATION_CENTER)
|
||||
nextX = (WSSIZE.x - WIDTH) / 2;
|
||||
|
||||
PMASTERNODE->size = Vector2D(WIDTH, WSSIZE.y);
|
||||
PMASTERNODE->position = WSPOS + Vector2D((double)nextX, 0.0);
|
||||
} else {
|
||||
PMASTERNODE->size = WSSIZE;
|
||||
PMASTERNODE->position = WSPOS;
|
||||
}
|
||||
|
||||
applyNodeDataToWindow(PMASTERNODE);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user