mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-09 16:25:59 +01:00
config: Add a variable to prevent groups from merging after being dragged
This commit is contained in:
parent
9b54342baa
commit
f777f028cf
3 changed files with 12 additions and 1 deletions
|
@ -742,6 +742,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
||||||
.type = CONFIG_OPTION_BOOL,
|
.type = CONFIG_OPTION_BOOL,
|
||||||
.data = SConfigOptionDescription::SBoolData{true},
|
.data = SConfigOptionDescription::SBoolData{true},
|
||||||
},
|
},
|
||||||
|
SConfigOptionDescription{
|
||||||
|
.value = "group:merge_groups_on_drag",
|
||||||
|
.description = "whether window groups can be dragged into other groups",
|
||||||
|
.type = CONFIG_OPTION_BOOL,
|
||||||
|
.data = SConfigOptionDescription::SBoolData{true},
|
||||||
|
},
|
||||||
SConfigOptionDescription{
|
SConfigOptionDescription{
|
||||||
.value = "general:col.border_active",
|
.value = "general:col.border_active",
|
||||||
.description = "border color for inactive windows",
|
.description = "border color for inactive windows",
|
||||||
|
|
|
@ -361,6 +361,7 @@ CConfigManager::CConfigManager() {
|
||||||
|
|
||||||
m_pConfig->addConfigValue("group:insert_after_current", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("group:insert_after_current", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("group:focus_removed_window", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("group:focus_removed_window", Hyprlang::INT{1});
|
||||||
|
m_pConfig->addConfigValue("group:merge_groups_on_drag", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("group:groupbar:enabled", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("group:groupbar:enabled", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("group:groupbar:font_family", {STRVAL_EMPTY});
|
m_pConfig->addConfigValue("group:groupbar:font_family", {STRVAL_EMPTY});
|
||||||
m_pConfig->addConfigValue("group:groupbar:font_size", Hyprlang::INT{8});
|
m_pConfig->addConfigValue("group:groupbar:font_size", Hyprlang::INT{8});
|
||||||
|
|
|
@ -951,12 +951,16 @@ int CWindow::getGroupSize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWindow::canBeGroupedInto(PHLWINDOW pWindow) {
|
bool CWindow::canBeGroupedInto(PHLWINDOW pWindow) {
|
||||||
|
static auto ALLOWGROUPMERGE = CConfigValue<Hyprlang::INT>("group:merge_groups_on_drag");
|
||||||
|
bool isGroup = m_sGroupData.pNextWindow;
|
||||||
|
bool disallowDragIntoGroup = g_pInputManager->m_bWasDraggingWindow && isGroup && !bool(*ALLOWGROUPMERGE);
|
||||||
return !g_pKeybindManager->m_bGroupsLocked // global group lock disengaged
|
return !g_pKeybindManager->m_bGroupsLocked // global group lock disengaged
|
||||||
&& ((m_eGroupRules & GROUP_INVADE && m_bFirstMap) // window ignore local group locks, or
|
&& ((m_eGroupRules & GROUP_INVADE && m_bFirstMap) // window ignore local group locks, or
|
||||||
|| (!pWindow->getGroupHead()->m_sGroupData.locked // target unlocked
|
|| (!pWindow->getGroupHead()->m_sGroupData.locked // target unlocked
|
||||||
&& !(m_sGroupData.pNextWindow.lock() && getGroupHead()->m_sGroupData.locked))) // source unlocked or isn't group
|
&& !(m_sGroupData.pNextWindow.lock() && getGroupHead()->m_sGroupData.locked))) // source unlocked or isn't group
|
||||||
&& !m_sGroupData.deny // source is not denied entry
|
&& !m_sGroupData.deny // source is not denied entry
|
||||||
&& !(m_eGroupRules & GROUP_BARRED && m_bFirstMap); // group rule doesn't prevent adding window
|
&& !(m_eGroupRules & GROUP_BARRED && m_bFirstMap) // group rule doesn't prevent adding window
|
||||||
|
&& !disallowDragIntoGroup; // config allows groups to be merged
|
||||||
}
|
}
|
||||||
|
|
||||||
PHLWINDOW CWindow::getGroupWindowByIndex(int index) {
|
PHLWINDOW CWindow::getGroupWindowByIndex(int index) {
|
||||||
|
|
Loading…
Reference in a new issue