File: sndio.hpp

package info (click to toggle)
waybar 0.15.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,464 kB
  • sloc: cpp: 25,331; xml: 742; python: 146; ansic: 77; makefile: 29
file content (32 lines) | stat: -rw-r--r-- 754 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once

#include <sndio.h>

#include <vector>

#include "ALabel.hpp"
#include "util/sleeper_thread.hpp"

namespace waybar::modules {

class Sndio : public ALabel {
 public:
  Sndio(const std::string&, const Json::Value&);
  virtual ~Sndio();
  auto update() -> void override;
  auto set_desc(struct sioctl_desc*, unsigned int) -> void;
  auto put_val(unsigned int, unsigned int) -> void;
  bool handleScroll(GdkEventScroll*) override;
  bool handleToggle(GdkEventButton* const&) override;

 private:
  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