Waybar/include/modules/privacy/privacy_item.hpp

56 lines
1.1 KiB
C++
Raw Normal View History

2023-10-26 21:08:57 +00:00
#pragma once
#include <json/value.h>
#include <iostream>
#include <map>
#include <mutex>
#include <string>
#include "gtkmm/box.h"
#include "gtkmm/image.h"
#include "gtkmm/revealer.h"
#include "util/pipewire/privacy_node_info.hpp"
2023-10-28 22:17:53 +00:00
using waybar::util::PipewireBackend::PrivacyNodeInfo;
using waybar::util::PipewireBackend::PrivacyNodeType;
2023-10-26 21:08:57 +00:00
namespace waybar::modules::privacy {
class PrivacyItem : public Gtk::Revealer {
public:
2023-10-28 22:17:53 +00:00
PrivacyItem(const Json::Value &config_, enum PrivacyNodeType privacy_type_,
std::list<PrivacyNodeInfo *> *nodes, const std::string &pos);
2023-10-26 21:08:57 +00:00
bool is_enabled();
void set_in_use(bool in_use);
void set_icon_size(uint size);
private:
2023-10-28 22:17:53 +00:00
enum PrivacyNodeType privacy_type;
std::list<PrivacyNodeInfo *> *nodes;
2023-10-26 21:08:57 +00:00
2023-10-28 22:17:53 +00:00
Gtk::Box tooltip_window;
2023-10-26 21:08:57 +00:00
bool init = false;
bool in_use = false;
std::string lastStatus;
// Config
bool enabled = true;
std::string iconName = "image-missing-symbolic";
2023-10-28 22:17:53 +00:00
bool tooltip = true;
uint tooltipIconSize = 24;
2023-10-26 21:08:57 +00:00
Gtk::Box box_;
Gtk::Image icon_;
void on_child_revealed_changed();
void on_map_changed();
2023-10-28 22:17:53 +00:00
void update_tooltip();
2023-10-26 21:08:57 +00:00
};
} // namespace waybar::modules::privacy