Skip to content

Commit e48d7c8

Browse files
better config
1 parent 865ebda commit e48d7c8

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

src/config/ConfigDescriptions.hpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,11 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
3333
.data = SConfigOptionDescription::SStringData{"20"},
3434
},
3535
SConfigOptionDescription{
36-
.value = "general:float_gaps_in",
37-
.description = "gaps between windows for floating windows\n\nsupports css style gaps (top, right, bottom, left -> 5 10 15 20)",
36+
.value = "general:float_gaps",
37+
.description = "gaps between windows and monitor edges for floating windows\n\nsupports css style gaps (top, right, bottom, left -> 5 10 15 20). \n-1 means default "
38+
"gaps_in/gaps_out\n0 means no gaps",
3839
.type = CONFIG_OPTION_STRING_SHORT,
39-
.data = SConfigOptionDescription::SStringData{"5"},
40-
},
41-
SConfigOptionDescription{
42-
.value = "general:float_gaps_out",
43-
.description = "gaps between windows and monitor edges for floating windows\n\nsupports css style gaps (top, right, bottom, left -> 5 10 15 20)",
44-
.type = CONFIG_OPTION_STRING_SHORT,
45-
.data = SConfigOptionDescription::SStringData{"20"},
40+
.data = SConfigOptionDescription::SStringData{"0"},
4641
},
4742
SConfigOptionDescription{
4843
.value = "general:gaps_workspaces",

src/config/ConfigManager.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,7 @@ CConfigManager::CConfigManager() {
444444
registerConfigVar("general:no_border_on_floating", Hyprlang::INT{0});
445445
registerConfigVar("general:gaps_in", Hyprlang::CConfigCustomValueType{configHandleGapSet, configHandleGapDestroy, "5"});
446446
registerConfigVar("general:gaps_out", Hyprlang::CConfigCustomValueType{configHandleGapSet, configHandleGapDestroy, "20"});
447-
registerConfigVar("general:float_gaps_in", Hyprlang::CConfigCustomValueType{configHandleGapSet, configHandleGapDestroy, "5"});
448-
registerConfigVar("general:float_gaps_out", Hyprlang::CConfigCustomValueType{configHandleGapSet, configHandleGapDestroy, "20"});
447+
registerConfigVar("general:float_gaps", Hyprlang::CConfigCustomValueType{configHandleGapSet, configHandleGapDestroy, "0"});
449448
registerConfigVar("general:gaps_workspaces", Hyprlang::INT{0});
450449
registerConfigVar("general:no_focus_fallback", Hyprlang::INT{0});
451450
registerConfigVar("general:resize_on_border", Hyprlang::INT{0});
@@ -1318,6 +1317,8 @@ SWorkspaceRule CConfigManager::mergeWorkspaceRules(const SWorkspaceRule& rule1,
13181317
mergedRule.gapsIn = rule2.gapsIn;
13191318
if (rule2.gapsOut.has_value())
13201319
mergedRule.gapsOut = rule2.gapsOut;
1320+
if (rule2.float_gaps)
1321+
mergedRule.float_gaps = rule2.float_gaps;
13211322
if (rule2.borderSize.has_value())
13221323
mergedRule.borderSize = rule2.borderSize;
13231324
if (rule2.noBorder.has_value())

src/config/ConfigManager.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ struct SWorkspaceRule {
3636
bool isPersistent = false;
3737
std::optional<CCssGapData> gapsIn;
3838
std::optional<CCssGapData> gapsOut;
39-
std::optional<CCssGapData> float_gapsIn = gapsIn;
40-
std::optional<CCssGapData> float_gapsOut = gapsOut;
39+
std::optional<CCssGapData> float_gaps = gapsOut;
4140
std::optional<int64_t> borderSize;
4241
std::optional<bool> decorate;
4342
std::optional<bool> noRounding;

src/managers/KeybindManager.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,10 +1685,13 @@ SDispatchResult CKeybindManager::moveActiveTo(std::string args) {
16851685

16861686
if (PLASTWINDOW->m_isFloating) {
16871687
std::optional<float> vPosx, vPosy;
1688-
const auto PMONITOR = PLASTWINDOW->m_monitor.lock();
1689-
const auto BORDERSIZE = PLASTWINDOW->getRealBorderSize();
1690-
static auto PGAPSOUTDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:float_gaps_out");
1691-
auto* const PGAPSOUT = (CCssGapData*)(PGAPSOUTDATA.ptr())->getData();
1688+
const auto PMONITOR = PLASTWINDOW->m_monitor.lock();
1689+
const auto BORDERSIZE = PLASTWINDOW->getRealBorderSize();
1690+
static auto PGAPSCUSTOMDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:float_gaps");
1691+
static auto PGAPSOUTDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_out");
1692+
auto* PGAPSOUT = (CCssGapData*)PGAPSCUSTOMDATA.ptr()->getData();
1693+
if (PGAPSOUT->m_left < 0 || PGAPSOUT->m_right < 0 || PGAPSOUT->m_top < 0 || PGAPSOUT->m_bottom < 0)
1694+
PGAPSOUT = (CCssGapData*)PGAPSOUTDATA.ptr()->getData();
16921695

16931696
switch (arg) {
16941697
case 'l': vPosx = PMONITOR->m_reservedTopLeft.x + BORDERSIZE + PMONITOR->m_position.x + PGAPSOUT->m_left; break;

0 commit comments

Comments
 (0)