diff --git a/hyprexpo/main.cpp b/hyprexpo/main.cpp index 78693c3..0334efa 100644 --- a/hyprexpo/main.cpp +++ b/hyprexpo/main.cpp @@ -132,28 +132,35 @@ static Hyprlang::CParseResult workspaceMethodKeyword(const char* LHS, const char if (g_unloading) return result; - // Parse format: "workspace_method = MONITOR_NAME method workspace" - // Example: "workspace_method = DP-1 first 19" + // Parse format: either "method workspace" (global) or "MONITOR_NAME method workspace" (per-monitor) + // Examples: + // "workspace_method = center current" (global) + // "workspace_method = DP-1 first 19" (per-monitor) CConstVarList data(RHS); - if (data.size() < 3) { - result.setError("workspace_method requires format: MONITOR_NAME "); + if (data.size() == 2) { + // Global config format: method workspace + // This is handled by the plugin config value, not here + // Just return success and let the normal config system handle it + return result; + } else if (data.size() >= 3) { + // Per-monitor format: MONITOR_NAME method workspace + const std::string monitorName = std::string{data[0]}; + const std::string methodType = std::string{data[1]}; + const std::string workspace = std::string{data[2]}; + + if (methodType != "center" && methodType != "first") { + result.setError(std::format("Invalid method type '{}', expected 'center' or 'first'", methodType).c_str()); + return result; + } + + // Store in global map + g_monitorWorkspaceMethods[monitorName] = methodType + " " + workspace; + return result; + } else { + result.setError("workspace_method requires format: OR MONITOR_NAME "); return result; } - - const std::string monitorName = std::string{data[0]}; - const std::string methodType = std::string{data[1]}; - const std::string workspace = std::string{data[2]}; - - if (methodType != "center" && methodType != "first") { - result.setError(std::format("Invalid method type '{}', expected 'center' or 'first'", methodType).c_str()); - return result; - } - - // Store in global map - g_monitorWorkspaceMethods[monitorName] = methodType + " " + workspace; - - return result; } static Hyprlang::CParseResult expoGestureKeyword(const char* LHS, const char* RHS) {