Fix scratchpad support (i was an idiot)
This commit is contained in:
parent
1a13229343
commit
293a12d0b7
1 changed files with 12 additions and 3 deletions
|
@ -88,7 +88,7 @@ struct SwayRecord {
|
|||
|
||||
explicit SwayRecord(const json &rep) :
|
||||
id(rep["id"]),
|
||||
name(rep["name"].is_null() ? "untitled container" : rep["name"]),
|
||||
name(getName(rep)),
|
||||
type(NodeType::fromString(rep["type"])),
|
||||
border(rep["border"]),
|
||||
current_border_width(rep["current_border_width"]),
|
||||
|
@ -115,6 +115,17 @@ struct SwayRecord {
|
|||
[[nodiscard]] bool operator==(const SwayRecord &other) const {
|
||||
return this->id == other.id;
|
||||
}
|
||||
private:
|
||||
static std::string getName(const json& rep) {
|
||||
if(rep["name"].is_null())
|
||||
return "Untitled Container";
|
||||
std::string internal = rep["name"];
|
||||
if (internal == "__i3" && NodeType::fromString(rep["type"]) == NodeType::output)
|
||||
return "Virtual Display";
|
||||
if (internal == "__i3_scratch" && NodeType::fromString(rep["type"]) == NodeType::workspace)
|
||||
return "Scratchpad";
|
||||
return internal;
|
||||
}
|
||||
};
|
||||
|
||||
class SwayTreeNode : public AbstractTreeNode<SwayTreeNode> {
|
||||
|
@ -128,12 +139,10 @@ public:
|
|||
this->appendChild(childNode);
|
||||
}
|
||||
|
||||
/*
|
||||
for (const auto &child: rep["floating_nodes"]) {
|
||||
auto childNode = std::make_unique<SwayTreeNode>(child, this);
|
||||
this->appendChild(childNode);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
explicit SwayTreeNode(SwayTreeNode *parent = nullptr) : node(SwayRecord()), AbstractTreeNode(parent) {};
|
||||
|
|
Loading…
Reference in a new issue