waybar/include/AModule.hpp
Thomas Venriès 358426cb1c fix: No need to format string with unused 'arg' named argument (#484)
The fmt::format() function looks for the "{arg}" named argument
in the given "format" string which does not exist. It will fail
if the string contains any {...} curled-brace substring.

Consequently, any "on-click*" option's command line containing for
instance substring like "${var}" or "awk '{...}'" will crash the program.

Signed-off-by: Thomas Venriès <thomas.venries@gmail.com>
2019-10-16 22:39:45 +02:00

40 lines
923 B
C++

#pragma once
#include <glibmm/dispatcher.h>
#include <glibmm/markup.h>
#include <gtkmm/eventbox.h>
#include <json/json.h>
#include "IModule.hpp"
namespace waybar {
class AModule : public IModule {
public:
AModule(const Json::Value &, const std::string &, const std::string &,
bool enable_click = false, bool enable_scroll = false);
virtual ~AModule();
virtual auto update() -> void;
virtual operator Gtk::Widget &();
Glib::Dispatcher dp;
protected:
enum SCROLL_DIR { NONE, UP, DOWN, LEFT, RIGHT };
SCROLL_DIR getScrollDir(GdkEventScroll *e);
bool tooltipEnabled();
const Json::Value &config_;
Gtk::EventBox event_box_;
virtual bool handleToggle(GdkEventButton *const &ev);
virtual bool handleScroll(GdkEventScroll *);
private:
std::vector<int> pid_;
gdouble distance_scrolled_y_;
gdouble distance_scrolled_x_;
};
} // namespace waybar