Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions include/AAppIconLabel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ namespace waybar {
class AAppIconLabel : public AIconLabel {
public:
AAppIconLabel(const Json::Value& config, const std::string& name, const std::string& id,
const std::string& format, uint16_t interval = 0, bool ellipsize = false,
bool enable_click = false, bool enable_scroll = false);
const std::string& format, std::mutex& reap_mtx, std::list<pid_t>& reap,
uint16_t interval = 0, bool ellipsize = false, bool enable_click = false,
bool enable_scroll = false);
virtual ~AAppIconLabel() = default;
auto update() -> void override;

Expand Down
5 changes: 3 additions & 2 deletions include/AIconLabel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ namespace waybar {
class AIconLabel : public ALabel {
public:
AIconLabel(const Json::Value& config, const std::string& name, const std::string& id,
const std::string& format, uint16_t interval = 0, bool ellipsize = false,
bool enable_click = false, bool enable_scroll = false);
const std::string& format, std::mutex& reap_mtx, std::list<pid_t>& reap,
uint16_t interval = 0, bool ellipsize = false, bool enable_click = false,
bool enable_scroll = false);
virtual ~AIconLabel() = default;
auto update() -> void override;

Expand Down
4 changes: 2 additions & 2 deletions include/ALabel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace waybar {
class ALabel : public AModule {
public:
ALabel(const Json::Value&, const std::string&, const std::string&, const std::string& format,
uint16_t interval = 0, bool ellipsize = false, bool enable_click = false,
bool enable_scroll = false);
std::mutex& reap_mtx, std::list<pid_t>& reap, uint16_t interval = 0,
bool ellipsize = false, bool enable_click = false, bool enable_scroll = false);
virtual ~ALabel() = default;
auto update() -> void override;
virtual std::string getIcon(uint16_t, const std::string& alt = "", uint16_t max = 0);
Expand Down
7 changes: 5 additions & 2 deletions include/AModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ class AModule : public IModule {

bool expandEnabled() const;

std::mutex& reap_mtx;
std::list<pid_t>& reap;

protected:
// Don't need to make an object directly
// Derived classes are able to use it
AModule(const Json::Value&, const std::string&, const std::string&, bool enable_click = false,
bool enable_scroll = false);
AModule(const Json::Value&, const std::string&, const std::string&, std::mutex& reap_mtx,
std::list<pid_t>& reap, bool enable_click = false, bool enable_scroll = false);

enum SCROLL_DIR { NONE, UP, DOWN, LEFT, RIGHT };

Expand Down
5 changes: 3 additions & 2 deletions include/ASlider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ namespace waybar {

class ASlider : public AModule {
public:
ASlider(const Json::Value& config, const std::string& name, const std::string& id);
ASlider(const Json::Value& config, const std::string& name, const std::string& id,
std::mutex& reap_mtx, std::list<pid_t>& reap);
virtual void onValueChanged();

protected:
Expand All @@ -16,4 +17,4 @@ class ASlider : public AModule {
Gtk::Scale scale_;
};

} // namespace waybar
} // namespace waybar
4 changes: 4 additions & 0 deletions include/IModule.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#pragma once

#include <gtkmm/widget.h>
#include <sys/types.h>

#include <list>
#include <mutex>

namespace waybar {

Expand Down
1 change: 1 addition & 0 deletions include/factory.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <dlfcn.h>
#include <json/json.h>

#include <AModule.hpp>
Expand Down
2 changes: 1 addition & 1 deletion include/modules/backlight.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace waybar::modules {

class Backlight : public ALabel {
public:
Backlight(const std::string&, const Json::Value&);
Backlight(const std::string&, const Json::Value&, std::mutex&, std::list<pid_t>&);
virtual ~Backlight() = default;
auto update() -> void override;

Expand Down
4 changes: 2 additions & 2 deletions include/modules/backlight_slider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace waybar::modules {

class BacklightSlider : public ASlider {
public:
BacklightSlider(const std::string&, const Json::Value&);
BacklightSlider(const std::string&, const Json::Value&, std::mutex&, std::list<pid_t>&);
virtual ~BacklightSlider() = default;

void update() override;
Expand All @@ -21,4 +21,4 @@ class BacklightSlider : public ASlider {
util::BacklightBackend backend;
};

} // namespace waybar::modules
} // namespace waybar::modules
3 changes: 2 additions & 1 deletion include/modules/battery.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ namespace fs = std::filesystem;

class Battery : public ALabel {
public:
Battery(const std::string&, const waybar::Bar&, const Json::Value&);
Battery(const std::string&, const waybar::Bar&, const Json::Value&, std::mutex&,
std::list<pid_t>&);
virtual ~Battery();
auto update() -> void override;

Expand Down
2 changes: 1 addition & 1 deletion include/modules/bluetooth.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Bluetooth : public ALabel {
};

public:
Bluetooth(const std::string&, const Json::Value&);
Bluetooth(const std::string&, const Json::Value&, std::mutex&, std::list<pid_t>&);
virtual ~Bluetooth() = default;
auto update() -> void override;

Expand Down
2 changes: 1 addition & 1 deletion include/modules/cava/cavaGLSL.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace waybar::modules::cava {

class CavaGLSL final : public AModule, public Gtk::GLArea {
public:
CavaGLSL(const std::string&, const Json::Value&);
CavaGLSL(const std::string&, const Json::Value&, std::mutex& reap_mtx, std::list<pid_t>& reap);
~CavaGLSL() = default;

private:
Expand Down
2 changes: 1 addition & 1 deletion include/modules/cava/cavaRaw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace waybar::modules::cava {

class Cava final : public ALabel, public sigc::trackable {
public:
Cava(const std::string&, const Json::Value&);
Cava(const std::string&, const Json::Value&, std::mutex&, std::list<pid_t>&);
~Cava() = default;
auto doAction(const std::string& name) -> void override;

Expand Down
27 changes: 0 additions & 27 deletions include/modules/cava/cava_frontend.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion include/modules/cffi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct wbcffi_config_entry {

class CFFI : public AModule {
public:
CFFI(const std::string&, const std::string&, const Json::Value&);
CFFI(const std::string&, const std::string&, const Json::Value&, std::mutex&, std::list<pid_t>&);
virtual ~CFFI();

virtual auto refresh(int signal) -> void override;
Expand Down
2 changes: 1 addition & 1 deletion include/modules/clock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ enum class WS { LEFT, RIGHT, HIDDEN };

class Clock final : public ALabel {
public:
Clock(const std::string&, const Json::Value&);
Clock(const std::string&, const Json::Value&, std::mutex&, std::list<pid_t>&);
virtual ~Clock() = default;
auto update() -> void override;
auto doAction(const std::string&) -> void override;
Expand Down
2 changes: 1 addition & 1 deletion include/modules/cpu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace waybar::modules {

class Cpu : public ALabel {
public:
Cpu(const std::string&, const Json::Value&);
Cpu(const std::string&, const Json::Value&, std::mutex&, std::list<pid_t>&);
virtual ~Cpu() = default;
auto update() -> void override;

Expand Down
2 changes: 1 addition & 1 deletion include/modules/cpu_frequency.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace waybar::modules {

class CpuFrequency : public ALabel {
public:
CpuFrequency(const std::string&, const Json::Value&);
CpuFrequency(const std::string&, const Json::Value&, std::mutex&, std::list<pid_t>&);
virtual ~CpuFrequency() = default;
auto update() -> void override;

Expand Down
2 changes: 1 addition & 1 deletion include/modules/cpu_usage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace waybar::modules {

class CpuUsage : public ALabel {
public:
CpuUsage(const std::string&, const Json::Value&);
CpuUsage(const std::string&, const Json::Value&, std::mutex&, std::list<pid_t>&);
virtual ~CpuUsage() = default;
auto update() -> void override;

Expand Down
3 changes: 2 additions & 1 deletion include/modules/custom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ namespace waybar::modules {

class Custom : public ALabel {
public:
Custom(const std::string&, const std::string&, const Json::Value&, const std::string&);
Custom(const std::string&, const std::string&, const Json::Value&, const std::string&,
std::mutex&, std::list<pid_t>&);
virtual ~Custom();
auto update() -> void override;
void refresh(int /*signal*/) override;
Expand Down
2 changes: 1 addition & 1 deletion include/modules/disk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace waybar::modules {

class Disk : public ALabel {
public:
Disk(const std::string&, const Json::Value&);
Disk(const std::string&, const Json::Value&, std::mutex&, std::list<pid_t>&);
virtual ~Disk() = default;
auto update() -> void override;

Expand Down
2 changes: 1 addition & 1 deletion include/modules/dwl/tags.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace waybar::modules::dwl {

class Tags : public waybar::AModule {
public:
Tags(const std::string&, const waybar::Bar&, const Json::Value&);
Tags(const std::string&, const waybar::Bar&, const Json::Value&, std::mutex&, std::list<pid_t>&);
virtual ~Tags();

// Handlers for wayland events
Expand Down
3 changes: 2 additions & 1 deletion include/modules/dwl/window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ namespace waybar::modules::dwl {

class Window : public AAppIconLabel, public sigc::trackable {
public:
Window(const std::string&, const waybar::Bar&, const Json::Value&);
Window(const std::string&, const waybar::Bar&, const Json::Value&, std::mutex&,
std::list<pid_t>&);
~Window();

void handle_layout(const uint32_t layout);
Expand Down
3 changes: 2 additions & 1 deletion include/modules/ext/workspace_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class Workspace;

class WorkspaceManager final : public AModule {
public:
WorkspaceManager(const std::string& id, const waybar::Bar& bar, const Json::Value& config);
WorkspaceManager(const std::string& id, const waybar::Bar& bar, const Json::Value& config,
std::mutex&, std::list<pid_t>&);
~WorkspaceManager() override;
void register_manager(wl_registry* registry, uint32_t name, uint32_t version);
void remove_workspace_group(uint32_t id);
Expand Down
2 changes: 1 addition & 1 deletion include/modules/gamemode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace waybar::modules {

class Gamemode : public AModule {
public:
Gamemode(const std::string&, const Json::Value&);
Gamemode(const std::string&, const Json::Value&, std::mutex&, std::list<pid_t>&);
virtual ~Gamemode();
auto update() -> void override;

Expand Down
2 changes: 1 addition & 1 deletion include/modules/gps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace waybar::modules {

class Gps : public ALabel {
public:
Gps(const std::string&, const Json::Value&);
Gps(const std::string&, const Json::Value&, std::mutex&, std::list<pid_t>&);
virtual ~Gps();
auto update() -> void override;

Expand Down
3 changes: 2 additions & 1 deletion include/modules/hyprland/language.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ namespace waybar::modules::hyprland {

class Language : public waybar::ALabel, public EventHandler {
public:
Language(const std::string&, const waybar::Bar&, const Json::Value&);
Language(const std::string&, const waybar::Bar&, const Json::Value&, std::mutex&,
std::list<pid_t>&);
virtual ~Language();

auto update() -> void override;
Expand Down
3 changes: 2 additions & 1 deletion include/modules/hyprland/submap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ namespace waybar::modules::hyprland {

class Submap : public waybar::ALabel, public EventHandler {
public:
Submap(const std::string&, const waybar::Bar&, const Json::Value&);
Submap(const std::string&, const waybar::Bar&, const Json::Value&, std::mutex&,
std::list<pid_t>&);
~Submap() override;

auto update() -> void override;
Expand Down
3 changes: 2 additions & 1 deletion include/modules/hyprland/window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ namespace waybar::modules::hyprland {

class Window : public waybar::AAppIconLabel, public EventHandler {
public:
Window(const std::string&, const waybar::Bar&, const Json::Value&);
Window(const std::string&, const waybar::Bar&, const Json::Value&, std::mutex&,
std::list<pid_t>&);
~Window() override;

auto update() -> void override;
Expand Down
3 changes: 2 additions & 1 deletion include/modules/hyprland/windowcount.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ namespace waybar::modules::hyprland {

class WindowCount : public waybar::AAppIconLabel, public EventHandler {
public:
WindowCount(const std::string&, const waybar::Bar&, const Json::Value&);
WindowCount(const std::string&, const waybar::Bar&, const Json::Value&, std::mutex&,
std::list<pid_t>&);
~WindowCount() override;

auto update() -> void override;
Expand Down
3 changes: 2 additions & 1 deletion include/modules/hyprland/workspaces.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class Workspaces;

class Workspaces : public AModule, public EventHandler {
public:
Workspaces(const std::string&, const waybar::Bar&, const Json::Value&);
Workspaces(const std::string&, const waybar::Bar&, const Json::Value&, std::mutex&,
std::list<pid_t>&);
~Workspaces() override;
void update() override;
void init();
Expand Down
3 changes: 2 additions & 1 deletion include/modules/idle_inhibitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class IdleInhibitor : public ALabel {
sigc::connection timeout_;

public:
IdleInhibitor(const std::string&, const waybar::Bar&, const Json::Value&);
IdleInhibitor(const std::string&, const waybar::Bar&, const Json::Value&, std::mutex&,
std::list<pid_t>&);
virtual ~IdleInhibitor();
auto update() -> void override;
static std::list<waybar::AModule*> modules;
Expand Down
2 changes: 1 addition & 1 deletion include/modules/image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace waybar::modules {

class Image : public AModule {
public:
Image(const std::string&, const Json::Value&);
Image(const std::string&, const Json::Value&, std::mutex&, std::list<pid_t>&);
virtual ~Image() = default;
auto update() -> void override;
void refresh(int /*signal*/) override;
Expand Down
3 changes: 2 additions & 1 deletion include/modules/inhibitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ namespace waybar::modules {

class Inhibitor : public ALabel {
public:
Inhibitor(const std::string&, const waybar::Bar&, const Json::Value&);
Inhibitor(const std::string&, const waybar::Bar&, const Json::Value&, std::mutex&,
std::list<pid_t>&);
virtual ~Inhibitor();
auto update() -> void override;
auto activated() -> bool;
Expand Down
2 changes: 1 addition & 1 deletion include/modules/jack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace waybar::modules {

class JACK : public ALabel {
public:
JACK(const std::string&, const Json::Value&);
JACK(const std::string&, const Json::Value&, std::mutex&, std::list<pid_t>&);
virtual ~JACK() = default;
auto update() -> void override;

Expand Down
3 changes: 2 additions & 1 deletion include/modules/keyboard_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ namespace waybar::modules {

class KeyboardState : public AModule {
public:
KeyboardState(const std::string&, const waybar::Bar&, const Json::Value&);
KeyboardState(const std::string&, const waybar::Bar&, const Json::Value&, std::mutex&,
std::list<pid_t>&);
virtual ~KeyboardState();
auto update() -> void override;

Expand Down
2 changes: 1 addition & 1 deletion include/modules/load.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace waybar::modules {

class Load : public ALabel {
public:
Load(const std::string&, const Json::Value&);
Load(const std::string&, const Json::Value&, std::mutex&, std::list<pid_t>&);
virtual ~Load() = default;
auto update() -> void override;

Expand Down
Loading