mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 16:25:59 +01:00
keybinds: add Dispatchers for "force float" and "force tiling" (non-toggle) (#5137)
--------- Co-authored-by: djvs <djvs@users.noreply.github.com>
This commit is contained in:
parent
e68c07d809
commit
3ed3b34c4a
2 changed files with 22 additions and 1 deletions
|
@ -25,6 +25,8 @@ CKeybindManager::CKeybindManager() {
|
||||||
m_mDispatchers["killactive"] = killActive;
|
m_mDispatchers["killactive"] = killActive;
|
||||||
m_mDispatchers["closewindow"] = kill;
|
m_mDispatchers["closewindow"] = kill;
|
||||||
m_mDispatchers["togglefloating"] = toggleActiveFloating;
|
m_mDispatchers["togglefloating"] = toggleActiveFloating;
|
||||||
|
m_mDispatchers["setfloating"] = setActiveFloating;
|
||||||
|
m_mDispatchers["settiled"] = setActiveTiled;
|
||||||
m_mDispatchers["workspace"] = changeworkspace;
|
m_mDispatchers["workspace"] = changeworkspace;
|
||||||
m_mDispatchers["renameworkspace"] = renameWorkspace;
|
m_mDispatchers["renameworkspace"] = renameWorkspace;
|
||||||
m_mDispatchers["fullscreen"] = fullscreenActive;
|
m_mDispatchers["fullscreen"] = fullscreenActive;
|
||||||
|
@ -828,6 +830,18 @@ void CKeybindManager::clearKeybinds() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::toggleActiveFloating(std::string args) {
|
void CKeybindManager::toggleActiveFloating(std::string args) {
|
||||||
|
return toggleActiveFloatingCore(args, std::nullopt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKeybindManager::setActiveFloating(std::string args) {
|
||||||
|
return toggleActiveFloatingCore(args, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKeybindManager::setActiveTiled(std::string args) {
|
||||||
|
return toggleActiveFloatingCore(args, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void toggleActiveFloatingCore(std::string args, std::optional<bool> floatState) {
|
||||||
CWindow* PWINDOW = nullptr;
|
CWindow* PWINDOW = nullptr;
|
||||||
|
|
||||||
if (args != "active" && args.length() > 1)
|
if (args != "active" && args.length() > 1)
|
||||||
|
@ -838,12 +852,15 @@ void CKeybindManager::toggleActiveFloating(std::string args) {
|
||||||
if (!PWINDOW)
|
if (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (floatState.has_value() && floatState == PWINDOW->m_bIsFloating)
|
||||||
|
return;
|
||||||
|
|
||||||
// remove drag status
|
// remove drag status
|
||||||
g_pInputManager->currentlyDraggedWindow = nullptr;
|
g_pInputManager->currentlyDraggedWindow = nullptr;
|
||||||
|
|
||||||
if (PWINDOW->m_sGroupData.pNextWindow && PWINDOW->m_sGroupData.pNextWindow != PWINDOW) {
|
if (PWINDOW->m_sGroupData.pNextWindow && PWINDOW->m_sGroupData.pNextWindow != PWINDOW) {
|
||||||
|
const auto PCURRENT = PWINDOW->getGroupCurrent();
|
||||||
|
|
||||||
const auto PCURRENT = PWINDOW->getGroupCurrent();
|
|
||||||
PCURRENT->m_bIsFloating = !PCURRENT->m_bIsFloating;
|
PCURRENT->m_bIsFloating = !PCURRENT->m_bIsFloating;
|
||||||
g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(PCURRENT);
|
g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(PCURRENT);
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,8 @@ class CKeybindManager {
|
||||||
static uint64_t spawnRaw(std::string);
|
static uint64_t spawnRaw(std::string);
|
||||||
static void toggleActiveFloating(std::string);
|
static void toggleActiveFloating(std::string);
|
||||||
static void toggleActivePseudo(std::string);
|
static void toggleActivePseudo(std::string);
|
||||||
|
static void setActiveFloating(std::string);
|
||||||
|
static void setActiveTiled(std::string);
|
||||||
static void changeworkspace(std::string);
|
static void changeworkspace(std::string);
|
||||||
static void fullscreenActive(std::string);
|
static void fullscreenActive(std::string);
|
||||||
static void fakeFullscreenActive(std::string);
|
static void fakeFullscreenActive(std::string);
|
||||||
|
@ -179,4 +181,6 @@ class CKeybindManager {
|
||||||
friend class CConfigManager;
|
friend class CConfigManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void toggleActiveFloatingCore(std::string args, std::optional<bool> floatState);
|
||||||
|
|
||||||
inline std::unique_ptr<CKeybindManager> g_pKeybindManager;
|
inline std::unique_ptr<CKeybindManager> g_pKeybindManager;
|
||||||
|
|
Loading…
Reference in a new issue