fix(custom): do not take the custom module ref
This commit is contained in:
parent
8be67d5008
commit
0dba3abc1d
|
@ -10,12 +10,12 @@ namespace waybar::modules {
|
||||||
|
|
||||||
class Custom : public ALabel {
|
class Custom : public ALabel {
|
||||||
public:
|
public:
|
||||||
Custom(const std::string&, const Json::Value&);
|
Custom(const std::string, const Json::Value&);
|
||||||
auto update() -> void;
|
auto update() -> void;
|
||||||
private:
|
private:
|
||||||
void worker();
|
void worker();
|
||||||
|
|
||||||
const std::string& name_;
|
const std::string name_;
|
||||||
waybar::util::SleeperThread thread_;
|
waybar::util::SleeperThread thread_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
// "layer": "top", // Waybar at top layer
|
"layer": "top", // Waybar at top layer
|
||||||
// "position": "bottom", // Waybar at the bottom of your screen
|
// "position": "bottom", // Waybar at the bottom of your screen
|
||||||
// "height": 30, // Waybar height
|
// "height": 30, // Waybar height
|
||||||
// "width": 1280, // Waybar width
|
// "width": 1280, // Waybar width
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
"custom/spotify": {
|
"custom/spotify": {
|
||||||
"format": " {}",
|
"format": " {}",
|
||||||
"max-length": 40,
|
"max-length": 40,
|
||||||
"exec": "$HOME/.bin/mediaplayer.sh",
|
"exec": "$HOME/.config/waybar/mediaplayer.sh",
|
||||||
"exec-if": "pgrep spotify"
|
"exec-if": "pgrep spotify"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ waybar::modules::Battery::~Battery()
|
||||||
void waybar::modules::Battery::worker()
|
void waybar::modules::Battery::worker()
|
||||||
{
|
{
|
||||||
// Trigger first values
|
// Trigger first values
|
||||||
dp.emit();
|
update();
|
||||||
thread_ = [this] {
|
thread_ = [this] {
|
||||||
struct inotify_event event = {0};
|
struct inotify_event event = {0};
|
||||||
int nbytes = read(fd_, &event, sizeof(event));
|
int nbytes = read(fd_, &event, sizeof(event));
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "modules/custom.hpp"
|
#include "modules/custom.hpp"
|
||||||
|
|
||||||
waybar::modules::Custom::Custom(const std::string& name,
|
waybar::modules::Custom::Custom(const std::string name,
|
||||||
const Json::Value& config)
|
const Json::Value& config)
|
||||||
: ALabel(config), name_(name)
|
: ALabel(config), name_(name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,7 @@ waybar::modules::Network::Network(const Json::Value& config)
|
||||||
label_.set_name("network");
|
label_.set_name("network");
|
||||||
// Trigger first values
|
// Trigger first values
|
||||||
getInfo();
|
getInfo();
|
||||||
dp.emit();
|
update();
|
||||||
thread_ = [this] {
|
thread_ = [this] {
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
uint64_t len = netlinkResponse(sock_fd_, buf, sizeof(buf),
|
uint64_t len = netlinkResponse(sock_fd_, buf, sizeof(buf),
|
||||||
|
|
Loading…
Reference in New Issue