mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-10-29 19:34:47 +00:00
config/rule: don't populate ID field for automatically id-managed workspaces
This commit is contained in:
parent
40831a90a0
commit
431325ff0c
@ -2396,12 +2396,12 @@ std::optional<std::string> CConfigManager::handleMonitor(const std::string& comm
|
||||
parser.parseVRR(ARGS[argno + 1]);
|
||||
argno++;
|
||||
} else if (ARGS[argno] == "workspace") {
|
||||
const auto& [id, name] = getWorkspaceIDNameFromString(ARGS[argno + 1]);
|
||||
const auto& [id, name, isAutoID] = getWorkspaceIDNameFromString(ARGS[argno + 1]);
|
||||
|
||||
SWorkspaceRule wsRule;
|
||||
wsRule.monitor = parser.name();
|
||||
wsRule.workspaceString = ARGS[argno + 1];
|
||||
wsRule.workspaceId = id;
|
||||
wsRule.workspaceId = isAutoID ? WORKSPACE_INVALID : id;
|
||||
wsRule.workspaceName = name;
|
||||
|
||||
m_workspaceRules.emplace_back(wsRule);
|
||||
@ -2915,7 +2915,7 @@ std::optional<std::string> CConfigManager::handleWorkspaceRules(const std::strin
|
||||
|
||||
auto first_ident = trim(value.substr(0, FIRST_DELIM));
|
||||
|
||||
const auto& [id, name] = getWorkspaceIDNameFromString(first_ident);
|
||||
const auto& [id, name, isAutoID] = getWorkspaceIDNameFromString(first_ident);
|
||||
|
||||
auto rules = value.substr(FIRST_DELIM + 1);
|
||||
SWorkspaceRule wsRule;
|
||||
@ -3015,8 +3015,8 @@ std::optional<std::string> CConfigManager::handleWorkspaceRules(const std::strin
|
||||
return R;
|
||||
}
|
||||
|
||||
wsRule.workspaceId = id;
|
||||
wsRule.workspaceName = name;
|
||||
wsRule.workspaceId = isAutoID ? WORKSPACE_INVALID : id;
|
||||
|
||||
const auto IT = std::ranges::find_if(m_workspaceRules, [&](const auto& other) { return other.workspaceString == wsRule.workspaceString; });
|
||||
|
||||
|
||||
@ -118,7 +118,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
|
||||
return true;
|
||||
|
||||
if (isNumber(selector)) {
|
||||
const auto& [wsid, wsname] = getWorkspaceIDNameFromString(selector);
|
||||
const auto& [wsid, wsname, isAutoID] = getWorkspaceIDNameFromString(selector);
|
||||
|
||||
if (wsid == WORKSPACE_INVALID)
|
||||
return false;
|
||||
|
||||
@ -115,6 +115,10 @@ bool isDirection(const char& arg) {
|
||||
return arg == 'l' || arg == 'r' || arg == 'u' || arg == 'd' || arg == 't' || arg == 'b';
|
||||
}
|
||||
|
||||
static bool isAutoIDdWorkspace(WORKSPACEID id) {
|
||||
return id < WORKSPACE_INVALID;
|
||||
}
|
||||
|
||||
SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
|
||||
SWorkspaceIDName result = {WORKSPACE_INVALID, ""};
|
||||
|
||||
@ -456,6 +460,8 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
|
||||
}
|
||||
}
|
||||
|
||||
result.isAutoIDd = isAutoIDdWorkspace(result.id);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@ struct SCallstackFrameInfo {
|
||||
struct SWorkspaceIDName {
|
||||
WORKSPACEID id = WORKSPACE_INVALID;
|
||||
std::string name;
|
||||
bool isAutoIDd = false;
|
||||
};
|
||||
|
||||
std::string absolutePath(const std::string&, const std::string&);
|
||||
|
||||
@ -1227,7 +1227,7 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) {
|
||||
const auto PCURRENTWORKSPACE = PMONITOR->m_activeWorkspace;
|
||||
const bool EXPLICITPREVIOUS = args.contains("previous");
|
||||
|
||||
const auto& [workspaceToChangeTo, workspaceName] = getWorkspaceToChangeFromArgs(args, PCURRENTWORKSPACE, PMONITOR);
|
||||
const auto& [workspaceToChangeTo, workspaceName, isAutoID] = getWorkspaceToChangeFromArgs(args, PCURRENTWORKSPACE, PMONITOR);
|
||||
if (workspaceToChangeTo == WORKSPACE_INVALID) {
|
||||
Debug::log(ERR, "Error in changeworkspace, invalid value");
|
||||
return {.success = false, .error = "Error in changeworkspace, invalid value"};
|
||||
@ -1389,7 +1389,7 @@ SDispatchResult CKeybindManager::moveActiveToWorkspace(std::string args) {
|
||||
if (!PWINDOW)
|
||||
return {.success = false, .error = "Window not found"};
|
||||
|
||||
const auto& [WORKSPACEID, workspaceName] = getWorkspaceIDNameFromString(args);
|
||||
const auto& [WORKSPACEID, workspaceName, isAutoID] = getWorkspaceIDNameFromString(args);
|
||||
if (WORKSPACEID == WORKSPACE_INVALID) {
|
||||
Debug::log(LOG, "Invalid workspace in moveActiveToWorkspace");
|
||||
return {.success = false, .error = "Invalid workspace in moveActiveToWorkspace"};
|
||||
@ -1452,7 +1452,7 @@ SDispatchResult CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
||||
if (!PWINDOW)
|
||||
return {.success = false, .error = "Window not found"};
|
||||
|
||||
const auto& [WORKSPACEID, workspaceName] = getWorkspaceIDNameFromString(args);
|
||||
const auto& [WORKSPACEID, workspaceName, isAutoID] = getWorkspaceIDNameFromString(args);
|
||||
if (WORKSPACEID == WORKSPACE_INVALID) {
|
||||
Debug::log(ERR, "Error in moveActiveToWorkspaceSilent, invalid value");
|
||||
return {.success = false, .error = "Error in moveActiveToWorkspaceSilent, invalid value"};
|
||||
@ -2050,7 +2050,7 @@ SDispatchResult CKeybindManager::moveWorkspaceToMonitor(std::string args) {
|
||||
}
|
||||
|
||||
SDispatchResult CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args) {
|
||||
auto [workspaceID, workspaceName] = getWorkspaceIDNameFromString(args);
|
||||
auto [workspaceID, workspaceName, isAutoID] = getWorkspaceIDNameFromString(args);
|
||||
if (workspaceID == WORKSPACE_INVALID) {
|
||||
Debug::log(ERR, "focusWorkspaceOnCurrentMonitor invalid workspace!");
|
||||
return {.success = false, .error = "focusWorkspaceOnCurrentMonitor invalid workspace!"};
|
||||
@ -2104,7 +2104,7 @@ SDispatchResult CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args
|
||||
}
|
||||
|
||||
SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) {
|
||||
const auto& [workspaceID, workspaceName] = getWorkspaceIDNameFromString("special:" + args);
|
||||
const auto& [workspaceID, workspaceName, isAutoID] = getWorkspaceIDNameFromString("special:" + args);
|
||||
if (workspaceID == WORKSPACE_INVALID || !g_pCompositor->isWorkspaceSpecial(workspaceID)) {
|
||||
Debug::log(ERR, "Invalid workspace passed to special");
|
||||
return {.success = false, .error = "Invalid workspace passed to special"};
|
||||
|
||||
@ -51,8 +51,8 @@ void CSpecialWorkspaceGesture::begin(const ITrackpadGesture::STrackpadGestureBeg
|
||||
|
||||
m_animatingOut = false;
|
||||
|
||||
const auto& [workspaceID, workspaceName] = getWorkspaceIDNameFromString("special:" + m_specialWorkspaceName);
|
||||
const auto WS = g_pCompositor->createNewWorkspace(workspaceID, m_monitor->m_id, workspaceName);
|
||||
const auto& [workspaceID, workspaceName, isAutoID] = getWorkspaceIDNameFromString("special:" + m_specialWorkspaceName);
|
||||
const auto WS = g_pCompositor->createNewWorkspace(workspaceID, m_monitor->m_id, workspaceName);
|
||||
m_monitor->setSpecialWorkspace(WS);
|
||||
m_specialWorkspace = WS;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user