Files
Waybar/include/modules/sndio.hpp
T

33 lines
754 B
C++
Raw Normal View History

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