mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 07:45:59 +01:00
support monitor names in moving workspaces
This commit is contained in:
parent
c71b76a9e0
commit
c40ef59a35
1 changed files with 20 additions and 12 deletions
|
@ -793,15 +793,16 @@ void CKeybindManager::exitHyprland(std::string argz) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::moveCurrentWorkspaceToMonitor(std::string args) {
|
void CKeybindManager::moveCurrentWorkspaceToMonitor(std::string args) {
|
||||||
if (!isNumber(args) && !isDirection(args)) {
|
SMonitor* PMONITOR = nullptr;
|
||||||
Debug::log(ERR, "moveCurrentWorkspaceToMonitor arg not a number or direction!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto PMONITOR = isDirection(args) ? g_pCompositor->getMonitorInDirection(args[0]) : g_pCompositor->getMonitorFromID(std::stoi(args));
|
try {
|
||||||
|
if (!isNumber(args) && !isDirection(args)) {
|
||||||
if (!PMONITOR) {
|
PMONITOR = g_pCompositor->getMonitorFromName(args);
|
||||||
Debug::log(ERR, "Ignoring moveCurrentWorkspaceToMonitor: monitor doesnt exist");
|
} 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -821,12 +822,19 @@ void CKeybindManager::moveWorkspaceToMonitor(std::string args) {
|
||||||
std::string workspace = args.substr(0, args.find_first_of(' '));
|
std::string workspace = args.substr(0, args.find_first_of(' '));
|
||||||
std::string monitor = args.substr(args.find_first_of(' ') + 1);
|
std::string monitor = args.substr(args.find_first_of(' ') + 1);
|
||||||
|
|
||||||
if (!isNumber(monitor) && !isDirection(monitor)) {
|
SMonitor* PMONITOR = nullptr;
|
||||||
Debug::log(ERR, "moveWorkspaceToMonitor monitor arg not a number or direction!");
|
|
||||||
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto PMONITOR = isDirection(monitor) ? g_pCompositor->getMonitorInDirection(monitor[0]) : g_pCompositor->getMonitorFromID(std::stoi(monitor));
|
|
||||||
|
|
||||||
if (!PMONITOR){
|
if (!PMONITOR){
|
||||||
Debug::log(ERR, "Ignoring moveWorkspaceToMonitor: monitor doesnt exist");
|
Debug::log(ERR, "Ignoring moveWorkspaceToMonitor: monitor doesnt exist");
|
||||||
|
|
Loading…
Reference in a new issue