Added GeoClue2 privacy item

Rebased onto current master and fixed the privacy module build:
- privacy_item.hpp no longer includes privacy.hpp (it does not use the
  Privacy class); this broke the circular include that left PrivacyItem
  undeclared when privacy.hpp was reached first from privacy_item.cpp.
- privacy_item.cpp now includes gtkmm/label.h explicitly, since Gtk::Label
  was previously only pulled in transitively via privacy.hpp.
This commit is contained in:
Erik Reider
2026-07-04 01:42:35 +02:00
committed by Alexays
parent 46e96dfbaa
commit eeb7bc702e
15 changed files with 314 additions and 73 deletions
+15 -7
View File
@@ -1,13 +1,16 @@
#pragma once
#include <atomic>
#include <string>
#include "gtkmm/box.h"
#include "modules/privacy/privacy_item.hpp"
#include "util/geoclue_backend.hpp"
#include "util/pipewire/pipewire_backend.hpp"
#include "util/pipewire/privacy_node_info.hpp"
using waybar::util::PipewireBackend::PrivacyNodeInfo;
using waybar::util::PipewireBackend::PrivacyNodeType;
using waybar::util::PipewireBackend::PWPrivacyNodeInfo;
namespace waybar::modules::privacy {
@@ -16,15 +19,15 @@ class Privacy : public AModule {
Privacy(const std::string&, const Json::Value&, Gtk::Orientation, const std::string& pos);
auto update() -> void override;
void onPrivacyNodesChanged();
private:
std::list<PrivacyNodeInfo*> nodes_screenshare; // Screen is being shared
std::list<PrivacyNodeInfo*> nodes_audio_in; // Application is using the microphone
std::list<PrivacyNodeInfo*> nodes_audio_out; // Application is outputting audio
std::list<PWPrivacyNodeInfo*> nodes_screenshare; // Screen is being shared
std::list<PWPrivacyNodeInfo*> nodes_audio_in; // Application is using the microphone
std::list<PWPrivacyNodeInfo*> nodes_audio_out; // Application is outputting audio
std::atomic<bool> location_in_use; // GeoClue is being used
std::mutex mutex_;
sigc::connection visibility_conn;
sigc::connection geoclue_timeout_conn;
// Config
Gtk::Box box_;
@@ -35,7 +38,12 @@ class Privacy : public AModule {
std::set<std::pair<PrivacyNodeType, std::string>> ignore;
bool ignore_monitor = true;
std::shared_ptr<util::PipewireBackend::PipewireBackend> backend = nullptr;
std::shared_ptr<util::PipewireBackend::PipewireBackend> pw_backend = nullptr;
std::shared_ptr<util::GeoClueBackend::GeoClueBackend> geoclue_backend = nullptr;
void onPWPrivacyNodesChanged();
bool locationTimeout(bool in_use);
void onGeoCluePrivacyNodesChanged();
};
} // namespace waybar::modules::privacy