mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-15 18:53:40 +01:00
Add no_gaps_when_only
This commit is contained in:
parent
443935232a
commit
b5df8377f6
2 changed files with 22 additions and 11 deletions
10
README.md
10
README.md
|
@ -31,6 +31,16 @@ In your hyprland config replace the following dispatchers:
|
|||
|
||||
You can use `hy3:makegroup` to create a new split.
|
||||
|
||||
### Config fields
|
||||
```conf
|
||||
plugin {
|
||||
hy3 {
|
||||
# disable gaps when only one window is onscreen
|
||||
no_gaps_when_only = <bool>
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Dispatcher list
|
||||
- `hy3:makegroup, <h | v | opposite>` - make a vertical or horizontal split
|
||||
- `hy3:movefocus, <l | u | d | r | left | down | up | right>` - move the focus left, up, down, or right
|
||||
|
|
|
@ -480,10 +480,10 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool force) {
|
|||
const bool display_top = STICKS(node->position.y, monitor->vecPosition.y + monitor->vecReservedTopLeft.y);
|
||||
const bool display_bottom = STICKS(node->position.y + node->size.y, monitor->vecPosition.y + monitor->vecSize.y - monitor->vecReservedBottomRight.y);
|
||||
|
||||
const auto* border_size = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue;
|
||||
const auto* gaps_in = &g_pConfigManager->getConfigValuePtr("general:gaps_in")->intValue;
|
||||
const auto* gaps_out = &g_pConfigManager->getConfigValuePtr("general:gaps_out")->intValue;
|
||||
static auto* const single_window_no_gaps = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:no_gaps_when_only")->intValue;
|
||||
static const auto* border_size = &HyprlandAPI::getConfigValue(PHANDLE, "general:border_size")->intValue;
|
||||
static const auto* gaps_in = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_in")->intValue;
|
||||
static const auto* gaps_out = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_out")->intValue;
|
||||
static const auto* single_window_no_gaps = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:no_gaps_when_only")->intValue;
|
||||
|
||||
if (!g_pCompositor->windowExists(window) || !window->m_bIsMapped) {
|
||||
Debug::log(ERR, "Node %p holding invalid window %p!!", node, window);
|
||||
|
@ -498,14 +498,15 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool force) {
|
|||
auto calcPos = window->m_vPosition + Vector2D(*border_size, *border_size);
|
||||
auto calcSize = window->m_vSize - Vector2D(2 * *border_size, 2 * *border_size);
|
||||
|
||||
const auto workspace_node_count = this->getWorkspaceNodeCount(window->m_iWorkspaceID);
|
||||
auto root_node = this->getWorkspaceRootGroup(window->m_iWorkspaceID);
|
||||
auto only_node = root_node->data.as_group.children.size() == 1
|
||||
&& root_node->data.as_group.children.front()->data.type == Hy3NodeData::Window;
|
||||
|
||||
if (*single_window_no_gaps
|
||||
&& !g_pCompositor->isWorkspaceSpecial(window->m_iWorkspaceID)
|
||||
&& (workspace_node_count == 1
|
||||
|| (window->m_bIsFullscreen
|
||||
&& g_pCompositor->getWorkspaceByID(window->m_iWorkspaceID)->m_efFullscreenMode == FULLSCREEN_MAXIMIZED)))
|
||||
{
|
||||
if (!g_pCompositor->isWorkspaceSpecial(window->m_iWorkspaceID)
|
||||
&& ((*single_window_no_gaps && only_node)
|
||||
|| (window->m_bIsFullscreen
|
||||
&& g_pCompositor->getWorkspaceByID(window->m_iWorkspaceID)->m_efFullscreenMode == FULLSCREEN_FULL))
|
||||
) {
|
||||
window->m_vRealPosition = window->m_vPosition;
|
||||
window->m_vRealSize = window->m_vSize;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue