mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-10-30 14:01:40 +00:00
Added moveCursor dispatcher (#2100)
* Added moveCursor dispatcher * fix error message for moveCursor
This commit is contained in:
parent
97b0368765
commit
fbcbe947da
@ -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 New Issue
Block a user