mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-15 18:53:40 +01:00
parent
2680b1933b
commit
3be4f0556b
6 changed files with 28 additions and 16 deletions
11
flake.lock
generated
11
flake.lock
generated
|
@ -9,15 +9,16 @@
|
|||
"xdph": "xdph"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1694074808,
|
||||
"narHash": "sha256-gFHAGWaGh5ZM144wPSYJ6EXam3xmyS2wLwjLhjd7OKU=",
|
||||
"owner": "hyprwm",
|
||||
"lastModified": 1694513107,
|
||||
"narHash": "sha256-D+e/iynlvTpa+bi2usdQu3Fva9P3SLx6IiaktNVwYkE=",
|
||||
"owner": "outfoxxed",
|
||||
"repo": "Hyprland",
|
||||
"rev": "0be6b03ee972fcc4921984f3b68469a2ee121511",
|
||||
"rev": "87bb9800bb60b4df36232542c79f8308bf6fb17e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"owner": "outfoxxed",
|
||||
"ref": "bring-window-to-top",
|
||||
"repo": "Hyprland",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
inputs = {
|
||||
hyprland.url = "github:hyprwm/Hyprland";
|
||||
hyprland.url = "github:outfoxxed/Hyprland?ref=bring-window-to-top";
|
||||
};
|
||||
|
||||
outputs = { self, hyprland, ... }: let
|
||||
|
|
|
@ -715,10 +715,14 @@ void Hy3Layout::replaceWindowDataWith(CWindow* from, CWindow* to) {
|
|||
this->applyNodeDataToWindow(node);
|
||||
}
|
||||
|
||||
void Hy3Layout::requestFocusForWindow(CWindow* window) {
|
||||
bool Hy3Layout::isWindowReachable(CWindow* window) {
|
||||
return this->getNodeFromWindow(window) != nullptr || IHyprLayout::isWindowReachable(window);
|
||||
}
|
||||
|
||||
void Hy3Layout::bringWindowToTop(CWindow* window) {
|
||||
auto node = this->getNodeFromWindow(window);
|
||||
if (node == nullptr) return;
|
||||
node->focusWindow();
|
||||
node->bringToTop();
|
||||
}
|
||||
|
||||
void Hy3Layout::onEnable() {
|
||||
|
|
|
@ -84,7 +84,8 @@ public:
|
|||
virtual std::string getLayoutName();
|
||||
virtual CWindow* getNextWindowCandidate(CWindow*);
|
||||
virtual void replaceWindowDataWith(CWindow* from, CWindow* to);
|
||||
virtual void requestFocusForWindow(CWindow*);
|
||||
virtual bool isWindowReachable(CWindow*);
|
||||
virtual void bringWindowToTop(CWindow*);
|
||||
|
||||
virtual void onEnable();
|
||||
virtual void onDisable();
|
||||
|
|
|
@ -153,29 +153,34 @@ void Hy3Node::focus() {
|
|||
}
|
||||
}
|
||||
|
||||
bool Hy3Node::focusWindow() {
|
||||
CWindow* Hy3Node::bringToTop() {
|
||||
switch (this->data.type) {
|
||||
case Hy3NodeType::Window:
|
||||
this->markFocused();
|
||||
this->data.as_window->setHidden(false);
|
||||
g_pCompositor->focusWindow(this->data.as_window);
|
||||
|
||||
return true;
|
||||
return this->data.as_window;
|
||||
case Hy3NodeType::Group:
|
||||
if (this->data.as_group.layout == Hy3GroupLayout::Tabbed) {
|
||||
if (this->data.as_group.focused_child != nullptr) {
|
||||
return this->data.as_group.focused_child->focusWindow();
|
||||
return this->data.as_group.focused_child->bringToTop();
|
||||
}
|
||||
} else {
|
||||
for (auto* node: this->data.as_group.children) {
|
||||
if (node->focusWindow()) break;
|
||||
auto* window = node->bringToTop();
|
||||
if (window != nullptr) return window;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void Hy3Node::focusWindow() {
|
||||
auto* window = this->bringToTop();
|
||||
if (window != nullptr) g_pCompositor->focusWindow(window);
|
||||
}
|
||||
|
||||
void markGroupFocusedRecursive(Hy3GroupData& group) {
|
||||
group.group_focused = true;
|
||||
for (auto& child: group.children) {
|
||||
|
|
|
@ -92,7 +92,8 @@ struct Hy3Node {
|
|||
bool operator==(const Hy3Node&) const;
|
||||
|
||||
void focus();
|
||||
bool focusWindow();
|
||||
void focusWindow();
|
||||
CWindow* bringToTop();
|
||||
void markFocused();
|
||||
void raiseToTop();
|
||||
Hy3Node* getFocusedNode(bool ignore_group_focus = false, bool stop_at_expanded = false);
|
||||
|
|
Loading…
Add table
Reference in a new issue