mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-06 15:11:57 -07:00
workspacerules: Add workspace rule for master layout orientation (#3964)
* add workspace rule for master layout orientation * change rule format * edit rule name * use map for layoutopts * use std::any instead of string
This commit is contained in:
@@ -42,13 +42,21 @@ SMasterWorkspaceData* CHyprMasterLayout::getMasterWorkspaceData(const int& ws) {
|
||||
const auto PWORKSPACEDATA = &m_lMasterWorkspacesData.emplace_back();
|
||||
PWORKSPACEDATA->workspaceID = ws;
|
||||
const auto orientation = &g_pConfigManager->getConfigValuePtr("master:orientation")->strValue;
|
||||
if (*orientation == "top") {
|
||||
const auto layoutoptsForWs = g_pConfigManager->getWorkspaceRuleFor(g_pCompositor->getWorkspaceByID(ws)).layoutopts;
|
||||
auto orientationForWs = *orientation;
|
||||
|
||||
try {
|
||||
if (layoutoptsForWs.contains("orientation"))
|
||||
orientationForWs = std::any_cast<std::string>(layoutoptsForWs.at("orientation"));
|
||||
} catch (std::exception& e) { Debug::log(ERR, "Error from layoutopt rules: {}", e.what()); }
|
||||
|
||||
if (orientationForWs == "top") {
|
||||
PWORKSPACEDATA->orientation = ORIENTATION_TOP;
|
||||
} else if (*orientation == "right") {
|
||||
} else if (orientationForWs == "right") {
|
||||
PWORKSPACEDATA->orientation = ORIENTATION_RIGHT;
|
||||
} else if (*orientation == "bottom") {
|
||||
} else if (orientationForWs == "bottom") {
|
||||
PWORKSPACEDATA->orientation = ORIENTATION_BOTTOM;
|
||||
} else if (*orientation == "left") {
|
||||
} else if (orientationForWs == "left") {
|
||||
PWORKSPACEDATA->orientation = ORIENTATION_LEFT;
|
||||
} else {
|
||||
PWORKSPACEDATA->orientation = ORIENTATION_CENTER;
|
||||
|
Reference in New Issue
Block a user