Waybar/include/modules/sndio.hpp

33 lines
759 B
C++
Raw Normal View History

#pragma once
#include <sndio.h>
2022-04-06 06:37:19 +00:00
#include <vector>
2022-04-06 06:37:19 +00:00
2022-11-24 11:28:52 +00:00
#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
2022-11-24 11:28:52 +00:00
class Sndio : public ALabel {
public:
2022-04-06 06:37:19 +00:00
Sndio(const std::string &, const Json::Value &);
2023-03-02 13:57:07 +00:00
virtual ~Sndio();
auto update() -> void override;
auto set_desc(struct sioctl_desc *, unsigned int) -> void;
auto put_val(unsigned int, unsigned int) -> void;
2023-03-02 13:57:07 +00:00
bool handleScroll(GdkEventScroll *) override;
bool handleToggle(GdkEventButton *const &) override;
private:
2020-10-04 05:53:21 +00:00
auto connect_to_sndio() -> void;
util::SleeperThread thread_;
struct sioctl_hdl *hdl_;
std::vector<struct pollfd> pfds_;
unsigned int addr_;
unsigned int volume_, old_volume_, maxval_;
bool muted_;
};
} // namespace waybar::modules