Skip to content

Commit

Permalink
keybinds: Add an option to pass a window argument to moveoutofgroup (#…
Browse files Browse the repository at this point in the history
…4724)

* keybinds: allow passing window to moveoutofgroup

* keybinds: cleaner handling of certain args
  • Loading branch information
morr0ne committed Feb 17, 2024
1 parent 289d952 commit 5261a8d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/managers/KeybindManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ void CKeybindManager::clearKeybinds() {
void CKeybindManager::toggleActiveFloating(std::string args) {
CWindow* PWINDOW = nullptr;

if (args != "" && args != "active" && args.length() > 1)
if (args != "active" && args.length() > 1)
PWINDOW = g_pCompositor->getWindowByRegex(args);
else
PWINDOW = g_pCompositor->m_pLastWindow;
Expand Down Expand Up @@ -1941,7 +1941,7 @@ void CKeybindManager::pinActive(std::string args) {

CWindow* PWINDOW = nullptr;

if (args != "" && args != "active" && args.length() > 1)
if (args != "active" && args.length() > 1)
PWINDOW = g_pCompositor->getWindowByRegex(args);
else
PWINDOW = g_pCompositor->m_pLastWindow;
Expand Down Expand Up @@ -2180,7 +2180,12 @@ void CKeybindManager::moveOutOfGroup(std::string args) {
if (!*PIGNOREGROUPLOCK && g_pKeybindManager->m_bGroupsLocked)
return;

const auto PWINDOW = g_pCompositor->m_pLastWindow;
CWindow* PWINDOW = nullptr;

if (args != "active" && args.length() > 1)
PWINDOW = g_pCompositor->getWindowByRegex(args);
else
PWINDOW = g_pCompositor->m_pLastWindow;

if (!PWINDOW || !PWINDOW->m_sGroupData.pNextWindow)
return;
Expand Down

0 comments on commit 5261a8d

Please sign in to comment.