mirror of
https://github.com/hyprwm/Hyprland
synced 2026-05-01 08:57:59 +02:00
group: disband_on_empty config
# Conflicts: # src/config/ConfigDescriptions.hpp # src/config/ConfigManager.cpp # src/desktop/view/Group.cpp
This commit is contained in:
parent
bf31f642b0
commit
2ce7dd173c
3 changed files with 15 additions and 0 deletions
|
|
@ -545,6 +545,7 @@ CConfigManager::CConfigManager() {
|
|||
registerConfigVar("group:auto_group", Hyprlang::INT{1});
|
||||
registerConfigVar("group:drag_into_group", Hyprlang::INT{1});
|
||||
registerConfigVar("group:group_on_movetoworkspace", Hyprlang::INT{0});
|
||||
registerConfigVar("group:disband_on_empty", Hyprlang::INT{0});
|
||||
registerConfigVar("group:groupbar:enabled", Hyprlang::INT{1});
|
||||
registerConfigVar("group:groupbar:font_family", {STRVAL_EMPTY});
|
||||
registerConfigVar("group:groupbar:font_weight_active", Hyprlang::CConfigCustomValueType{&configHandleFontWeightSet, configHandleFontWeightDestroy, "normal"});
|
||||
|
|
|
|||
|
|
@ -1004,6 +1004,12 @@ namespace Config::Supplementary {
|
|||
.type = CONFIG_OPTION_BOOL,
|
||||
.data = SConfigOptionDescription::SBoolData{false},
|
||||
},
|
||||
SConfigOptionDescription{
|
||||
.value = "group:disband_on_empty",
|
||||
.description = "whether to automatically disband a group when only one window remains",
|
||||
.type = CONFIG_OPTION_BOOL,
|
||||
.data = SConfigOptionDescription::SBoolData{false},
|
||||
},
|
||||
|
||||
/*
|
||||
* group:groupbar:
|
||||
|
|
|
|||
|
|
@ -123,6 +123,8 @@ void CGroup::add(PHLWINDOW w) {
|
|||
}
|
||||
|
||||
void CGroup::remove(PHLWINDOW w, Math::eDirection dir) {
|
||||
static auto DISBAND_ON_EMPTY = CConfigValue<Hyprlang::INT>("group:disband_on_empty");
|
||||
|
||||
std::optional<size_t> idx;
|
||||
for (size_t i = 0; i < m_windows.size(); ++i) {
|
||||
if (m_windows.at(i) == w) {
|
||||
|
|
@ -172,6 +174,12 @@ void CGroup::remove(PHLWINDOW w, Math::eDirection dir) {
|
|||
}
|
||||
w->m_target->assignToSpace(m_target->space(), focalPoint);
|
||||
}
|
||||
|
||||
// Disband group if only one window remains and disband_on_empty is enabled
|
||||
if (*DISBAND_ON_EMPTY && m_windows.size() == 1) {
|
||||
destroy();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void CGroup::moveCurrent(bool next) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue