mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Added tooltip-padding
This commit is contained in:
@ -50,6 +50,11 @@ UPower::UPower(const std::string& id, const Json::Value& config)
|
||||
tooltip_spacing = config_["tooltip-spacing"].asUInt();
|
||||
}
|
||||
|
||||
// Tooltip Padding
|
||||
if (config_["tooltip-padding"].isUInt()) {
|
||||
tooltip_padding = config_["tooltip-padding"].asUInt();
|
||||
}
|
||||
|
||||
// Tooltip
|
||||
if (config_["tooltip"].isBool()) {
|
||||
tooltip_enabled = config_["tooltip"].asBool();
|
||||
@ -57,7 +62,7 @@ UPower::UPower(const std::string& id, const Json::Value& config)
|
||||
box_.set_has_tooltip(tooltip_enabled);
|
||||
if (tooltip_enabled) {
|
||||
// Sets the window to use when showing the tooltip
|
||||
upower_tooltip = new UPowerTooltip(iconSize, tooltip_spacing);
|
||||
upower_tooltip = new UPowerTooltip(iconSize, tooltip_spacing, tooltip_padding);
|
||||
box_.set_tooltip_window(*upower_tooltip);
|
||||
box_.signal_query_tooltip().connect(sigc::mem_fun(*this, &UPower::show_tooltip_callback));
|
||||
}
|
||||
|
@ -7,9 +7,19 @@
|
||||
#include "gtkmm/label.h"
|
||||
|
||||
namespace waybar::modules::upower {
|
||||
UPowerTooltip::UPowerTooltip(uint iconSize_, uint tooltipSpacing_)
|
||||
: Gtk::Window(), iconSize(iconSize_), tooltipSpacing(tooltipSpacing_) {
|
||||
UPowerTooltip::UPowerTooltip(uint iconSize_, uint tooltipSpacing_, uint tooltipPadding_)
|
||||
: Gtk::Window(),
|
||||
iconSize(iconSize_),
|
||||
tooltipSpacing(tooltipSpacing_),
|
||||
tooltipPadding(tooltipPadding_) {
|
||||
contentBox = new Gtk::Box(Gtk::ORIENTATION_VERTICAL);
|
||||
|
||||
// Sets the Tooltip Padding
|
||||
contentBox->set_margin_top(tooltipPadding);
|
||||
contentBox->set_margin_bottom(tooltipPadding);
|
||||
contentBox->set_margin_left(tooltipPadding);
|
||||
contentBox->set_margin_right(tooltipPadding);
|
||||
|
||||
add(*contentBox);
|
||||
contentBox->show();
|
||||
}
|
||||
|
Reference in New Issue
Block a user