mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-10-31 07:52:42 +01:00 
			
		
		
		
	Merge pull request #1120 from pinselimo/use_gtk_button_v2
This commit is contained in:
		| @@ -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; | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -10,13 +10,13 @@ | ||||
| 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: | ||||
|   void onEvent(const std::string&); | ||||
|  | ||||
|   std::mutex mutex_; | ||||
| @@ -25,4 +25,4 @@ private: | ||||
|   std::string lastView; | ||||
| }; | ||||
|  | ||||
| } | ||||
| }  // namespace waybar::modules::hyprland | ||||
| @@ -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: | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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_; | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
| #include <condition_variable> | ||||
| #include <thread> | ||||
|  | ||||
| #include "ALabel.hpp" | ||||
| #include "AButton.hpp" | ||||
|  | ||||
| namespace waybar::modules { | ||||
| class MPD; | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Alex
					Alex