From 5736875600a37aa95dd8f8cab9e5e77e9b0a6fd5 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Thu, 21 Mar 2024 23:12:57 -0700 Subject: [PATCH 1/5] nix: update locked hyprland to 0.37.1 --- flake.lock | 112 ++++++++++++++++++++++++++++++++++++++++++----------- flake.nix | 2 +- 2 files changed, 90 insertions(+), 24 deletions(-) diff --git a/flake.lock b/flake.lock index 6695ff8..0c583ea 100644 --- a/flake.lock +++ b/flake.lock @@ -1,24 +1,52 @@ { "nodes": { - "hyprland": { + "hyprcursor": { "inputs": { - "hyprland-protocols": "hyprland-protocols", "hyprlang": "hyprlang", - "nixpkgs": "nixpkgs", - "systems": "systems", - "wlroots": "wlroots", - "xdph": "xdph" + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] }, "locked": { - "lastModified": 1709720053, - "narHash": "sha256-hR0RSeqFOXCggqbGhkFZT3ZAbGc2cAoeeyXU3V5J4hU=", + "lastModified": 1710257359, + "narHash": "sha256-43re5pzE/cswFAgw92/ugsB3+d5ufDaCcLtl9ztKfBo=", "owner": "hyprwm", - "repo": "Hyprland", - "rev": "d6f1b151b2fe85ffbb131cbdd05acefc6a357e81", + "repo": "hyprcursor", + "rev": "1761f6cefd77f4fcd2039d930c88d6716ddc4974", "type": "github" }, "original": { "owner": "hyprwm", + "repo": "hyprcursor", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprcursor": "hyprcursor", + "hyprland-protocols": "hyprland-protocols", + "hyprlang": "hyprlang_2", + "nixpkgs": "nixpkgs", + "systems": "systems_2", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1710600709, + "narHash": "sha256-W+34KhCnqscRXN/IkvuJMiVx0Fa64RcYn8H4sZjzceI=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "c5e28ebcfe00a510922779b2c568cfa52a317445", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "ref": "v0.37.1", "repo": "Hyprland", "type": "github" } @@ -49,6 +77,29 @@ } }, "hyprlang": { + "inputs": { + "nixpkgs": [ + "hyprland", + "hyprcursor", + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1709914708, + "narHash": "sha256-bR4o3mynoTa1Wi4ZTjbnsZ6iqVcPGriXp56bZh5UFTk=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "a685493fdbeec01ca8ccdf1f3655c044a8ce2fe2", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprlang_2": { "inputs": { "nixpkgs": [ "hyprland", @@ -60,11 +111,11 @@ ] }, "locked": { - "lastModified": 1708787654, - "narHash": "sha256-7ACgM3ZuAhPqurXHUvR2nWMRcnmzGGPjLK6q4DSTelI=", + "lastModified": 1709914708, + "narHash": "sha256-bR4o3mynoTa1Wi4ZTjbnsZ6iqVcPGriXp56bZh5UFTk=", "owner": "hyprwm", "repo": "hyprlang", - "rev": "0fce791ba2334aca183f2ed42399518947550d0d", + "rev": "a685493fdbeec01ca8ccdf1f3655c044a8ce2fe2", "type": "github" }, "original": { @@ -75,11 +126,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1708807242, - "narHash": "sha256-sRTRkhMD4delO/hPxxi+XwLqPn8BuUq6nnj4JqLwOu0=", + "lastModified": 1710272261, + "narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "73de017ef2d18a04ac4bfd0c02650007ccb31c2a", + "rev": "0ad13a6833440b8e238947e47bea7f11071dc2b2", "type": "github" }, "original": { @@ -109,22 +160,37 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, "wlroots": { "flake": false, "locked": { "host": "gitlab.freedesktop.org", - "lastModified": 1708558866, - "narHash": "sha256-Mz6hCtommq7RQfcPnxLINigO4RYSNt23HeJHC6mVmWI=", + "lastModified": 1709983277, + "narHash": "sha256-wXWIJLd4F2JZeMaihWVDW/yYXCLEC8OpeNJZg9a9ly8=", "owner": "wlroots", "repo": "wlroots", - "rev": "0cb091f1a2d345f37d2ee445f4ffd04f7f4ec9e5", + "rev": "50eae512d9cecbf0b3b1898bb1f0b40fa05fe19b", "type": "gitlab" }, "original": { "host": "gitlab.freedesktop.org", "owner": "wlroots", "repo": "wlroots", - "rev": "0cb091f1a2d345f37d2ee445f4ffd04f7f4ec9e5", + "rev": "50eae512d9cecbf0b3b1898bb1f0b40fa05fe19b", "type": "gitlab" } }, @@ -148,11 +214,11 @@ ] }, "locked": { - "lastModified": 1708696469, - "narHash": "sha256-shh5wmpeYy3MmsBfkm4f76yPsBDGk6OLYRVG+ARy2F0=", + "lastModified": 1709299639, + "narHash": "sha256-jYqJM5khksLIbqSxCLUUcqEgI+O2LdlSlcMEBs39CAU=", "owner": "hyprwm", "repo": "xdg-desktop-portal-hyprland", - "rev": "1b713911c2f12b96c2574474686e4027ac4bf826", + "rev": "2d2fb547178ec025da643db57d40a971507b82fe", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a375308..51a4a28 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - hyprland.url = "github:hyprwm/Hyprland"; + hyprland.url = "github:hyprwm/Hyprland?ref=v0.37.1"; }; outputs = { self, hyprland, ... }: let From 160fe1dda5521961d317e8dcf5d71d60fc071a0d Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Thu, 21 Mar 2024 23:13:48 -0700 Subject: [PATCH 2/5] layout: fix maximize failing for workspaces with no tiled windows --- CHANGELOG.md | 3 +++ src/Hy3Layout.cpp | 7 ++++--- src/TabGroup.cpp | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ad188b..42aea67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## Upcoming +- Fixed fullscreen not working on workspaces with only floating windows + ## hl0.36.0 and before - Implement `resizeactivewindow` for floating windows diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp index 2b0fb0f..c4208d8 100644 --- a/src/Hy3Layout.cpp +++ b/src/Hy3Layout.cpp @@ -1092,7 +1092,9 @@ Hy3Node* findTabBarAt(Hy3Node& node, Vector2D pos, Hy3Node** focused_node) { for (auto& tab: tab_bar.bar.entries) { if (child_iter == children.end()) break; - if (x > tab.offset.value() * size.x && x < (tab.offset.value() + tab.width.value()) * size.x) { + if (x > tab.offset.value() * size.x + && x < (tab.offset.value() + tab.width.value()) * size.x) + { *focused_node = *child_iter; return &node; } @@ -1448,7 +1450,6 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) { if (node->data.type != Hy3NodeType::Window) return; auto* window = node->data.as_window; auto root_node = this->getWorkspaceRootGroup(window->m_iWorkspaceID); - if (root_node == nullptr) return; CMonitor* monitor = nullptr; @@ -1496,7 +1497,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) { window->m_vSize = node->size; window->m_vPosition = node->position; - auto only_node = root_node->data.as_group.children.size() == 1 + auto only_node = root_node != nullptr && root_node->data.as_group.children.size() == 1 && root_node->data.as_group.children.front()->data.type == Hy3NodeType::Window; if (!g_pCompositor->isWorkspaceSpecial(window->m_iWorkspaceID) diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp index d400f04..5483683 100644 --- a/src/TabGroup.cpp +++ b/src/TabGroup.cpp @@ -390,7 +390,7 @@ void Hy3TabBar::updateAnimations(bool warp) { while (entry != this->entries.end()) { if (warp) { if (entry->width.goal() == 0.0) { - //this->entries.erase(entry++); + // this->entries.erase(entry++); entry = std::next(entry); continue; } @@ -605,8 +605,8 @@ void Hy3TabGroup::renderTabBar() { Vector2D entry_pos = { (pos.x + (entry.offset.value() * size.x) + (*padding * 0.5)) * scale, scaled_pos.y - + ((entry.vertical_pos.value() * (size.y + *padding) * scale) * (*enter_from_top ? -1 : 1) - ), + + ((entry.vertical_pos.value() * (size.y + *padding) * scale) + * (*enter_from_top ? -1 : 1)), }; Vector2D entry_size = {((entry.width.value() * size.x) - *padding) * scale, scaled_size.y}; if (entry_size.x < 0 || entry_size.y < 0 || fade_opacity == 0.0) return; From 8ac36f3954619a9a5c1a1bb3296f782452987e82 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Fri, 22 Mar 2024 00:37:13 -0700 Subject: [PATCH 3/5] layout: add no_gaps_when_only=2 Also clean up window special render data, which may fix some unreported bugs. Closes #61 --- CHANGELOG.md | 2 ++ README.md | 5 ++++- src/Hy3Layout.cpp | 45 ++++++++++++++++++++++++--------------------- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42aea67..a96935f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## Upcoming + +- Added `no_gaps_when_only = 2` - Fixed fullscreen not working on workspaces with only floating windows ## hl0.36.0 and before diff --git a/README.md b/README.md index a059ee6..ef2dda8 100644 --- a/README.md +++ b/README.md @@ -212,7 +212,10 @@ configuration options, and some explanation as to what they do. plugin { hy3 { # disable gaps when only one window is onscreen - no_gaps_when_only = # default: false + # 0 - always show gaps + # 1 - hide gaps with a single window onscreen + # 2 - 1 but also show the window border + no_gaps_when_only = # default: 0 # policy controlling what happens when a node is removed from a group, # leaving only a group diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp index c4208d8..b1f1773 100644 --- a/src/Hy3Layout.cpp +++ b/src/Hy3Layout.cpp @@ -1453,6 +1453,8 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) { CMonitor* monitor = nullptr; + auto* workspace = g_pCompositor->getWorkspaceByID(node->workspace_id); + if (g_pCompositor->isWorkspaceSpecial(node->workspace_id)) { for (auto& m: g_pCompositor->m_vMonitors) { if (m->specialWorkspaceID == node->workspace_id) { @@ -1461,9 +1463,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) { } } } else { - monitor = g_pCompositor->getMonitorFromID( - g_pCompositor->getWorkspaceByID(node->workspace_id)->m_iMonitorID - ); + monitor = g_pCompositor->getMonitorFromID(workspace->m_iMonitorID); } if (monitor == nullptr) { @@ -1476,9 +1476,11 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) { return; } + const auto workspace_rule = g_pConfigManager->getWorkspaceRuleFor(workspace); + // clang-format off static const auto gaps_in = ConfigValue("general:gaps_in"); - static const auto single_window_no_gaps = ConfigValue("plugin:hy3:no_gaps_when_only"); + static const auto no_gaps_when_only = ConfigValue("plugin:hy3:no_gaps_when_only"); // clang-format on if (!g_pCompositor->windowExists(window) || !window->m_bIsMapped) { @@ -1494,35 +1496,36 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) { return; } - window->m_vSize = node->size; - window->m_vPosition = node->position; + window->updateSpecialRenderData(); + + auto nodeBox = CBox(node->position, node->size); + nodeBox.round(); + + window->m_vSize = nodeBox.size(); + window->m_vPosition = nodeBox.pos(); auto only_node = root_node != nullptr && root_node->data.as_group.children.size() == 1 && root_node->data.as_group.children.front()->data.type == Hy3NodeType::Window; if (!g_pCompositor->isWorkspaceSpecial(window->m_iWorkspaceID) - && ((*single_window_no_gaps && (only_node || window->m_bIsFullscreen)) + && ((*no_gaps_when_only != 0 && (only_node || window->m_bIsFullscreen)) || (window->m_bIsFullscreen && g_pCompositor->getWorkspaceByID(window->m_iWorkspaceID)->m_efFullscreenMode == FULLSCREEN_FULL))) { - - CBox wb = {window->m_vPosition, window->m_vSize}; - wb.round(); - - window->m_vRealPosition = wb.pos(); - window->m_vRealSize = wb.size(); + window->m_sSpecialRenderData.border = workspace_rule.border.value_or(*no_gaps_when_only == 2); + window->m_sSpecialRenderData.rounding = false; + window->m_sSpecialRenderData.shadow = false; window->updateWindowDecos(); - window->m_sSpecialRenderData.rounding = false; - window->m_sSpecialRenderData.border = false; - window->m_sSpecialRenderData.decorate = false; - } else { - window->m_sSpecialRenderData.rounding = true; - window->m_sSpecialRenderData.border = true; - window->m_sSpecialRenderData.decorate = true; + const auto reserved = window->getFullWindowReservedArea(); + window->m_vRealPosition = window->m_vPosition + reserved.topLeft; + window->m_vRealSize = window->m_vSize - (reserved.topLeft + reserved.bottomRight); + + g_pXWaylandManager->setWindowSize(window, window->m_vRealSize.goal()); + } else { auto calcPos = window->m_vPosition; auto calcSize = window->m_vSize; @@ -1544,7 +1547,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) { window->m_vRealPosition = wb.pos(); window->m_vRealSize = wb.size(); - g_pXWaylandManager->setWindowSize(window, calcSize); + g_pXWaylandManager->setWindowSize(window, wb.size()); if (no_animation) { g_pHyprRenderer->damageWindow(window); From 7abc6f72a94b95a1e43059cab5171dd003737cb8 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Fri, 22 Mar 2024 00:52:19 -0700 Subject: [PATCH 4/5] version: bump version to hl0.37.1 --- CHANGELOG.md | 2 +- hyprpm.toml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a96935f..ec064b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Upcoming +## hl0.37.1 and before - Added `no_gaps_when_only = 2` - Fixed fullscreen not working on workspaces with only floating windows diff --git a/hyprpm.toml b/hyprpm.toml index f1ba8c9..09b5f96 100644 --- a/hyprpm.toml +++ b/hyprpm.toml @@ -4,7 +4,8 @@ authors = ["outfoxxed"] commit_pins = [ ["03ebbe18ed8517ee22591eac82cd54322f42cb7d", "2f28dc810c0e1f42763a1f14fb011c4fce6db8be"], ["84ab8d11e8951a6551d1e1bf87796a8589da6d47", "d3e20856a9896f28b506195b31407eddc6df2e20"], - ["1c460e98f870676b15871fe4e5bfeb1a32a3d6d8", "c880e0f00946273ee0304bba9c1de276062d496f"] + ["1c460e98f870676b15871fe4e5bfeb1a32a3d6d8", "c880e0f00946273ee0304bba9c1de276062d496f"], + ["c5e28ebcfe00a510922779b2c568cfa52a317445", "8ac36f3954619a9a5c1a1bb3296f782452987e82"] ] [hy3] From aa50c3e82d7683570994d48dc2d72e99398f305e Mon Sep 17 00:00:00 2001 From: DRAGONTOS Date: Mon, 1 Apr 2024 21:51:38 +0200 Subject: [PATCH 5/5] fix --- Makefile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d27dcdb --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +NAME = hy3 +PREFIX = /usr + +all: + $(MAKE) clear + $(MAKE) release + +release: + cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DLEGACY_RENDERER:BOOL=true -S . -B ./build -G Ninja + cmake --build ./build + chmod -R 777 ./build + +clear: + rm -rf build + +install.core: + @if [ ! -f ./build/libhy3.so ]; then echo -en "You need to run $(MAKE) all first.\n" && exit 1; fi + @echo -en "!NOTE: Please note make install does not compile Hy3 and only installs the already built files." + mkdir -p ${PREFIX}/lib + cp -f ./build/libhy3.so ${PREFIX}/lib + chmod 755 ${PREFIX}/lib/libhy3.so + +install: install.core + +uninstall: