mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-15 18:53:40 +01:00
feat: add hy3:warpcursor
This commit is contained in:
parent
311939d443
commit
584a1b1e35
5 changed files with 24 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
## Upcoming
|
||||
|
||||
- Added `hy3:warpcursor` dispatcher to warp cursor to current node.
|
||||
- Added cursor warping options for `hy3:movefocus`.
|
||||
|
||||
## hl0.37.1 and before
|
||||
|
|
|
@ -321,6 +321,7 @@ plugin {
|
|||
- `visible` - only move between visible nodes, not hidden tabs
|
||||
- `warp` - warp the mouse to the selected window, even if `general:no_cursor_warps` is true.
|
||||
- `nowarp` - does not warp the mouse to the selected window, even if `general:no_cursor_warps` is false.
|
||||
- `hy3:warpcursor` - warp the cursor to the center of the focused node
|
||||
- `hy3:movewindow, <l | u | d | r | left | down | up | right>, [once], [visible]` - move a window left, up, down, or right
|
||||
- `once` - only move directly to the neighboring group, without moving into any of its subgroups
|
||||
- `visible` - only move between visible nodes, not hidden tabs
|
||||
|
|
|
@ -925,6 +925,22 @@ void Hy3Layout::shiftFocus(
|
|||
}
|
||||
}
|
||||
|
||||
void Hy3Layout::warpCursor() {
|
||||
auto current_window = g_pCompositor->m_pLastWindow.lock();
|
||||
|
||||
if (current_window != nullptr) {
|
||||
if (current_window != nullptr) {
|
||||
g_pCompositor->warpCursorTo(current_window->middle(), true);
|
||||
}
|
||||
} else {
|
||||
auto* node = this->getWorkspaceFocusedNode(g_pCompositor->m_pLastMonitor->activeWorkspace);
|
||||
|
||||
if (node != nullptr) {
|
||||
g_pCompositor->warpCursorTo(node->position + node->size / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void changeNodeWorkspaceRecursive(Hy3Node& node, const PHLWORKSPACE& workspace) {
|
||||
node.workspace = workspace;
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@ public:
|
|||
void shiftNode(Hy3Node&, ShiftDirection, bool once, bool visible);
|
||||
void shiftWindow(const PHLWORKSPACE& workspace, ShiftDirection, bool once, bool visible);
|
||||
void shiftFocus(const PHLWORKSPACE& workspace, ShiftDirection, bool visible, bool warp);
|
||||
void warpCursor();
|
||||
void moveNodeToWorkspace(const PHLWORKSPACE& origin, std::string wsname, bool follow);
|
||||
void changeFocus(const PHLWORKSPACE& workspace, FocusShift);
|
||||
void focusTab(
|
||||
|
|
|
@ -129,6 +129,10 @@ void dispatch_movefocus(std::string value) {
|
|||
g_Hy3Layout->shiftFocus(workspace, shift.value(), visible, warp_cursor);
|
||||
}
|
||||
|
||||
void dispatch_warpcursor(std::string value) {
|
||||
g_Hy3Layout->warpCursor();
|
||||
}
|
||||
|
||||
void dispatch_move_to_workspace(std::string value) {
|
||||
auto origin_workspace = workspace_for_action(true);
|
||||
if (!valid(origin_workspace)) return;
|
||||
|
@ -259,6 +263,7 @@ void registerDispatchers() {
|
|||
HyprlandAPI::addDispatcher(PHANDLE, "hy3:changegroup", dispatch_changegroup);
|
||||
HyprlandAPI::addDispatcher(PHANDLE, "hy3:setephemeral", dispatch_setephemeral);
|
||||
HyprlandAPI::addDispatcher(PHANDLE, "hy3:movefocus", dispatch_movefocus);
|
||||
HyprlandAPI::addDispatcher(PHANDLE, "hy3:warpcursor", dispatch_warpcursor);
|
||||
HyprlandAPI::addDispatcher(PHANDLE, "hy3:movewindow", dispatch_movewindow);
|
||||
HyprlandAPI::addDispatcher(PHANDLE, "hy3:movetoworkspace", dispatch_move_to_workspace);
|
||||
HyprlandAPI::addDispatcher(PHANDLE, "hy3:changefocus", dispatch_changefocus);
|
||||
|
|
Loading…
Add table
Reference in a new issue