Merge pull request #2703 from czadowanie/master
upower: show-icon config option
This commit is contained in:
commit
5f8ae44233
|
@ -72,6 +72,7 @@ class UPower : public AModule {
|
||||||
std::unique_ptr<UPowerTooltip> upower_tooltip;
|
std::unique_ptr<UPowerTooltip> upower_tooltip;
|
||||||
std::string lastStatus;
|
std::string lastStatus;
|
||||||
bool showAltText;
|
bool showAltText;
|
||||||
|
bool showIcon = true;
|
||||||
bool upowerRunning;
|
bool upowerRunning;
|
||||||
guint upowerWatcher_id;
|
guint upowerWatcher_id;
|
||||||
std::string nativePath_;
|
std::string nativePath_;
|
||||||
|
|
|
@ -57,6 +57,11 @@ compatible devices in the tooltip.
|
||||||
typeof: string ++
|
typeof: string ++
|
||||||
Command to execute when clicked on the module.
|
Command to execute when clicked on the module.
|
||||||
|
|
||||||
|
*show-icon*: ++
|
||||||
|
typeof: bool ++
|
||||||
|
default: true ++
|
||||||
|
Option to disable battery icon.
|
||||||
|
|
||||||
# FORMAT REPLACEMENTS
|
# FORMAT REPLACEMENTS
|
||||||
|
|
||||||
*{percentage}*: The battery capacity in percentage
|
*{percentage}*: The battery capacity in percentage
|
||||||
|
@ -93,6 +98,15 @@ depending on the charging state.
|
||||||
"tooltip": true,
|
"tooltip": true,
|
||||||
"tooltip-spacing": 20
|
"tooltip-spacing": 20
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
```
|
||||||
|
"upower": {
|
||||||
|
"show-icon": false,
|
||||||
|
"hide-if-empty": true,
|
||||||
|
"tooltip": true,
|
||||||
|
"tooltip-spacing": 20
|
||||||
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# STYLE
|
# STYLE
|
||||||
|
|
|
@ -18,7 +18,15 @@ UPower::UPower(const std::string& id, const Json::Value& config)
|
||||||
m_Mutex(),
|
m_Mutex(),
|
||||||
client(),
|
client(),
|
||||||
showAltText(false) {
|
showAltText(false) {
|
||||||
|
// Show icon only when "show-icon" isn't set to false
|
||||||
|
if (config_["show-icon"].isBool()) {
|
||||||
|
showIcon = config_["show-icon"].asBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showIcon) {
|
||||||
box_.pack_start(icon_);
|
box_.pack_start(icon_);
|
||||||
|
}
|
||||||
|
|
||||||
box_.pack_start(label_);
|
box_.pack_start(label_);
|
||||||
box_.set_name(name_);
|
box_.set_name(name_);
|
||||||
event_box_.add(box_);
|
event_box_.add(box_);
|
||||||
|
|
Loading…
Reference in New Issue