mirror of
https://github.com/hyprwm/Hyprland
synced 2025-01-10 16:29:47 +01:00
master: add option to show slaves on left in center orientation (#8940)
Co-authored-by: Zetta1_Reid0 <11255-Zetta1_Reid0@users.noreply.gitlab.xfce.org>
This commit is contained in:
parent
b9f110ef87
commit
c7086f936a
3 changed files with 22 additions and 5 deletions
|
@ -1632,6 +1632,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
||||||
.type = CONFIG_OPTION_INT,
|
.type = CONFIG_OPTION_INT,
|
||||||
.data = SConfigOptionDescription::SRangeData{2, 0, 10}, //##TODO RANGE?
|
.data = SConfigOptionDescription::SRangeData{2, 0, 10}, //##TODO RANGE?
|
||||||
},
|
},
|
||||||
|
SConfigOptionDescription{
|
||||||
|
.value = "master:center_master_slaves_on_right",
|
||||||
|
.description = "set if the slaves should appear on right of master when slave_count_for_center_master > 2",
|
||||||
|
.type = CONFIG_OPTION_BOOL,
|
||||||
|
.data = SConfigOptionDescription::SBoolData{true},
|
||||||
|
},
|
||||||
SConfigOptionDescription{
|
SConfigOptionDescription{
|
||||||
.value = "master:center_ignores_reserved",
|
.value = "master:center_ignores_reserved",
|
||||||
.description = "centers the master window on monitor ignoring reserved areas",
|
.description = "centers the master window on monitor ignoring reserved areas",
|
||||||
|
|
|
@ -479,6 +479,7 @@ CConfigManager::CConfigManager() {
|
||||||
m_pConfig->addConfigValue("master:mfact", {0.55f});
|
m_pConfig->addConfigValue("master:mfact", {0.55f});
|
||||||
m_pConfig->addConfigValue("master:new_status", {"slave"});
|
m_pConfig->addConfigValue("master:new_status", {"slave"});
|
||||||
m_pConfig->addConfigValue("master:slave_count_for_center_master", Hyprlang::INT{2});
|
m_pConfig->addConfigValue("master:slave_count_for_center_master", Hyprlang::INT{2});
|
||||||
|
m_pConfig->addConfigValue("master:center_master_slaves_on_right", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("master:center_ignores_reserved", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("master:center_ignores_reserved", Hyprlang::INT{0});
|
||||||
m_pConfig->addConfigValue("master:new_on_active", {"none"});
|
m_pConfig->addConfigValue("master:new_on_active", {"none"});
|
||||||
m_pConfig->addConfigValue("master:new_on_top", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("master:new_on_top", Hyprlang::INT{0});
|
||||||
|
|
|
@ -328,6 +328,7 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) {
|
||||||
eOrientation orientation = getDynamicOrientation(pWorkspace);
|
eOrientation orientation = getDynamicOrientation(pWorkspace);
|
||||||
bool centerMasterWindow = false;
|
bool centerMasterWindow = false;
|
||||||
static auto SLAVECOUNTFORCENTER = CConfigValue<Hyprlang::INT>("master:slave_count_for_center_master");
|
static auto SLAVECOUNTFORCENTER = CConfigValue<Hyprlang::INT>("master:slave_count_for_center_master");
|
||||||
|
static auto CMSLAVESONRIGHT = CConfigValue<Hyprlang::INT>("master:center_master_slaves_on_right");
|
||||||
static auto PIGNORERESERVED = CConfigValue<Hyprlang::INT>("master:center_ignores_reserved");
|
static auto PIGNORERESERVED = CConfigValue<Hyprlang::INT>("master:center_ignores_reserved");
|
||||||
static auto PSMARTRESIZING = CConfigValue<Hyprlang::INT>("master:smart_resizing");
|
static auto PSMARTRESIZING = CConfigValue<Hyprlang::INT>("master:smart_resizing");
|
||||||
|
|
||||||
|
@ -341,7 +342,10 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) {
|
||||||
if (STACKWINDOWS >= *SLAVECOUNTFORCENTER) {
|
if (STACKWINDOWS >= *SLAVECOUNTFORCENTER) {
|
||||||
centerMasterWindow = true;
|
centerMasterWindow = true;
|
||||||
} else {
|
} else {
|
||||||
|
if (*CMSLAVESONRIGHT)
|
||||||
orientation = ORIENTATION_LEFT;
|
orientation = ORIENTATION_LEFT;
|
||||||
|
else
|
||||||
|
orientation = ORIENTATION_RIGHT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,15 +519,20 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) {
|
||||||
float nextY = 0;
|
float nextY = 0;
|
||||||
float nextYL = 0;
|
float nextYL = 0;
|
||||||
float nextYR = 0;
|
float nextYR = 0;
|
||||||
bool onRight = true;
|
bool onRight = *CMSLAVESONRIGHT;
|
||||||
|
int slavesLeftL = 1 + (slavesLeft - 1) / 2;
|
||||||
|
int slavesLeftR = slavesLeft - slavesLeftL;
|
||||||
|
|
||||||
int slavesLeftR = 1 + (slavesLeft - 1) / 2;
|
if (*CMSLAVESONRIGHT) {
|
||||||
int slavesLeftL = slavesLeft - slavesLeftR;
|
slavesLeftR = 1 + (slavesLeft - 1) / 2;
|
||||||
|
slavesLeftL = slavesLeft - slavesLeftR;
|
||||||
|
}
|
||||||
|
|
||||||
const float slaveAverageHeightL = WSSIZE.y / slavesLeftL;
|
const float slaveAverageHeightL = WSSIZE.y / slavesLeftL;
|
||||||
const float slaveAverageHeightR = WSSIZE.y / slavesLeftR;
|
const float slaveAverageHeightR = WSSIZE.y / slavesLeftR;
|
||||||
float slaveAccumulatedHeightL = 0;
|
float slaveAccumulatedHeightL = 0;
|
||||||
float slaveAccumulatedHeightR = 0;
|
float slaveAccumulatedHeightR = 0;
|
||||||
|
|
||||||
if (*PSMARTRESIZING) {
|
if (*PSMARTRESIZING) {
|
||||||
for (auto const& nd : m_lMasterNodesData) {
|
for (auto const& nd : m_lMasterNodesData) {
|
||||||
if (nd.workspaceID != pWorkspace->m_iID || nd.isMaster)
|
if (nd.workspaceID != pWorkspace->m_iID || nd.isMaster)
|
||||||
|
@ -536,7 +545,8 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) {
|
||||||
}
|
}
|
||||||
onRight = !onRight;
|
onRight = !onRight;
|
||||||
}
|
}
|
||||||
onRight = true;
|
|
||||||
|
onRight = *CMSLAVESONRIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& nd : m_lMasterNodesData) {
|
for (auto& nd : m_lMasterNodesData) {
|
||||||
|
|
Loading…
Reference in a new issue