Helper function to assign a number to a workspace, just like sway. In fact this is taken quite verbatim from `sway/ipc-json.c`.
| 11 | // Helper function to assign a number to a workspace, just like sway. In fact |
| 12 | // this is taken quite verbatim from `sway/ipc-json.c`. |
| 13 | int Workspaces::convertWorkspaceNameToNum(std::string name) { |
| 14 | if (isdigit(name[0]) != 0) { |
| 15 | errno = 0; |
| 16 | char* endptr = nullptr; |
| 17 | long long parsed_num = strtoll(name.c_str(), &endptr, 10); |
| 18 | if (errno != 0 || parsed_num > INT32_MAX || parsed_num < 0 || endptr == name.c_str()) { |
| 19 | return -1; |
| 20 | } |
| 21 | return (int)parsed_num; |
| 22 | } |
| 23 | return -1; |
| 24 | } |
| 25 | |
| 26 | int Workspaces::windowRewritePriorityFunction(std::string const& window_rule) { |
| 27 | // Rules that match against title are prioritized |
nothing calls this directly
no outgoing calls
no test coverage detected