aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/config/ConfigDescriptions.hpp
diff options
context:
space:
mode:
authorMike Will <[email protected]>2024-10-21 11:08:25 -0400
committerGitHub <[email protected]>2024-10-21 16:08:25 +0100
commit4093b993a2c79ce576702641134d745ab97c6b2c (patch)
tree2e99e1c7780d78be0720f027ecea14619fdfd3c2 /src/config/ConfigDescriptions.hpp
parent08cc063e175e48cea44d26b7e3762f4b8611f0c5 (diff)
downloadHyprland-4093b993a2c79ce576702641134d745ab97c6b2c.tar.gz
Hyprland-4093b993a2c79ce576702641134d745ab97c6b2c.zip
input: add snapping to floating windows (#8088)
* add snapping to floating windows Works for both moving and resizing of windows. It comes with 3 options: `general:snap:enabled` - whether it's enabled, off by default `general:snap:window_gap` - minimum gap in pixels between windows before snapping. Setting to 0 effectively turns off this method of snapping. `general:snap:monitor_gap` - minimum gap in pixels between window and monitor edges before snapping. Again, setting it to 0 effectively turns it off. * snap: add more ignore criteria and change if clause into a guard * snap: refactor code * snap: new refactoring approach and account for border size * snap: do corner snapping after all edge snapping is done The approach of performing corner snaps after each individual edge snap results in far fewer scenarios where snapping can occur. After trying it out for a while, I found that I prefer an approach that's more prone to snapping. * snap: combine snapWindows and snapMonitor into a single function * snap: add forced aspect ratio functionality * snap: avoid directly referring to border_size config value * snap: address vaxerski feedback - add new line between functions - use std::function typedef for SnapFn and make snap functions static - avoid uninitialized variable declarations. - change ignore condition m_bIsX11 to isX11OverrideRedirect() - use braces for CBox and Vector2D declarations. - add SNAP_INVALID to eSnapEdge enum - use bitshift notation for eSnapEdge and eRectCorner - make performSnap a non-member function. * snap: add corner-snapping to forced aspect ratio mode
Diffstat (limited to 'src/config/ConfigDescriptions.hpp')
-rw-r--r--src/config/ConfigDescriptions.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/config/ConfigDescriptions.hpp b/src/config/ConfigDescriptions.hpp
index bef5ee53..7e2dd1be 100644
--- a/src/config/ConfigDescriptions.hpp
+++ b/src/config/ConfigDescriptions.hpp
@@ -104,6 +104,24 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
.type = CONFIG_OPTION_INT,
.data = SConfigOptionDescription::SRangeData{0, 0, 4},
},
+ SConfigOptionDescription{
+ .value = "general:snap:enabled",
+ .description = "enable snapping for floating windows",
+ .type = CONFIG_OPTION_BOOL,
+ .data = SConfigOptionDescription::SBoolData{false},
+ },
+ SConfigOptionDescription{
+ .value = "general:snap:window_gap",
+ .description = "minimum gap in pixels between windows before snapping",
+ .type = CONFIG_OPTION_INT,
+ .data = SConfigOptionDescription::SRangeData{10, 0, 100},
+ },
+ SConfigOptionDescription{
+ .value = "general:snap:monitor_gap",
+ .description = "minimum gap in pixels between window and monitor edges before snapping",
+ .type = CONFIG_OPTION_INT,
+ .data = SConfigOptionDescription::SRangeData{10, 0, 100},
+ },
/*
* decoration: