mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
style: fix
This commit is contained in:
parent
f78ef0d491
commit
0abaaf2f7f
@ -17,8 +17,8 @@ class Network : public ALabel {
|
|||||||
~Network();
|
~Network();
|
||||||
auto update() -> void;
|
auto update() -> void;
|
||||||
private:
|
private:
|
||||||
static uint64_t netlinkRequest(int, void*, uint32_t, uint32_t groups = 0);
|
static int netlinkRequest(int, void*, uint32_t, uint32_t groups = 0);
|
||||||
static uint64_t netlinkResponse(int, void*, uint32_t, uint32_t groups = 0);
|
static int netlinkResponse(int, void*, uint32_t, uint32_t groups = 0);
|
||||||
static int scanCb(struct nl_msg*, void*);
|
static int scanCb(struct nl_msg*, void*);
|
||||||
|
|
||||||
void disconnected();
|
void disconnected();
|
||||||
@ -33,7 +33,7 @@ class Network : public ALabel {
|
|||||||
int ifid_;
|
int ifid_;
|
||||||
sa_family_t family_;
|
sa_family_t family_;
|
||||||
int sock_fd_;
|
int sock_fd_;
|
||||||
struct sockaddr_nl nladdr_ = {0};
|
struct sockaddr_nl nladdr_ = {};
|
||||||
struct nl_sock* sk_ = nullptr;
|
struct nl_sock* sk_ = nullptr;
|
||||||
int nl80211_id_;
|
int nl80211_id_;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ auto waybar::ALabel::update() -> void
|
|||||||
// Nothing here
|
// Nothing here
|
||||||
}
|
}
|
||||||
|
|
||||||
bool waybar::ALabel::handleToggle(GdkEventButton* const& ev)
|
bool waybar::ALabel::handleToggle(GdkEventButton* const& /*ev*/)
|
||||||
{
|
{
|
||||||
alt = !alt;
|
alt = !alt;
|
||||||
if (alt) {
|
if (alt) {
|
||||||
|
@ -13,7 +13,7 @@ int main(int argc, char* argv[])
|
|||||||
try {
|
try {
|
||||||
waybar::Client c(argc, argv);
|
waybar::Client c(argc, argv);
|
||||||
waybar::client = &c;
|
waybar::client = &c;
|
||||||
std::signal(SIGUSR1, [] (int signal) {
|
std::signal(SIGUSR1, [] (int /*signal*/) {
|
||||||
for (auto& bar : waybar::client->bars) {
|
for (auto& bar : waybar::client->bars) {
|
||||||
(*bar).toggle();
|
(*bar).toggle();
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ waybar::modules::Cpu::Cpu(const Json::Value& config)
|
|||||||
|
|
||||||
auto waybar::modules::Cpu::update() -> void
|
auto waybar::modules::Cpu::update() -> void
|
||||||
{
|
{
|
||||||
struct sysinfo info = {0};
|
struct sysinfo info = {};
|
||||||
if (sysinfo(&info) == 0) {
|
if (sysinfo(&info) == 0) {
|
||||||
float f_load = 1.f / (1u << SI_LOAD_SHIFT);
|
float f_load = 1.f / (1u << SI_LOAD_SHIFT);
|
||||||
uint16_t load = info.loads[0] * f_load * 100 / get_nprocs();
|
uint16_t load = info.loads[0] * f_load * 100 / get_nprocs();
|
||||||
|
@ -13,7 +13,7 @@ waybar::modules::Memory::Memory(const Json::Value& config)
|
|||||||
|
|
||||||
auto waybar::modules::Memory::update() -> void
|
auto waybar::modules::Memory::update() -> void
|
||||||
{
|
{
|
||||||
struct sysinfo info = {0};
|
struct sysinfo info = {};
|
||||||
if (sysinfo(&info) == 0) {
|
if (sysinfo(&info) == 0) {
|
||||||
auto total = info.totalram * info.mem_unit;
|
auto total = info.totalram * info.mem_unit;
|
||||||
auto freeram = info.freeram * info.mem_unit;
|
auto freeram = info.freeram * info.mem_unit;
|
||||||
|
@ -165,7 +165,7 @@ int waybar::modules::Network::getExternalInterface()
|
|||||||
* consume responses till NLMSG_DONE/NLMSG_ERROR is encountered).
|
* consume responses till NLMSG_DONE/NLMSG_ERROR is encountered).
|
||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
uint64_t len = netlinkResponse(sock_fd_, resp, route_buffer_size);
|
auto len = netlinkResponse(sock_fd_, resp, route_buffer_size);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -228,7 +228,7 @@ int waybar::modules::Network::getExternalInterface()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < dstlen; i += 1) {
|
for (uint32_t i = 0; i < dstlen; i += 1) {
|
||||||
c |= *(unsigned char *)(RTA_DATA(attr) + i);
|
c |= *((unsigned char *)RTA_DATA(attr) + i);
|
||||||
}
|
}
|
||||||
has_destination = (c == 0);
|
has_destination = (c == 0);
|
||||||
break;
|
break;
|
||||||
@ -255,10 +255,10 @@ out:
|
|||||||
return ifidx;
|
return ifidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t waybar::modules::Network::netlinkRequest(int fd, void *req,
|
int waybar::modules::Network::netlinkRequest(int fd, void *req,
|
||||||
uint32_t reqlen, uint32_t groups)
|
uint32_t reqlen, uint32_t groups)
|
||||||
{
|
{
|
||||||
struct sockaddr_nl sa = {0};
|
struct sockaddr_nl sa = {};
|
||||||
sa.nl_family = AF_NETLINK;
|
sa.nl_family = AF_NETLINK;
|
||||||
sa.nl_groups = groups;
|
sa.nl_groups = groups;
|
||||||
struct iovec iov = { req, reqlen };
|
struct iovec iov = { req, reqlen };
|
||||||
@ -266,11 +266,11 @@ uint64_t waybar::modules::Network::netlinkRequest(int fd, void *req,
|
|||||||
return sendmsg(fd, &msg, 0);
|
return sendmsg(fd, &msg, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t waybar::modules::Network::netlinkResponse(int fd, void *resp,
|
int waybar::modules::Network::netlinkResponse(int fd, void *resp,
|
||||||
uint32_t resplen, uint32_t groups)
|
uint32_t resplen, uint32_t groups)
|
||||||
{
|
{
|
||||||
uint64_t ret;
|
int ret;
|
||||||
struct sockaddr_nl sa = {0};
|
struct sockaddr_nl sa = {};
|
||||||
sa.nl_family = AF_NETLINK;
|
sa.nl_family = AF_NETLINK;
|
||||||
sa.nl_groups = groups;
|
sa.nl_groups = groups;
|
||||||
struct iovec iov = { resp, resplen };
|
struct iovec iov = { resp, resplen };
|
||||||
|
Loading…
Reference in New Issue
Block a user