mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-02 01:05:59 +01:00
keybinds: Add option to disable window direction monitor fallback (#6182)
* add monitor fallback option * format
This commit is contained in:
parent
93fea89043
commit
155ae3721c
3 changed files with 22 additions and 5 deletions
|
@ -1386,7 +1386,8 @@ PHLWINDOW CCompositor::getWindowInDirection(PHLWINDOW pWindow, char dir) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// 0 -> history, 1 -> shared length
|
// 0 -> history, 1 -> shared length
|
||||||
static auto PMETHOD = CConfigValue<Hyprlang::INT>("binds:focus_preferred_method");
|
static auto PMETHOD = CConfigValue<Hyprlang::INT>("binds:focus_preferred_method");
|
||||||
|
static auto PMONITORFALLBACK = CConfigValue<Hyprlang::INT>("binds:window_direction_monitor_fallback");
|
||||||
|
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
|
||||||
|
|
||||||
|
@ -1416,6 +1417,9 @@ PHLWINDOW CCompositor::getWindowInDirection(PHLWINDOW pWindow, char dir) {
|
||||||
if (PWORKSPACE->m_bHasFullscreenWindow && !w->m_bIsFullscreen && !w->m_bCreatedOverFullscreen)
|
if (PWORKSPACE->m_bHasFullscreenWindow && !w->m_bIsFullscreen && !w->m_bCreatedOverFullscreen)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!*PMONITORFALLBACK && pWindow->m_iMonitorID != w->m_iMonitorID)
|
||||||
|
continue;
|
||||||
|
|
||||||
const auto BWINDOWIDEALBB = w->getWindowIdealBoundingBoxIgnoreReserved();
|
const auto BWINDOWIDEALBB = w->getWindowIdealBoundingBoxIgnoreReserved();
|
||||||
|
|
||||||
const auto POSB = Vector2D(BWINDOWIDEALBB.x, BWINDOWIDEALBB.y);
|
const auto POSB = Vector2D(BWINDOWIDEALBB.x, BWINDOWIDEALBB.y);
|
||||||
|
@ -1505,6 +1509,9 @@ PHLWINDOW CCompositor::getWindowInDirection(PHLWINDOW pWindow, char dir) {
|
||||||
if (PWORKSPACE->m_bHasFullscreenWindow && !w->m_bIsFullscreen && !w->m_bCreatedOverFullscreen)
|
if (PWORKSPACE->m_bHasFullscreenWindow && !w->m_bIsFullscreen && !w->m_bCreatedOverFullscreen)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!*PMONITORFALLBACK && pWindow->m_iMonitorID != w->m_iMonitorID)
|
||||||
|
continue;
|
||||||
|
|
||||||
const auto DIST = w->middle().distance(pWindow->middle());
|
const auto DIST = w->middle().distance(pWindow->middle());
|
||||||
const auto ANGLE = vectorAngles(Vector2D{w->middle() - pWindow->middle()}, VECTORS.at(dir));
|
const auto ANGLE = vectorAngles(Vector2D{w->middle() - pWindow->middle()}, VECTORS.at(dir));
|
||||||
|
|
||||||
|
|
|
@ -495,6 +495,7 @@ CConfigManager::CConfigManager() {
|
||||||
m_pConfig->addConfigValue("binds:ignore_group_lock", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("binds:ignore_group_lock", Hyprlang::INT{0});
|
||||||
m_pConfig->addConfigValue("binds:movefocus_cycles_fullscreen", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("binds:movefocus_cycles_fullscreen", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("binds:disable_keybind_grabbing", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("binds:disable_keybind_grabbing", Hyprlang::INT{0});
|
||||||
|
m_pConfig->addConfigValue("binds:window_direction_monitor_fallback", Hyprlang::INT{1});
|
||||||
|
|
||||||
m_pConfig->addConfigValue("gestures:workspace_swipe", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("gestures:workspace_swipe", Hyprlang::INT{0});
|
||||||
m_pConfig->addConfigValue("gestures:workspace_swipe_fingers", Hyprlang::INT{3});
|
m_pConfig->addConfigValue("gestures:workspace_swipe_fingers", Hyprlang::INT{3});
|
||||||
|
|
|
@ -1220,8 +1220,9 @@ void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::moveFocusTo(std::string args) {
|
void CKeybindManager::moveFocusTo(std::string args) {
|
||||||
static auto PFULLCYCLE = CConfigValue<Hyprlang::INT>("binds:movefocus_cycles_fullscreen");
|
static auto PFULLCYCLE = CConfigValue<Hyprlang::INT>("binds:movefocus_cycles_fullscreen");
|
||||||
char arg = args[0];
|
static auto PMONITORFALLBACK = CConfigValue<Hyprlang::INT>("binds:window_direction_monitor_fallback");
|
||||||
|
char arg = args[0];
|
||||||
|
|
||||||
if (!isDirection(args)) {
|
if (!isDirection(args)) {
|
||||||
Debug::log(ERR, "Cannot move focus in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg);
|
Debug::log(ERR, "Cannot move focus in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg);
|
||||||
|
@ -1230,7 +1231,9 @@ void CKeybindManager::moveFocusTo(std::string args) {
|
||||||
|
|
||||||
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
|
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
if (!PLASTWINDOW) {
|
if (!PLASTWINDOW) {
|
||||||
tryMoveFocusToMonitor(g_pCompositor->getMonitorInDirection(arg));
|
if (*PMONITORFALLBACK)
|
||||||
|
tryMoveFocusToMonitor(g_pCompositor->getMonitorInDirection(arg));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1246,7 +1249,7 @@ void CKeybindManager::moveFocusTo(std::string args) {
|
||||||
|
|
||||||
Debug::log(LOG, "No window found in direction {}, looking for a monitor", arg);
|
Debug::log(LOG, "No window found in direction {}, looking for a monitor", arg);
|
||||||
|
|
||||||
if (tryMoveFocusToMonitor(g_pCompositor->getMonitorInDirection(arg)))
|
if (*PMONITORFALLBACK && tryMoveFocusToMonitor(g_pCompositor->getMonitorInDirection(arg)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
static auto PNOFALLBACK = CConfigValue<Hyprlang::INT>("general:no_focus_fallback");
|
static auto PNOFALLBACK = CConfigValue<Hyprlang::INT>("general:no_focus_fallback");
|
||||||
|
@ -1317,6 +1320,8 @@ void CKeybindManager::moveActiveTo(std::string args) {
|
||||||
moveActiveToWorkspaceSilent(PNEWMONITOR->activeWorkspace->getConfigName());
|
moveActiveToWorkspaceSilent(PNEWMONITOR->activeWorkspace->getConfigName());
|
||||||
else
|
else
|
||||||
moveActiveToWorkspace(PNEWMONITOR->activeWorkspace->getConfigName());
|
moveActiveToWorkspace(PNEWMONITOR->activeWorkspace->getConfigName());
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isDirection(args)) {
|
if (!isDirection(args)) {
|
||||||
|
@ -1356,6 +1361,10 @@ void CKeybindManager::moveActiveTo(std::string args) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static auto PMONITORFALLBACK = CConfigValue<Hyprlang::INT>("binds:window_direction_monitor_fallback");
|
||||||
|
if (!*PMONITORFALLBACK)
|
||||||
|
return;
|
||||||
|
|
||||||
// Otherwise, we always want to move to the next monitor in that direction
|
// Otherwise, we always want to move to the next monitor in that direction
|
||||||
const auto PMONITORTOCHANGETO = g_pCompositor->getMonitorInDirection(arg);
|
const auto PMONITORTOCHANGETO = g_pCompositor->getMonitorInDirection(arg);
|
||||||
if (!PMONITORTOCHANGETO)
|
if (!PMONITORTOCHANGETO)
|
||||||
|
|
Loading…
Reference in a new issue