Merge branch 'master' of https://github.com/DRAGONTOS/hy3 into DRAGONTOS-master

This commit is contained in:
Kaley, Fischer 2024-04-01 22:00:55 +02:00
commit ee6d573296
7 changed files with 134 additions and 61 deletions

View file

@ -1,5 +1,10 @@
# Changelog # Changelog
## hl0.37.1 and before
- Added `no_gaps_when_only = 2`
- Fixed fullscreen not working on workspaces with only floating windows
## hl0.36.0 and before ## hl0.36.0 and before
- Implement `resizeactivewindow` for floating windows - Implement `resizeactivewindow` for floating windows

View file

@ -162,7 +162,10 @@ configuration options, and some explanation as to what they do.
plugin { plugin {
hy3 { hy3 {
# disable gaps when only one window is onscreen # disable gaps when only one window is onscreen
no_gaps_when_only = <bool> # 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 = <int> # default: 0
# policy controlling what happens when a node is removed from a group, # policy controlling what happens when a node is removed from a group,
# leaving only a group # leaving only a group

112
flake.lock generated
View file

@ -1,34 +1,52 @@
{ {
"nodes": { "nodes": {
"hyprcursor": {
"inputs": {
"hyprlang": "hyprlang",
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1710257359,
"narHash": "sha256-43re5pzE/cswFAgw92/ugsB3+d5ufDaCcLtl9ztKfBo=",
"owner": "hyprwm",
"repo": "hyprcursor",
"rev": "1761f6cefd77f4fcd2039d930c88d6716ddc4974",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprcursor",
"type": "github"
}
},
"hyprland": { "hyprland": {
"inputs": { "inputs": {
"hyprcursor": "hyprcursor",
"hyprland-protocols": "hyprland-protocols", "hyprland-protocols": "hyprland-protocols",
"hyprlang": "hyprlang", "hyprlang": "hyprlang_2",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"systems": "systems", "systems": "systems_2",
"wlroots": "wlroots", "wlroots": "wlroots",
"xdph": "xdph" "xdph": "xdph"
}, },
"locked": { "locked": {
<<<<<<< HEAD "lastModified": 1710600709,
"lastModified": 1709720053, "narHash": "sha256-W+34KhCnqscRXN/IkvuJMiVx0Fa64RcYn8H4sZjzceI=",
"narHash": "sha256-hR0RSeqFOXCggqbGhkFZT3ZAbGc2cAoeeyXU3V5J4hU=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "Hyprland", "repo": "Hyprland",
"rev": "d6f1b151b2fe85ffbb131cbdd05acefc6a357e81", "rev": "c5e28ebcfe00a510922779b2c568cfa52a317445",
"type": "github" "type": "github"
=======
"lastModified": 1709080360,
"narHash": "sha256-oZe4k6jtO/0govmERGcbeyvE9EfTvXY5bnyIs6AsL9U=",
"ref": "v0.36.0",
"rev": "1c460e98f870676b15871fe4e5bfeb1a32a3d6d8",
"revCount": 4102,
"type": "git",
"url": "file:///home/admin/programming/outfoxxed/hyprland/Hyprland"
>>>>>>> parent of a392bfd (Fix breakage after hyprland#4911)
}, },
"original": { "original": {
"owner": "hyprwm", "owner": "hyprwm",
"ref": "v0.37.1",
"repo": "Hyprland", "repo": "Hyprland",
"type": "github" "type": "github"
} }
@ -59,6 +77,29 @@
} }
}, },
"hyprlang": { "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": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"hyprland", "hyprland",
@ -70,11 +111,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1708787654, "lastModified": 1709914708,
"narHash": "sha256-7ACgM3ZuAhPqurXHUvR2nWMRcnmzGGPjLK6q4DSTelI=", "narHash": "sha256-bR4o3mynoTa1Wi4ZTjbnsZ6iqVcPGriXp56bZh5UFTk=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprlang", "repo": "hyprlang",
"rev": "0fce791ba2334aca183f2ed42399518947550d0d", "rev": "a685493fdbeec01ca8ccdf1f3655c044a8ce2fe2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -85,11 +126,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1708807242, "lastModified": 1710272261,
"narHash": "sha256-sRTRkhMD4delO/hPxxi+XwLqPn8BuUq6nnj4JqLwOu0=", "narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "73de017ef2d18a04ac4bfd0c02650007ccb31c2a", "rev": "0ad13a6833440b8e238947e47bea7f11071dc2b2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -119,22 +160,37 @@
"type": "github" "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": { "wlroots": {
"flake": false, "flake": false,
"locked": { "locked": {
"host": "gitlab.freedesktop.org", "host": "gitlab.freedesktop.org",
"lastModified": 1708558866, "lastModified": 1709983277,
"narHash": "sha256-Mz6hCtommq7RQfcPnxLINigO4RYSNt23HeJHC6mVmWI=", "narHash": "sha256-wXWIJLd4F2JZeMaihWVDW/yYXCLEC8OpeNJZg9a9ly8=",
"owner": "wlroots", "owner": "wlroots",
"repo": "wlroots", "repo": "wlroots",
"rev": "0cb091f1a2d345f37d2ee445f4ffd04f7f4ec9e5", "rev": "50eae512d9cecbf0b3b1898bb1f0b40fa05fe19b",
"type": "gitlab" "type": "gitlab"
}, },
"original": { "original": {
"host": "gitlab.freedesktop.org", "host": "gitlab.freedesktop.org",
"owner": "wlroots", "owner": "wlroots",
"repo": "wlroots", "repo": "wlroots",
"rev": "0cb091f1a2d345f37d2ee445f4ffd04f7f4ec9e5", "rev": "50eae512d9cecbf0b3b1898bb1f0b40fa05fe19b",
"type": "gitlab" "type": "gitlab"
} }
}, },
@ -158,11 +214,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1708696469, "lastModified": 1709299639,
"narHash": "sha256-shh5wmpeYy3MmsBfkm4f76yPsBDGk6OLYRVG+ARy2F0=", "narHash": "sha256-jYqJM5khksLIbqSxCLUUcqEgI+O2LdlSlcMEBs39CAU=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland", "repo": "xdg-desktop-portal-hyprland",
"rev": "1b713911c2f12b96c2574474686e4027ac4bf826", "rev": "2d2fb547178ec025da643db57d40a971507b82fe",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -1,6 +1,6 @@
{ {
inputs = { inputs = {
hyprland.url = "github:hyprwm/Hyprland"; hyprland.url = "github:hyprwm/Hyprland?ref=v0.37.1";
}; };
outputs = { self, hyprland, ... }: let outputs = { self, hyprland, ... }: let

View file

@ -1,6 +1,12 @@
[repository] [repository]
name = "hy3" name = "hy3"
authors = ["outfoxxed, DRAGONTOS"] authors = ["outfoxxed, DRAGONTOS"]
commit_pins = [
["03ebbe18ed8517ee22591eac82cd54322f42cb7d", "2f28dc810c0e1f42763a1f14fb011c4fce6db8be"],
["84ab8d11e8951a6551d1e1bf87796a8589da6d47", "d3e20856a9896f28b506195b31407eddc6df2e20"],
["1c460e98f870676b15871fe4e5bfeb1a32a3d6d8", "c880e0f00946273ee0304bba9c1de276062d496f"],
["c5e28ebcfe00a510922779b2c568cfa52a317445", "8ac36f3954619a9a5c1a1bb3296f782452987e82"]
]
[hy3] [hy3]
description = "i3 like tiling for hyprland" description = "i3 like tiling for hyprland"

View file

@ -1508,7 +1508,9 @@ Hy3Node* findTabBarAt(Hy3Node& node, Vector2D pos, Hy3Node** focused_node) {
for (auto& tab: tab_bar.bar.entries) { for (auto& tab: tab_bar.bar.entries) {
if (child_iter == children.end()) break; if (child_iter == children.end()) break;
if (x > tab.offset.fl() * size.x && x < (tab.offset.fl() + tab.width.fl()) * size.x) { if (x > tab.offset.value() * size.x
&& x < (tab.offset.value() + tab.width.value()) * size.x)
{
*focused_node = *child_iter; *focused_node = *child_iter;
return &node; return &node;
} }
@ -1864,10 +1866,11 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
if (node->data.type != Hy3NodeType::Window) return; if (node->data.type != Hy3NodeType::Window) return;
auto* window = node->data.as_window; auto* window = node->data.as_window;
auto root_node = this->getWorkspaceRootGroup(window->m_iWorkspaceID); auto root_node = this->getWorkspaceRootGroup(window->m_iWorkspaceID);
if (root_node == nullptr) return;
CMonitor* monitor = nullptr; CMonitor* monitor = nullptr;
auto* workspace = g_pCompositor->getWorkspaceByID(node->workspace_id);
if (g_pCompositor->isWorkspaceSpecial(node->workspace_id)) { if (g_pCompositor->isWorkspaceSpecial(node->workspace_id)) {
for (auto& m: g_pCompositor->m_vMonitors) { for (auto& m: g_pCompositor->m_vMonitors) {
if (m->specialWorkspaceID == node->workspace_id) { if (m->specialWorkspaceID == node->workspace_id) {
@ -1875,12 +1878,8 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
break; break;
} }
} }
} } else {
monitor = g_pCompositor->getMonitorFromID(workspace->m_iMonitorID);
if (monitor == nullptr) {
monitor = g_pCompositor->getMonitorFromID(
g_pCompositor->getWorkspaceByID(node->workspace_id)->m_iMonitorID
);
} }
if (monitor == nullptr) { if (monitor == nullptr) {
@ -1893,9 +1892,11 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
return; return;
} }
const auto workspace_rule = g_pConfigManager->getWorkspaceRuleFor(workspace);
// clang-format off // clang-format off
static const auto gaps_in = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_in"); static const auto gaps_in = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_in");
static const auto single_window_no_gaps = ConfigValue<Hyprlang::INT>("plugin:hy3:no_gaps_when_only"); static const auto no_gaps_when_only = ConfigValue<Hyprlang::INT>("plugin:hy3:no_gaps_when_only");
// clang-format on // clang-format on
if (!g_pCompositor->windowExists(window) || !window->m_bIsMapped) { if (!g_pCompositor->windowExists(window) || !window->m_bIsMapped) {
@ -1911,35 +1912,36 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
return; return;
} }
window->m_vSize = node->size; window->updateSpecialRenderData();
window->m_vPosition = node->position;
auto only_node = root_node->data.as_group.children.size() == 1 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; && root_node->data.as_group.children.front()->data.type == Hy3NodeType::Window;
if (!g_pCompositor->isWorkspaceSpecial(window->m_iWorkspaceID) 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 || (window->m_bIsFullscreen
&& g_pCompositor->getWorkspaceByID(window->m_iWorkspaceID)->m_efFullscreenMode && g_pCompositor->getWorkspaceByID(window->m_iWorkspaceID)->m_efFullscreenMode
== FULLSCREEN_FULL))) == FULLSCREEN_FULL)))
{ {
window->m_sSpecialRenderData.border = workspace_rule.border.value_or(*no_gaps_when_only == 2);
CBox wb = {window->m_vPosition, window->m_vSize}; window->m_sSpecialRenderData.rounding = false;
wb.round(); window->m_sSpecialRenderData.shadow = false;
window->m_vRealPosition = wb.pos();
window->m_vRealSize = wb.size();
window->updateWindowDecos(); window->updateWindowDecos();
window->m_sSpecialRenderData.rounding = false; const auto reserved = window->getFullWindowReservedArea();
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;
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 calcPos = window->m_vPosition;
auto calcSize = window->m_vSize; auto calcSize = window->m_vSize;
@ -1968,7 +1970,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
window->m_vRealPosition = wb.pos(); window->m_vRealPosition = wb.pos();
window->m_vRealSize = wb.size(); window->m_vRealSize = wb.size();
g_pXWaylandManager->setWindowSize(window, calcSize); g_pXWaylandManager->setWindowSize(window, wb.size());
if (no_animation) { if (no_animation) {
g_pHyprRenderer->damageWindow(window); g_pHyprRenderer->damageWindow(window);

View file

@ -396,8 +396,9 @@ void Hy3TabBar::updateAnimations(bool warp) {
auto entry = this->entries.begin(); auto entry = this->entries.begin();
while (entry != this->entries.end()) { while (entry != this->entries.end()) {
if (warp) { if (warp) {
if (entry->width.goalf() == 0.0) { if (entry->width.goal() == 0.0) {
this->entries.erase(entry++); // this->entries.erase(entry++);
entry = std::next(entry);
continue; continue;
} }
@ -613,8 +614,8 @@ void Hy3TabGroup::renderTabBar() {
Vector2D entry_pos = { Vector2D entry_pos = {
(pos.x + (entry.offset.fl() * size.x) + (*padding * 0.5)) * scale, (pos.x + (entry.offset.fl() * size.x) + (*padding * 0.5)) * scale,
scaled_pos.y scaled_pos.y
+ ((entry.vertical_pos.fl() * (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.fl() * size.x) - *padding) * scale, scaled_size.y}; Vector2D entry_size = {((entry.width.fl() * size.x) - *padding) * scale, scaled_size.y};
if (entry_size.x < 0 || entry_size.y < 0 || fade_opacity == 0.0) return; if (entry_size.x < 0 || entry_size.y < 0 || fade_opacity == 0.0) return;