2018-08-29 18:36:39 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <dbus-status-notifier-item.h>
|
2018-10-04 16:47:06 +00:00
|
|
|
#include <gtkmm.h>
|
2018-10-26 12:53:39 +00:00
|
|
|
#include <json/json.h>
|
2018-11-02 19:59:41 +00:00
|
|
|
#ifdef FILESYSTEM_EXPERIMENTAL
|
|
|
|
#include <experimental/filesystem>
|
|
|
|
#else
|
|
|
|
#include <filesystem>
|
|
|
|
#endif
|
2018-08-29 18:36:39 +00:00
|
|
|
|
|
|
|
namespace waybar::modules::SNI {
|
|
|
|
|
|
|
|
class Item {
|
2018-10-04 16:47:06 +00:00
|
|
|
public:
|
2018-10-26 12:53:39 +00:00
|
|
|
Item(std::string, std::string, Glib::Dispatcher*, Json::Value);
|
2018-10-04 16:47:06 +00:00
|
|
|
|
|
|
|
std::string bus_name;
|
|
|
|
std::string object_path;
|
|
|
|
Gtk::EventBox event_box;
|
|
|
|
|
|
|
|
int icon_size;
|
|
|
|
int effective_icon_size;
|
|
|
|
Gtk::Image *image;
|
|
|
|
Gtk::Menu *gtk_menu = nullptr;
|
|
|
|
std::string category;
|
|
|
|
std::string id;
|
|
|
|
std::string status;
|
|
|
|
|
|
|
|
std::string title;
|
|
|
|
int32_t window_id;
|
|
|
|
std::string icon_name;
|
|
|
|
Glib::RefPtr<Gdk::Pixbuf> icon_pixmap;
|
|
|
|
std::string overlay_icon_name;
|
|
|
|
std::string attention_icon_name;
|
|
|
|
std::string attention_movie_name;
|
|
|
|
std::string icon_theme_path;
|
|
|
|
std::string menu;
|
|
|
|
bool item_is_menu;
|
|
|
|
|
|
|
|
private:
|
|
|
|
static void proxyReady(GObject *obj, GAsyncResult *res, gpointer data);
|
|
|
|
static void getAll(GObject *obj, GAsyncResult *res, gpointer data);
|
|
|
|
static void handleActivate(GObject *, GAsyncResult *, gpointer);
|
|
|
|
static void handleSecondaryActivate(GObject *, GAsyncResult *, gpointer);
|
|
|
|
|
|
|
|
void updateImage();
|
2018-10-26 12:53:39 +00:00
|
|
|
void updateMenu();
|
2018-10-04 16:47:06 +00:00
|
|
|
Glib::RefPtr<Gdk::Pixbuf> extractPixBuf(GVariant *variant);
|
|
|
|
Glib::RefPtr<Gdk::Pixbuf> getIconByName(std::string name, int size);
|
|
|
|
bool handleClick(GdkEventButton *const & /*ev*/);
|
|
|
|
|
|
|
|
Glib::Dispatcher *dp_;
|
|
|
|
GCancellable *cancellable_ = nullptr;
|
2018-10-26 08:05:54 +00:00
|
|
|
SnItem *proxy_ = nullptr;
|
2018-10-26 12:53:39 +00:00
|
|
|
Json::Value config_;
|
2018-08-29 18:36:39 +00:00
|
|
|
};
|
|
|
|
|
2018-10-04 16:47:06 +00:00
|
|
|
} // namespace waybar::modules::SNI
|