summaryrefslogtreecommitdiff
path: root/src/managers/KeybindManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-09-02 11:53:12 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-09-02 11:53:12 +0200
commitf5697095bc11a10ac260849d7685240538880153 (patch)
treee45d209a63810f693489c445b62b061e7a7fc26d /src/managers/KeybindManager.cpp
parent56203b175752b49c46eb9303c37b80cd4c2dfcf8 (diff)
unify monitor args
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r--src/managers/KeybindManager.cpp27
1 files changed, 2 insertions, 25 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index ec0c9516..4abf1e76 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -1138,18 +1138,7 @@ void CKeybindManager::exitHyprland(std::string argz) {
}
void CKeybindManager::moveCurrentWorkspaceToMonitor(std::string args) {
- CMonitor* PMONITOR = nullptr;
-
- try {
- if (!isNumber(args) && !isDirection(args)) {
- PMONITOR = g_pCompositor->getMonitorFromName(args);
- } else {
- PMONITOR = isDirection(args) ? g_pCompositor->getMonitorInDirection(args[0]) : g_pCompositor->getMonitorFromID(std::stoi(args));
- }
- } catch (std::exception& e) {
- Debug::log(LOG, "moveCurrentWorkspaceToMonitor: caught exception in monitor", e.what());
- return;
- }
+ CMonitor* PMONITOR = g_pCompositor->getMonitorFromString(args);
if (!PMONITOR)
return;
@@ -1170,19 +1159,7 @@ void CKeybindManager::moveWorkspaceToMonitor(std::string args) {
std::string workspace = args.substr(0, args.find_first_of(' '));
std::string monitor = args.substr(args.find_first_of(' ') + 1);
- CMonitor* PMONITOR = nullptr;
-
- try {
- if (!isNumber(monitor) && !isDirection(monitor)) {
- PMONITOR = g_pCompositor->getMonitorFromName(monitor);
- } else {
- PMONITOR = isDirection(monitor) ? g_pCompositor->getMonitorInDirection(monitor[0]) : g_pCompositor->getMonitorFromID(std::stoi(monitor));
- }
- } catch (std::exception& e) {
- Debug::log(LOG, "moveWorkspaceToMonitor: caught exception in monitor", e.what());
- return;
- }
-
+ const auto PMONITOR = g_pCompositor->getMonitorFromString(monitor);
if (!PMONITOR){
Debug::log(ERR, "Ignoring moveWorkspaceToMonitor: monitor doesnt exist");