Merge branch 'Alexays:master' into master

This commit is contained in:
Dordovel
2022-10-17 19:00:21 +03:00
committed by GitHub
54 changed files with 926 additions and 394 deletions

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
#include <date/tz.h>
#include "ALabel.hpp"
#include "AButton.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 ALabel {
class Clock : public AButton {
public:
Clock(const std::string&, const Json::Value&);
~Clock() = default;

View File

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

View File

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

View File

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

View File

@ -1,30 +1,28 @@
#pragma once
#include <string>
#include <memory>
#include <mutex>
#include <deque>
#include <functional>
#include <memory>
#include <mutex>
#include <string>
#include <thread>
namespace waybar::modules::hyprland {
class IPC {
public:
public:
IPC() { startIPC(); }
void registerForIPC(const std::string&, std::function<void(const std::string&)>);
std::string getSocket1Reply(const std::string& rq);
private:
private:
void startIPC();
void parseIPC(const std::string&);
void startIPC();
void parseIPC(const std::string&);
std::mutex callbackMutex;
std::deque<std::pair<std::string, std::function<void(const std::string&)>>> callbacks;
std::mutex callbackMutex;
std::deque<std::pair<std::string, std::function<void(const std::string&)>>> callbacks;
};
inline std::unique_ptr<IPC> gIPC;
inline bool modulesReady = false;
};
}; // namespace waybar::modules::hyprland

View File

@ -1,20 +1,20 @@
#include <fmt/format.h>
#include "ALabel.hpp"
#include "AButton.hpp"
#include "bar.hpp"
#include "modules/hyprland/backend.hpp"
#include "util/json.hpp"
namespace waybar::modules::hyprland {
class Language : public waybar::ALabel {
public:
class Language : public waybar::AButton {
public:
Language(const std::string&, const waybar::Bar&, const Json::Value&);
~Language() = default;
auto update() -> void;
private:
private:
void onEvent(const std::string&);
void initLanguage();
@ -26,4 +26,4 @@ private:
std::string layoutName_;
};
}
} // namespace waybar::modules::hyprland

View File

@ -10,19 +10,22 @@
namespace waybar::modules::hyprland {
class Window : public waybar::ALabel {
public:
public:
Window(const std::string&, const waybar::Bar&, const Json::Value&);
~Window() = default;
auto update() -> void;
private:
private:
uint getActiveWorkspaceID(std::string);
std::string getLastWindowTitle(uint);
void onEvent(const std::string&);
bool separate_outputs;
std::mutex mutex_;
const Bar& bar_;
util::JsonParser parser_;
std::string lastView;
};
}
} // namespace waybar::modules::hyprland

View File

@ -2,13 +2,13 @@
#include <fmt/format.h>
#include "ALabel.hpp"
#include "AButton.hpp"
#include "bar.hpp"
#include "client.hpp"
namespace waybar::modules {
class IdleInhibitor : public ALabel {
class IdleInhibitor : public AButton {
sigc::connection timeout_;
public:
@ -20,6 +20,7 @@ class IdleInhibitor : public ALabel {
private:
bool handleToggle(GdkEventButton* const& e);
void toggleStatus();
const Bar& bar_;
struct zwp_idle_inhibitor_v1* idle_inhibitor_;

View File

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

View File

@ -1,9 +1,11 @@
#pragma once
#include <fmt/format.h>
#include <fstream>
#include <jack/jack.h>
#include <jack/thread.h>
#include <fstream>
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
@ -11,26 +13,26 @@ namespace waybar::modules {
class JACK : public ALabel {
public:
JACK(const std::string&, const Json::Value&);
JACK(const std::string &, const Json::Value &);
~JACK() = default;
auto update() -> void;
int bufSize(jack_nframes_t size);
int sampleRate(jack_nframes_t rate);
int xrun();
void shutdown();
int bufSize(jack_nframes_t size);
int sampleRate(jack_nframes_t rate);
int xrun();
void shutdown();
private:
std::string JACKState();
std::string JACKState();
jack_client_t* client_;
jack_nframes_t bufsize_;
jack_nframes_t samplerate_;
unsigned int xruns_;
float load_;
bool running_;
std::mutex mutex_;
std::string state_;
jack_client_t *client_;
jack_nframes_t bufsize_;
jack_nframes_t samplerate_;
unsigned int xruns_;
float load_;
bool running_;
std::mutex mutex_;
std::string state_;
util::SleeperThread thread_;
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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