modules: Revert button to label

This commit is contained in:
Simon Plakolb
2022-11-24 12:28:52 +01:00
parent 74fa131ebe
commit 5e9bbe5c76
43 changed files with 270 additions and 265 deletions

View File

@ -5,7 +5,7 @@
#include <string_view>
#include <vector>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "util/json.hpp"
#include "util/sleeper_thread.hpp"
@ -14,7 +14,7 @@ struct udev_device;
namespace waybar::modules {
class Backlight : public AButton {
class Backlight : public ALabel {
class BacklightDev {
public:
BacklightDev() = default;

View File

@ -15,7 +15,7 @@
#include <string>
#include <vector>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
@ -26,7 +26,7 @@ namespace fs = std::experimental::filesystem;
namespace fs = std::filesystem;
#endif
class Battery : public AButton {
class Battery : public ALabel {
public:
Battery(const std::string&, const Json::Value&);
~Battery();

View File

@ -1,6 +1,6 @@
#pragma once
#include "AButton.hpp"
#include "ALabel.hpp"
#ifdef WANT_RFKILL
#include "util/rfkill.hpp"
#endif
@ -12,7 +12,7 @@
namespace waybar::modules {
class Bluetooth : public AButton {
class Bluetooth : public ALabel {
struct ControllerInfo {
std::string path;
std::string address;

View File

@ -2,7 +2,7 @@
#include <date/tz.h>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar {
@ -14,7 +14,7 @@ namespace modules {
const std::string kCalendarPlaceholder = "calendar";
const std::string KTimezonedTimeListPlaceholder = "timezoned_time_list";
class Clock : public AButton {
class Clock : public ALabel {
public:
Clock(const std::string&, const Json::Value&);
~Clock() = default;

View File

@ -9,12 +9,12 @@
#include <utility>
#include <vector>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Cpu : public AButton {
class Cpu : public ALabel {
public:
Cpu(const std::string&, const Json::Value&);
~Cpu() = default;

View File

@ -5,14 +5,14 @@
#include <csignal>
#include <string>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "util/command.hpp"
#include "util/json.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Custom : public AButton {
class Custom : public ALabel {
public:
Custom(const std::string&, const std::string&, const Json::Value&);
~Custom();

View File

@ -5,13 +5,13 @@
#include <fstream>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "util/format.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Disk : public AButton {
class Disk : public ALabel {
public:
Disk(const std::string&, const Json::Value&);
~Disk() = default;

View File

@ -1,6 +1,6 @@
#pragma once
#include <list>
#include <functional>
#include <list>
#include <memory>
#include <mutex>
#include <string>
@ -9,7 +9,7 @@
namespace waybar::modules::hyprland {
class EventHandler {
public:
public:
virtual void onEvent(const std::string& ev) = 0;
virtual ~EventHandler() = default;
};

View File

@ -1,14 +1,13 @@
#include <fmt/format.h>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
#include "util/json.hpp"
namespace waybar::modules::hyprland {
class Language : public waybar::AButton,
public EventHandler {
class Language : public waybar::ALabel, public EventHandler {
public:
Language(const std::string&, const waybar::Bar&, const Json::Value&);
~Language();

View File

@ -9,8 +9,7 @@
namespace waybar::modules::hyprland {
class Window : public waybar::ALabel,
public EventHandler {
class Window : public waybar::ALabel, public EventHandler {
public:
Window(const std::string&, const waybar::Bar&, const Json::Value&);
~Window();

View File

@ -2,13 +2,13 @@
#include <fmt/format.h>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "bar.hpp"
#include "client.hpp"
namespace waybar::modules {
class IdleInhibitor : public AButton {
class IdleInhibitor : public ALabel {
sigc::connection timeout_;
public:

View File

@ -4,12 +4,12 @@
#include <memory>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "bar.hpp"
namespace waybar::modules {
class Inhibitor : public AButton {
class Inhibitor : public ALabel {
public:
Inhibitor(const std::string&, const waybar::Bar&, const Json::Value&);
~Inhibitor() override;

View File

@ -5,12 +5,12 @@
#include <fstream>
#include <unordered_map>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Memory : public AButton {
class Memory : public ALabel {
public:
Memory(const std::string&, const Json::Value&);
~Memory() = default;

View File

@ -7,12 +7,12 @@
#include <condition_variable>
#include <thread>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "modules/mpd/state.hpp"
namespace waybar::modules {
class MPD : public AButton {
class MPD : public ALabel {
friend class detail::Context;
// State machine

View File

@ -7,7 +7,7 @@
#include <condition_variable>
#include <thread>
#include "AButton.hpp"
#include "ALabel.hpp"
namespace waybar::modules {
class MPD;

View File

@ -10,7 +10,7 @@
#include <optional>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
#ifdef WANT_RFKILL
#include "util/rfkill.hpp"
@ -18,7 +18,7 @@
namespace waybar::modules {
class Network : public AButton {
class Network : public ALabel {
public:
Network(const std::string&, const Json::Value&);
~Network();

View File

@ -7,11 +7,11 @@
#include <algorithm>
#include <array>
#include "AButton.hpp"
#include "ALabel.hpp"
namespace waybar::modules {
class Pulseaudio : public AButton {
class Pulseaudio : public ALabel {
public:
Pulseaudio(const std::string&, const Json::Value&);
~Pulseaudio();

View File

@ -2,12 +2,12 @@
#include <fmt/chrono.h>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Clock : public AButton {
class Clock : public ALabel {
public:
Clock(const std::string&, const Json::Value&);
~Clock() = default;

View File

@ -4,12 +4,12 @@
#include <vector>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Sndio : public AButton {
class Sndio : public ALabel {
public:
Sndio(const std::string &, const Json::Value &);
~Sndio();

View File

@ -6,7 +6,7 @@
#include <map>
#include <string>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "bar.hpp"
#include "client.hpp"
#include "modules/sway/ipc/client.hpp"
@ -14,7 +14,7 @@
namespace waybar::modules::sway {
class Language : public AButton, public sigc::trackable {
class Language : public ALabel, public sigc::trackable {
public:
Language(const std::string& id, const Json::Value& config);
~Language() = default;

View File

@ -2,7 +2,7 @@
#include <fmt/format.h>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "bar.hpp"
#include "client.hpp"
#include "modules/sway/ipc/client.hpp"
@ -10,7 +10,7 @@
namespace waybar::modules::sway {
class Mode : public AButton, public sigc::trackable {
class Mode : public ALabel, public sigc::trackable {
public:
Mode(const std::string&, const Json::Value&);
~Mode() = default;

View File

@ -4,12 +4,12 @@
#include <fstream>
#include "AButton.hpp"
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Temperature : public AButton {
class Temperature : public ALabel {
public:
Temperature(const std::string&, const Json::Value&);
~Temperature() = default;

View File

@ -6,35 +6,34 @@
#include <algorithm>
#include <array>
#include "AButton.hpp"
#include "ALabel.hpp"
namespace waybar::modules {
class Wireplumber : public AButton {
public:
Wireplumber(const std::string&, const Json::Value&);
~Wireplumber();
auto update() -> void;
class Wireplumber : public ALabel {
public:
Wireplumber(const std::string&, const Json::Value&);
~Wireplumber();
auto update() -> void;
private:
void loadRequiredApiModules();
void prepare();
void activatePlugins();
static void updateVolume(waybar::modules::Wireplumber* self);
static void updateNodeName(waybar::modules::Wireplumber* self);
static uint32_t getDefaultNodeId(waybar::modules::Wireplumber* self);
static void onPluginActivated(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
static void onObjectManagerInstalled(waybar::modules::Wireplumber* self);
WpCore* wp_core_;
GPtrArray* apis_;
WpObjectManager* om_;
uint32_t pending_plugins_;
bool muted_;
double volume_;
uint32_t node_id_{0};
std::string node_name_;
private:
void loadRequiredApiModules();
void prepare();
void activatePlugins();
static void updateVolume(waybar::modules::Wireplumber* self);
static void updateNodeName(waybar::modules::Wireplumber* self);
static uint32_t getDefaultNodeId(waybar::modules::Wireplumber* self);
static void onPluginActivated(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
static void onObjectManagerInstalled(waybar::modules::Wireplumber* self);
WpCore* wp_core_;
GPtrArray* apis_;
WpObjectManager* om_;
uint32_t pending_plugins_;
bool muted_;
double volume_;
uint32_t node_id_{0};
std::string node_name_;
};
} // namespace waybar::modules
} // namespace waybar::modules