mirror of
https://github.com/hyprwm/Hyprland
synced 2025-01-11 00:29:49 +01:00
dispatchers: Add an option to prioritize focus change within groups with movefocus (#8601)
* modified movefocus dispatcher to prioritize focus change within groups * pass clang-format check * `movefocus` cycling groups set optional to config bool `movefocus_cycles_groupfirst` * Update ConfigDescriptions.hpp
This commit is contained in:
parent
61a51bb4ef
commit
452a7e6905
3 changed files with 23 additions and 0 deletions
|
@ -1200,6 +1200,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
||||||
.type = CONFIG_OPTION_BOOL,
|
.type = CONFIG_OPTION_BOOL,
|
||||||
.data = SConfigOptionDescription::SBoolData{true},
|
.data = SConfigOptionDescription::SBoolData{true},
|
||||||
},
|
},
|
||||||
|
SConfigOptionDescription{
|
||||||
|
.value = "binds:movefocus_cycles_groupfirst",
|
||||||
|
.description = "If enabled, when in a grouped window, movefocus will cycle windows in the groups first, then at each ends of tabs, it'll move on to other windows/groups",
|
||||||
|
.type = CONFIG_OPTION_BOOL,
|
||||||
|
.data = SConfigOptionDescription::SBoolData{false},
|
||||||
|
},
|
||||||
SConfigOptionDescription{
|
SConfigOptionDescription{
|
||||||
.value = "binds:disable_keybind_grabbing",
|
.value = "binds:disable_keybind_grabbing",
|
||||||
.description = "If enabled, apps that request keybinds to be disabled (e.g. VMs) will not be able to do so.",
|
.description = "If enabled, apps that request keybinds to be disabled (e.g. VMs) will not be able to do so.",
|
||||||
|
|
|
@ -544,6 +544,7 @@ CConfigManager::CConfigManager() {
|
||||||
m_pConfig->addConfigValue("binds:focus_preferred_method", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("binds:focus_preferred_method", Hyprlang::INT{0});
|
||||||
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:movefocus_cycles_groupfirst", Hyprlang::INT{0});
|
||||||
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("binds:window_direction_monitor_fallback", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("binds:allow_pin_fullscreen", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("binds:allow_pin_fullscreen", Hyprlang::INT{0});
|
||||||
|
|
|
@ -1374,6 +1374,7 @@ SDispatchResult CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
||||||
SDispatchResult CKeybindManager::moveFocusTo(std::string args) {
|
SDispatchResult 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");
|
||||||
static auto PMONITORFALLBACK = CConfigValue<Hyprlang::INT>("binds:window_direction_monitor_fallback");
|
static auto PMONITORFALLBACK = CConfigValue<Hyprlang::INT>("binds:window_direction_monitor_fallback");
|
||||||
|
static auto PGROUPCYCLE = CConfigValue<Hyprlang::INT>("binds:movefocus_cycles_groupfirst");
|
||||||
char arg = args[0];
|
char arg = args[0];
|
||||||
|
|
||||||
if (!isDirection(args)) {
|
if (!isDirection(args)) {
|
||||||
|
@ -1393,6 +1394,21 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) {
|
||||||
(arg == 'd' || arg == 'b' || arg == 'r' ? g_pCompositor->getNextWindowOnWorkspace(PLASTWINDOW, true) : g_pCompositor->getPrevWindowOnWorkspace(PLASTWINDOW, true)) :
|
(arg == 'd' || arg == 'b' || arg == 'r' ? g_pCompositor->getNextWindowOnWorkspace(PLASTWINDOW, true) : g_pCompositor->getPrevWindowOnWorkspace(PLASTWINDOW, true)) :
|
||||||
g_pCompositor->getWindowInDirection(PLASTWINDOW, arg);
|
g_pCompositor->getWindowInDirection(PLASTWINDOW, arg);
|
||||||
|
|
||||||
|
// Prioritize focus change within groups if the window is a part of it.
|
||||||
|
if (*PGROUPCYCLE) {
|
||||||
|
if (!PLASTWINDOW->m_sGroupData.pNextWindow.expired()) {
|
||||||
|
if (arg == 'l' && PLASTWINDOW != PLASTWINDOW->getGroupHead()) {
|
||||||
|
PLASTWINDOW->setGroupCurrent(PLASTWINDOW->getGroupPrevious());
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (arg == 'r' && PLASTWINDOW != PLASTWINDOW->getGroupTail()) {
|
||||||
|
PLASTWINDOW->setGroupCurrent(PLASTWINDOW->m_sGroupData.pNextWindow.lock());
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Found window in direction, switch to it
|
// Found window in direction, switch to it
|
||||||
if (PWINDOWTOCHANGETO) {
|
if (PWINDOWTOCHANGETO) {
|
||||||
switchToWindow(PWINDOWTOCHANGETO);
|
switchToWindow(PWINDOWTOCHANGETO);
|
||||||
|
|
Loading…
Reference in a new issue