mirror of
https://github.com/hyprwm/Hyprland
synced 2025-12-27 05:30:05 +01:00
Merge 57be5317ee into 6175ecd4c4
This commit is contained in:
commit
1814724c2e
4 changed files with 46 additions and 6 deletions
|
|
@ -1158,7 +1158,7 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
|||
},
|
||||
SConfigOptionDescription{
|
||||
.value = "misc:force_default_wallpaper",
|
||||
.description = "Enforce any of the 3 default wallpapers. Setting this to 0 or 1 disables the anime background. -1 means “random”. [-1/0/1/2]",
|
||||
.description = "Enforce any of the 3 default wallpapers. Setting this to 0 or 1 disables the anime background. -1 means "random". [-1/0/1/2]",
|
||||
.type = CONFIG_OPTION_INT,
|
||||
.data = SConfigOptionDescription::SRangeData{-1, -1, 2},
|
||||
},
|
||||
|
|
@ -1238,7 +1238,7 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
|||
SConfigOptionDescription{
|
||||
.value = "misc:swallow_exception_regex",
|
||||
.description = "The title regex to be used for windows that should not be swallowed by the windows specified in swallow_regex (e.g. wev). The regex is matched against the "
|
||||
"parent (e.g. Kitty) window’s title on the assumption that it changes to whatever process it’s running.",
|
||||
"parent (e.g. Kitty) window's title on the assumption that it changes to whatever process it's running.",
|
||||
.type = CONFIG_OPTION_STRING_SHORT,
|
||||
.data = SConfigOptionDescription::SStringData{""}, //##TODO UNSET?
|
||||
},
|
||||
|
|
@ -1382,7 +1382,7 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
|||
},
|
||||
SConfigOptionDescription{
|
||||
.value = "binds:workspace_back_and_forth",
|
||||
.description = "If enabled, an attempt to switch to the currently focused workspace will instead switch to the previous workspace. Akin to i3’s auto_back_and_forth.",
|
||||
.description = "If enabled, an attempt to switch to the currently focused workspace will instead switch to the previous workspace. Akin to i3's auto_back_and_forth.",
|
||||
.type = CONFIG_OPTION_BOOL,
|
||||
.data = SConfigOptionDescription::SBoolData{false},
|
||||
},
|
||||
|
|
@ -1394,7 +1394,7 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
|||
},
|
||||
SConfigOptionDescription{
|
||||
.value = "binds:allow_workspace_cycles",
|
||||
.description = "If enabled, workspaces don’t forget their previous workspace, so cycles can be created by switching to the first workspace in a sequence, then endlessly "
|
||||
.description = "If enabled, workspaces don't forget their previous workspace, so cycles can be created by switching to the first workspace in a sequence, then endlessly "
|
||||
"going to the previous workspace.",
|
||||
.type = CONFIG_OPTION_BOOL,
|
||||
.data = SConfigOptionDescription::SBoolData{false},
|
||||
|
|
@ -1605,7 +1605,7 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
|||
},
|
||||
SConfigOptionDescription{
|
||||
.value = "cursor:inactive_timeout",
|
||||
.description = "in seconds, after how many seconds of cursor’s inactivity to hide it. Set to 0 for never.",
|
||||
.description = "in seconds, after how many seconds of cursor's inactivity to hide it. Set to 0 for never.",
|
||||
.type = CONFIG_OPTION_INT,
|
||||
.data = SConfigOptionDescription::SRangeData{0, 0, 20},
|
||||
},
|
||||
|
|
@ -1990,7 +1990,13 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
|||
},
|
||||
SConfigOptionDescription{
|
||||
.value = "master:always_keep_position",
|
||||
.description = "whether to keep the master window in its configured position when there are no slave windows",
|
||||
.description = "If enabled, the master window will always keep its position and size even when it's the only window on the workspace.",
|
||||
.type = CONFIG_OPTION_BOOL,
|
||||
.data = SConfigOptionDescription::SBoolData{false},
|
||||
},
|
||||
SConfigOptionDescription{
|
||||
.value = "master:focus_master_on_close",
|
||||
.description = "If enabled, when a master window is closed, focus will automatically shift to the next master window instead of potentially focusing a stack window.",
|
||||
.type = CONFIG_OPTION_BOOL,
|
||||
.data = SConfigOptionDescription::SBoolData{false},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -625,6 +625,7 @@ CConfigManager::CConfigManager() {
|
|||
registerConfigVar("master:smart_resizing", Hyprlang::INT{1});
|
||||
registerConfigVar("master:drop_at_cursor", Hyprlang::INT{1});
|
||||
registerConfigVar("master:always_keep_position", Hyprlang::INT{0});
|
||||
registerConfigVar("master:focus_master_on_close", Hyprlang::INT{0});
|
||||
|
||||
registerConfigVar("animations:enabled", Hyprlang::INT{1});
|
||||
registerConfigVar("animations:workspace_wraparound", Hyprlang::INT{0});
|
||||
|
|
|
|||
|
|
@ -1522,3 +1522,34 @@ void CHyprMasterLayout::onEnable() {
|
|||
void CHyprMasterLayout::onDisable() {
|
||||
m_masterNodesData.clear();
|
||||
}
|
||||
|
||||
PHLWINDOW CHyprMasterLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
|
||||
static auto PFOCUSMASTERONCLOSE = CConfigValue<Hyprlang::INT>("master:focus_master_on_close");
|
||||
|
||||
// If the config is enabled and we have a valid window that was closed
|
||||
if (*PFOCUSMASTERONCLOSE && pWindow && pWindow->m_workspace) {
|
||||
const auto PNODE = getNodeFromWindow(pWindow);
|
||||
|
||||
// If the closed window was a master window, try to focus the next master window
|
||||
if (PNODE && PNODE->isMaster) {
|
||||
const auto WORKSPACEID = pWindow->workspaceID();
|
||||
|
||||
// Find the next master window in the same workspace
|
||||
for (auto& nd : m_masterNodesData) {
|
||||
if (nd.workspaceID == WORKSPACEID && nd.isMaster && nd.pWindow.lock() != pWindow && nd.pWindow.lock() && nd.pWindow.lock()->m_isMapped) {
|
||||
return nd.pWindow.lock();
|
||||
}
|
||||
}
|
||||
|
||||
// If no other master window found, try to find any master window in the workspace
|
||||
for (auto& nd : m_masterNodesData) {
|
||||
if (nd.workspaceID == WORKSPACEID && nd.isMaster && nd.pWindow.lock() && nd.pWindow.lock()->m_isMapped) {
|
||||
return nd.pWindow.lock();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to default behavior
|
||||
return IHyprLayout::getNextWindowCandidate(pWindow);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,8 @@ class CHyprMasterLayout : public IHyprLayout {
|
|||
virtual void onEnable();
|
||||
virtual void onDisable();
|
||||
|
||||
virtual PHLWINDOW getNextWindowCandidate(PHLWINDOW) override;
|
||||
|
||||
private:
|
||||
std::list<SMasterNodeData> m_masterNodesData;
|
||||
std::vector<SMasterWorkspaceData> m_masterWorkspacesData;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue