Waybar/include/modules/network.hpp

38 lines
913 B
C++
Raw Normal View History

2018-08-09 14:38:24 +00:00
#pragma once
#include <net/if.h>
#include <netlink/netlink.h>
#include <netlink/genl/genl.h>
#include <netlink/genl/ctrl.h>
#include <linux/nl80211.h>
#include <iwlib.h> // TODO
#include <json/json.h>
#include <gtkmm.h>
#include <fmt/format.h>
#include <thread>
#include "util/chrono.hpp"
#include "IModule.hpp"
namespace waybar::modules {
class Network : public IModule {
public:
Network(Json::Value config);
auto update() -> void;
operator Gtk::Widget &();
private:
2018-08-09 20:05:15 +00:00
void _parseEssid(struct nlattr **bss);
void _parseSignal(struct nlattr **bss);
2018-08-09 14:38:24 +00:00
bool _associatedOrJoined(struct nlattr **bss);
static int _scanCb(struct nl_msg *msg, void *data);
auto _getInfo() -> void;
Gtk::Label _label;
waybar::util::SleeperThread _thread;
Json::Value _config;
std::size_t _ifid;
std::string _essid;
2018-08-09 20:05:15 +00:00
int _signalStrength;
2018-08-09 14:38:24 +00:00
};
}