mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-08 00:45:58 +01:00
Added nextworkspace lastworkspace handlers
This commit is contained in:
parent
07b9efb114
commit
1a5ed05758
3 changed files with 22 additions and 0 deletions
|
@ -258,4 +258,22 @@ void KeybindManager::toggleScratchpad(std::string args) {
|
|||
const auto NEWTOP = g_pWindowManager->findFirstWindowOnWorkspace(SCRATCHPAD_ID);
|
||||
if (NEWTOP)
|
||||
g_pWindowManager->setFocusedWindow(NEWTOP->getDrawable());
|
||||
}
|
||||
|
||||
void KeybindManager::nextWorkspace(std::string args) {
|
||||
const auto PMONITOR = g_pWindowManager->getMonitorFromCursor();
|
||||
|
||||
if (!PMONITOR)
|
||||
return;
|
||||
|
||||
g_pWindowManager->changeWorkspaceByID(g_pWindowManager->activeWorkspaces[PMONITOR->ID] + 1);
|
||||
}
|
||||
|
||||
void KeybindManager::lastWorkspace(std::string args) {
|
||||
const auto PMONITOR = g_pWindowManager->getMonitorFromCursor();
|
||||
|
||||
if (!PMONITOR)
|
||||
return;
|
||||
|
||||
g_pWindowManager->changeWorkspaceByID(g_pWindowManager->activeWorkspaces[PMONITOR->ID] < 2 ? 1 : g_pWindowManager->activeWorkspaces[PMONITOR->ID] - 1);
|
||||
}
|
|
@ -30,4 +30,6 @@ namespace KeybindManager {
|
|||
void changeSplitRatio(std::string args);
|
||||
void togglePseudoActive(std::string args);
|
||||
void toggleScratchpad(std::string args);
|
||||
void nextWorkspace(std::string args);
|
||||
void lastWorkspace(std::string args);
|
||||
};
|
||||
|
|
|
@ -128,6 +128,8 @@ void handleBind(const std::string& command, const std::string& value) {
|
|||
if (HANDLER == "splitratio") dispatcher = KeybindManager::changeSplitRatio;
|
||||
if (HANDLER == "pseudo") dispatcher = KeybindManager::togglePseudoActive;
|
||||
if (HANDLER == "scratchpad") dispatcher = KeybindManager::toggleScratchpad;
|
||||
if (HANDLER == "nextworkspace") dispatcher = KeybindManager::nextWorkspace;
|
||||
if (HANDLER == "lastworkspace") dispatcher = KeybindManager::lastWorkspace;
|
||||
|
||||
if (dispatcher && KEY != 0)
|
||||
KeybindManager::keybinds.push_back(Keybind(KeybindManager::modToMask(MOD), KEY, COMMAND, dispatcher));
|
||||
|
|
Loading…
Reference in a new issue