privacy: introduce ignore
option
This commit is contained in:
@ -31,6 +31,7 @@ class Privacy : public AModule {
|
|||||||
uint iconSpacing = 4;
|
uint iconSpacing = 4;
|
||||||
uint iconSize = 20;
|
uint iconSize = 20;
|
||||||
uint transition_duration = 250;
|
uint transition_duration = 250;
|
||||||
|
std::set<std::pair<PrivacyNodeType, std::string>> ignore;
|
||||||
|
|
||||||
std::shared_ptr<util::PipewireBackend::PipewireBackend> backend = nullptr;
|
std::shared_ptr<util::PipewireBackend::PipewireBackend> backend = nullptr;
|
||||||
};
|
};
|
||||||
|
@ -74,6 +74,18 @@ Privacy::Privacy(const std::string& id, const Json::Value& config, Gtk::Orientat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const auto& ignore_item : config_["ignore"]) {
|
||||||
|
if (!ignore_item.isObject() || !ignore_item["type"].isString() || !ignore_item["name"].isString()) continue;
|
||||||
|
const std::string type = ignore_item["type"].asString();
|
||||||
|
const std::string name = ignore_item["name"].asString();
|
||||||
|
|
||||||
|
auto iter = typeMap.find(type);
|
||||||
|
if (iter != typeMap.end()) {
|
||||||
|
auto& [_, nodeType] = iter->second;
|
||||||
|
ignore.emplace(nodeType, std::move(name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
backend = util::PipewireBackend::PipewireBackend::getInstance();
|
backend = util::PipewireBackend::PipewireBackend::getInstance();
|
||||||
backend->privacy_nodes_changed_signal_event.connect(
|
backend->privacy_nodes_changed_signal_event.connect(
|
||||||
sigc::mem_fun(*this, &Privacy::onPrivacyNodesChanged));
|
sigc::mem_fun(*this, &Privacy::onPrivacyNodesChanged));
|
||||||
@ -88,6 +100,10 @@ void Privacy::onPrivacyNodesChanged() {
|
|||||||
nodes_screenshare.clear();
|
nodes_screenshare.clear();
|
||||||
|
|
||||||
for (auto& node : backend->privacy_nodes) {
|
for (auto& node : backend->privacy_nodes) {
|
||||||
|
auto iter = ignore.find(std::pair(node.second->type, node.second->node_name));
|
||||||
|
if (iter != ignore.end())
|
||||||
|
continue;
|
||||||
|
|
||||||
switch (node.second->state) {
|
switch (node.second->state) {
|
||||||
case PW_NODE_STATE_RUNNING:
|
case PW_NODE_STATE_RUNNING:
|
||||||
switch (node.second->type) {
|
switch (node.second->type) {
|
||||||
|
Reference in New Issue
Block a user