mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
mpd: add paused format string
This commit is contained in:
parent
d294352845
commit
75c6e2e7d5
@ -36,6 +36,7 @@ class MPD : public ALabel {
|
|||||||
|
|
||||||
bool stopped();
|
bool stopped();
|
||||||
bool playing();
|
bool playing();
|
||||||
|
bool paused();
|
||||||
|
|
||||||
const std::string module_name_;
|
const std::string module_name_;
|
||||||
|
|
||||||
|
@ -38,13 +38,17 @@ Addressed by *mpd*
|
|||||||
*format*: ++
|
*format*: ++
|
||||||
typeof: string ++
|
typeof: string ++
|
||||||
default: "{album} - {artist} - {title}" ++
|
default: "{album} - {artist} - {title}" ++
|
||||||
Information displayed when a song is playing or paused
|
Information displayed when a song is playing.
|
||||||
|
|
||||||
*format-stopped*: ++
|
*format-stopped*: ++
|
||||||
typeof: string ++
|
typeof: string ++
|
||||||
default: "stopped" ++
|
default: "stopped" ++
|
||||||
Information displayed when the player is stopped.
|
Information displayed when the player is stopped.
|
||||||
|
|
||||||
|
*format-paused*: ++
|
||||||
|
typeof: string ++
|
||||||
|
This format is used when a song is paused.
|
||||||
|
|
||||||
*format-disconnected*: ++
|
*format-disconnected*: ++
|
||||||
typeof: string ++
|
typeof: string ++
|
||||||
default: "disconnected" ++
|
default: "disconnected" ++
|
||||||
|
@ -140,7 +140,9 @@ void waybar::modules::MPD::setLabel() {
|
|||||||
if (playing()) {
|
if (playing()) {
|
||||||
label_.get_style_context()->add_class("playing");
|
label_.get_style_context()->add_class("playing");
|
||||||
label_.get_style_context()->remove_class("paused");
|
label_.get_style_context()->remove_class("paused");
|
||||||
} else {
|
} else if (paused()) {
|
||||||
|
format =
|
||||||
|
config_["format-paused"].isString() ? config_["format-paused"].asString() : config_["format"].asString();
|
||||||
label_.get_style_context()->add_class("paused");
|
label_.get_style_context()->add_class("paused");
|
||||||
label_.get_style_context()->remove_class("playing");
|
label_.get_style_context()->remove_class("playing");
|
||||||
}
|
}
|
||||||
@ -346,3 +348,5 @@ bool waybar::modules::MPD::stopped() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool waybar::modules::MPD::playing() { return connection_ != nullptr && state_ == MPD_STATE_PLAY; }
|
bool waybar::modules::MPD::playing() { return connection_ != nullptr && state_ == MPD_STATE_PLAY; }
|
||||||
|
|
||||||
|
bool waybar::modules::MPD::paused() { return connection_ != nullptr && state_ == MPD_STATE_PAUSE; }
|
||||||
|
Loading…
Reference in New Issue
Block a user