From 068bf5a311725bfef66b1f9d30be2ac5c0df59eb Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Wed, 15 Jan 2020 07:32:17 -0800 Subject: [PATCH] feat(backlight): Add enable-scroll (#1957) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * backlight: enable changing via scroll * squash! feedback * Update src/modules/backlight.cpp Co-Authored-By: Jérôme BOULMIER Co-authored-by: Jérôme BOULMIER --- include/modules/backlight.hpp | 18 ++++++++-- include/utils/file.hpp | 3 +- src/modules/backlight.cpp | 64 +++++++++++++++++++++++++++++++---- src/utils/file.cpp | 18 ++++++++-- 4 files changed, 89 insertions(+), 14 deletions(-) diff --git a/include/modules/backlight.hpp b/include/modules/backlight.hpp index ecbc6897..b62220df 100644 --- a/include/modules/backlight.hpp +++ b/include/modules/backlight.hpp @@ -1,13 +1,14 @@ #pragma once #include "components/config.hpp" -#include "settings.hpp" #include "modules/meta/inotify_module.hpp" +#include "modules/meta/input_handler.hpp" +#include "settings.hpp" POLYBAR_NS namespace modules { - class backlight_module : public inotify_module { + class backlight_module : public inotify_module, public input_handler { public: struct brightness_handle { void filepath(const string& path); @@ -17,6 +18,8 @@ namespace modules { string m_path; }; + string get_output(); + public: explicit backlight_module(const bar_settings&, string); @@ -24,20 +27,29 @@ namespace modules { bool on_event(inotify_event* event); bool build(builder* builder, const string& tag) const; + protected: + bool input(string&& cmd); + private: static constexpr auto TAG_LABEL = "