mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 03:05:59 +01:00
keybinds: simulate workspace switch on focusWindow to another ws
This commit is contained in:
parent
d6b069458d
commit
45b1e6dc5e
3 changed files with 30 additions and 7 deletions
|
@ -150,3 +150,14 @@ void CWorkspace::rememberPrevWorkspace(const CWorkspace* prev) {
|
||||||
m_sPrevWorkspace.iID = prev->m_iID;
|
m_sPrevWorkspace.iID = prev->m_iID;
|
||||||
m_sPrevWorkspace.name = prev->m_szName;
|
m_sPrevWorkspace.name = prev->m_szName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CWorkspace::getConfigName() {
|
||||||
|
if (m_bIsSpecialWorkspace) {
|
||||||
|
return "special:" + m_szName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_iID > 0)
|
||||||
|
return std::to_string(m_iID);
|
||||||
|
|
||||||
|
return "name:" + m_szName;
|
||||||
|
}
|
||||||
|
|
|
@ -51,13 +51,15 @@ class CWorkspace {
|
||||||
bool m_bDefaultPseudo = false;
|
bool m_bDefaultPseudo = false;
|
||||||
|
|
||||||
// don't destroy in sanity check
|
// don't destroy in sanity check
|
||||||
bool m_bIndestructible = false;
|
bool m_bIndestructible = false;
|
||||||
|
|
||||||
void startAnim(bool in, bool left, bool instant = false);
|
void startAnim(bool in, bool left, bool instant = false);
|
||||||
void setActive(bool on);
|
void setActive(bool on);
|
||||||
|
|
||||||
void moveToMonitor(const int&);
|
void moveToMonitor(const int&);
|
||||||
|
|
||||||
CWindow* getLastFocusedWindow();
|
CWindow* getLastFocusedWindow();
|
||||||
void rememberPrevWorkspace(const CWorkspace* prevWorkspace);
|
void rememberPrevWorkspace(const CWorkspace* prevWorkspace);
|
||||||
|
|
||||||
|
std::string getConfigName();
|
||||||
};
|
};
|
||||||
|
|
|
@ -1145,7 +1145,7 @@ void CKeybindManager::moveActiveTo(std::string args) {
|
||||||
|
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITORTOCHANGETO->activeWorkspace);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITORTOCHANGETO->activeWorkspace);
|
||||||
|
|
||||||
moveActiveToWorkspace(PMONITORTOCHANGETO->activeWorkspace < 0 ? "name:" + PWORKSPACE->m_szName : std::to_string(PMONITORTOCHANGETO->activeWorkspace));
|
moveActiveToWorkspace(PWORKSPACE->getConfigName());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::toggleGroup(std::string args) {
|
void CKeybindManager::toggleGroup(std::string args) {
|
||||||
|
@ -1659,6 +1659,16 @@ void CKeybindManager::focusWindow(std::string regexp) {
|
||||||
|
|
||||||
Debug::log(LOG, "Focusing to window name: %s", PWINDOW->m_szTitle.c_str());
|
Debug::log(LOG, "Focusing to window name: %s", PWINDOW->m_szTitle.c_str());
|
||||||
|
|
||||||
|
if (g_pCompositor->m_pLastMonitor->activeWorkspace != PWINDOW->m_iWorkspaceID) {
|
||||||
|
Debug::log(LOG, "Fake executing workspace to move focus");
|
||||||
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID);
|
||||||
|
if (!PWORKSPACE) {
|
||||||
|
Debug::log(ERR, "BUG THIS: null workspace in focusWindow");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
changeworkspace(PWORKSPACE->getConfigName());
|
||||||
|
}
|
||||||
|
|
||||||
if (PWINDOW->isHidden() && PWINDOW->m_sGroupData.pNextWindow) {
|
if (PWINDOW->isHidden() && PWINDOW->m_sGroupData.pNextWindow) {
|
||||||
// grouped, change the current to us
|
// grouped, change the current to us
|
||||||
PWINDOW->setGroupCurrent(PWINDOW);
|
PWINDOW->setGroupCurrent(PWINDOW);
|
||||||
|
|
Loading…
Reference in a new issue