Skip to content

Commit

Permalink
Issue Alexays#3375: add tooltip-with-markup config flag to AModule
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertMueller2 committed Jul 20, 2024
1 parent 15e1547 commit 1c1c82c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/AModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class AModule : public IModule {

SCROLL_DIR getScrollDir(GdkEventScroll *e);
bool tooltipEnabled() const;
bool tooltipMarkupEnabled() const;

const std::string name_;
const Json::Value &config_;
Expand All @@ -50,6 +51,7 @@ class AModule : public IModule {
private:
bool handleUserEvent(GdkEventButton *const &ev);
const bool isTooltip;
const bool isMarkupTooltip;
bool hasUserEvents_;
std::vector<int> pid_;
gdouble distance_scrolled_y_;
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-mpris.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ The *mpris* module displays currently playing media via libplayerctl.
typeof: string ++
The status-specific tooltip format.

*tooltip-with-markup*: ++
typeof: bool ++
default: true ++
Whether to accept pango markup in the tooltip.

*artist-len*: ++
typeof: integer ++
Maximum length of the Artist tag (Wide/Fullwidth Unicode characters count as two). Set to zero to hide the artist in `{dynamic}` tag.
Expand Down
5 changes: 5 additions & 0 deletions src/AModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ AModule::AModule(const Json::Value& config, const std::string& name, const std::
: name_(name),
config_(config),
isTooltip{config_["tooltip"].isBool() ? config_["tooltip"].asBool() : true},
isMarkupTooltip{isTooltip && config_["tooltip-with-markup"].isBool()
? config_["tooltip-with-markup"].asBool()
: true},
distance_scrolled_y_(0.0),
distance_scrolled_x_(0.0) {
// Configure module action Map
Expand Down Expand Up @@ -274,6 +277,8 @@ bool AModule::handleScroll(GdkEventScroll* e) {

bool AModule::tooltipEnabled() const { return isTooltip; }

bool AModule::tooltipMarkupEnabled() const { return isMarkupTooltip; }

AModule::operator Gtk::Widget&() { return event_box_; }

} // namespace waybar

0 comments on commit 1c1c82c

Please sign in to comment.