mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 11:45:58 +01:00
Added moveCursor dispatcher (#2100)
* Added moveCursor dispatcher * fix error message for moveCursor
This commit is contained in:
parent
97b0368765
commit
fbcbe947da
2 changed files with 30 additions and 0 deletions
|
@ -36,6 +36,7 @@ CKeybindManager::CKeybindManager() {
|
|||
m_mDispatchers["splitratio"] = alterSplitRatio;
|
||||
m_mDispatchers["focusmonitor"] = focusMonitor;
|
||||
m_mDispatchers["movecursortocorner"] = moveCursorToCorner;
|
||||
m_mDispatchers["movecursor"] = moveCursor;
|
||||
m_mDispatchers["workspaceopt"] = workspaceOpt;
|
||||
m_mDispatchers["exit"] = exitHyprland;
|
||||
m_mDispatchers["movecurrentworkspacetomonitor"] = moveCurrentWorkspaceToMonitor;
|
||||
|
@ -1304,6 +1305,34 @@ void CKeybindManager::moveCursorToCorner(std::string arg) {
|
|||
}
|
||||
}
|
||||
|
||||
void CKeybindManager::moveCursor(std::string args) {
|
||||
std::string x_str, y_str;
|
||||
int x, y, i;
|
||||
|
||||
i = args.find_first_of(' ');
|
||||
if (i == std::string::npos) {
|
||||
Debug::log(ERR, "moveCursor, takes 2 arguments.");
|
||||
return;
|
||||
}
|
||||
|
||||
x_str = args.substr(0, i);
|
||||
y_str = args.substr(i + 1);
|
||||
|
||||
if (!isNumber(x_str)) {
|
||||
Debug::log(ERR, "moveCursor, x argument has to be a number.");
|
||||
return;
|
||||
}
|
||||
if (!isNumber(y_str)) {
|
||||
Debug::log(ERR, "moveCursor, y argument has to be a number.");
|
||||
return;
|
||||
}
|
||||
|
||||
x = std::stoi(x_str);
|
||||
y = std::stoi(y_str);
|
||||
|
||||
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, x, y);
|
||||
}
|
||||
|
||||
void CKeybindManager::workspaceOpt(std::string args) {
|
||||
|
||||
// current workspace
|
||||
|
|
|
@ -115,6 +115,7 @@ class CKeybindManager {
|
|||
static void focusMonitor(std::string);
|
||||
static void toggleSplit(std::string);
|
||||
static void moveCursorToCorner(std::string);
|
||||
static void moveCursor(std::string);
|
||||
static void workspaceOpt(std::string);
|
||||
static void renameWorkspace(std::string);
|
||||
static void exitHyprland(std::string);
|
||||
|
|
Loading…
Reference in a new issue