mirror of
https://github.com/rad4day/Waybar.git
synced 2025-07-13 22:52:30 +02:00
feat: backlight slider
This commit is contained in:
24
include/modules/backlight_slider.hpp
Normal file
24
include/modules/backlight_slider.hpp
Normal file
@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include "ASlider.hpp"
|
||||
#include "util/backlight_backend.hpp"
|
||||
|
||||
namespace waybar::modules {
|
||||
|
||||
class BacklightSlider : public ASlider {
|
||||
public:
|
||||
BacklightSlider(const std::string&, const Json::Value&);
|
||||
virtual ~BacklightSlider() = default;
|
||||
|
||||
void update() override;
|
||||
void onValueChanged() override;
|
||||
|
||||
private:
|
||||
std::chrono::milliseconds interval_;
|
||||
std::string preferred_device_;
|
||||
util::BacklightBackend backend;
|
||||
};
|
||||
|
||||
} // namespace waybar::modules
|
@ -56,9 +56,11 @@ class BacklightBackend {
|
||||
|
||||
void set_previous_best_device(const BacklightDevice *device);
|
||||
|
||||
void set_brightness(std::string preferred_device, int brightness);
|
||||
void set_brightness(std::string preferred_device, ChangeType change_type, double step);
|
||||
|
||||
void set_scaled_brightness(std::string preferred_device, int brightness);
|
||||
int get_scaled_brightness(std::string preferred_device);
|
||||
|
||||
template <class ForwardIt, class Inserter>
|
||||
static void upsert_device(ForwardIt first, ForwardIt last, Inserter inserter, udev_device *dev);
|
||||
|
||||
|
Reference in New Issue
Block a user