Post-0.15.0 review of the 0.15.0..HEAD range surfaced regressions and
bugs. This restores backward compatibility for existing configs/CSS,
fixes confirmed defects, and repairs the scdoc man-page build break on
master. Pango-markup tooltips are intentional and were kept.
Backward-compat restorations:
- AModule: honor legacy numeric Gdk::CursorType cursor values (int overload)
- memory: correct GiB divisor (was ~2.3% low); round bare {} placeholders
- wireplumber: scale max-volume into the linear domain so the cap works again
- idle_inhibitor: gate right/middle-click deactivate & scroll on dynamic-timeouts;
accept both dynamic-timeout(s); widen timeout to double (no fractional truncation)
- custom: keep #custom-<name>.<class> CSS selectors working (classes on box_)
- image: don't wordexp-split a single path; fall back to the literal path
- niri/window: restore hide-when-empty (new show-empty opt-in); escape tooltip
- wlr/taskbar: plain-text tooltip when markup is disabled
Bug fixes:
- tray: fix use-after-free in onAdd; guard the watcher retry timeout
- hyprland: clamp max-windows iterator (OOB); drop duplicate language tooltip block
- niri/window: supply {col}/{max_col} args in the empty branch (fmt::format_error)
- mpris: escape {dynamic}/{player} tooltip; fix dangling player; albumArtist source
- mango: fix use-after-free race (dispatch under callback_mutex_)
- mpd: contain throwing checkErrors in noexcept idle paths (no std::terminate/UAF)
- keyboard_state: always render every lock label, with guarded defaults
- bluetooth: bound GATT ReadValue timeout, opt-in + services-resolved gating,
preserve authoritative Battery1 percentage
- wireplumber: fix WpDevice reference leak / NULL handling
- battery, clock, dwl, wayfire, graph, custom_graph, transform, river: assorted
crash/logic fixes
Man page / build:
- niri-workspaces: fix scdoc "indented by an amount greater than 1"
(workspace-taskbar sub-options were mis-indented; breaks man-page build)
- document new show-empty (niri/window); correct network {txBitrate}/{rxBitrate}
Not compiled locally (no gtkmm on this host); C++ build relies on CI.
Man pages validated with scdoc 1.11.4.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
58 lines
1.7 KiB
C++
58 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <glibmm/markup.h>
|
|
#include <gtkmm/label.h>
|
|
#include <json/json.h>
|
|
|
|
#include <deque>
|
|
#include <vector>
|
|
|
|
#include "AModule.hpp"
|
|
|
|
namespace waybar {
|
|
|
|
enum class GraphType { LINE, BAR, GAUGE };
|
|
|
|
class AGraph : public AModule {
|
|
public:
|
|
AGraph(const Json::Value&, const std::string&, const std::string&, uint16_t interval = 0,
|
|
bool enable_click = false, bool enable_scroll = false);
|
|
virtual ~AGraph() = default;
|
|
auto update() -> void override;
|
|
|
|
protected:
|
|
Gtk::DrawingArea graph_;
|
|
std::deque<int> values_;
|
|
uint16_t datapoints_ = 20;
|
|
GraphType graph_type_ = GraphType::LINE;
|
|
|
|
void addValue(const int n);
|
|
|
|
const std::chrono::milliseconds interval_;
|
|
|
|
bool onDraw(const Cairo::RefPtr<Cairo::Context>& cr);
|
|
|
|
std::map<std::string, GtkMenuItem*> submenus_;
|
|
std::map<std::string, std::string> menuActionsMap_;
|
|
static void handleGtkMenuEvent(GtkMenuItem* menuitem, gpointer data);
|
|
|
|
private:
|
|
void drawFilledArea(const Cairo::RefPtr<Cairo::Context>& cr,
|
|
const std::vector<std::pair<double, double>>& points, double height,
|
|
const Gdk::RGBA& bg_color);
|
|
|
|
void drawLine(const Cairo::RefPtr<Cairo::Context>& cr,
|
|
const std::vector<std::pair<double, double>>& points, const Gdk::RGBA& fg_color);
|
|
|
|
void drawPath(const Cairo::RefPtr<Cairo::Context>& cr,
|
|
const std::vector<std::pair<double, double>>& points);
|
|
|
|
void drawBars(const Cairo::RefPtr<Cairo::Context>& cr, double width, double height,
|
|
int current_value, const Gdk::RGBA& fg_color);
|
|
|
|
void drawGauge(const Cairo::RefPtr<Cairo::Context>& cr, double width, double height,
|
|
int current_value, const Gdk::RGBA& fg_color);
|
|
};
|
|
|
|
} // namespace waybar
|