Merge pull request #4060 from ErrorNoInternet/group-reveal-by-default

feat(group): add reveal-by-default option
This commit is contained in:
Alexis Rouillard
2026-07-04 00:12:54 +02:00
committed by GitHub
2 changed files with 19 additions and 6 deletions
+5
View File
@@ -375,6 +375,11 @@ A group may hide all but one element, showing them only on mouse hover. In order
Defines the direction of the transition animation. If true, the hidden elements will slide from left to right. If false, they will slide from right to left. Defines the direction of the transition animation. If true, the hidden elements will slide from left to right. If false, they will slide from right to left.
When the bar is vertical, it reads as top-to-bottom. When the bar is vertical, it reads as top-to-bottom.
*reveal-by-default*: ++
typeof: bool ++
default: false ++
Whether the child should be revealed when Waybar starts up. This has to be used with click-to-reveal to take effect.
Group drawers are also given the `.expanded` CSS class when they are expanded. Group drawers are also given the `.expanded` CSS class when they are expanded.
``` ```
+13 -5
View File
@@ -62,6 +62,10 @@ Group::Group(const std::string& name, const std::string& id, const Json::Value&
const bool left_to_right = (drawer_config["transition-left-to-right"].isBool() const bool left_to_right = (drawer_config["transition-left-to-right"].isBool()
? drawer_config["transition-left-to-right"].asBool() ? drawer_config["transition-left-to-right"].asBool()
: true); : true);
const bool reveal_by_default =
(drawer_config["reveal-by-default"].isBool() ? drawer_config["reveal-by-default"].asBool()
: false);
click_to_reveal = drawer_config["click-to-reveal"].asBool(); click_to_reveal = drawer_config["click-to-reveal"].asBool();
reveal_delay = drawer_config["reveal-delay"].asInt(); reveal_delay = drawer_config["reveal-delay"].asInt();
@@ -73,10 +77,11 @@ Group::Group(const std::string& name, const std::string& id, const Json::Value&
revealer.set_transition_type(transition_type); revealer.set_transition_type(transition_type);
revealer.set_transition_duration(transition_duration); revealer.set_transition_duration(transition_duration);
revealer.set_reveal_child(start_expanded); if ((click_to_reveal && reveal_by_default) || start_expanded) {
if (start_expanded) {
box.set_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT); box.set_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT);
revealer.set_reveal_child(true);
} else {
revealer.set_reveal_child(false);
} }
revealer.get_style_context()->add_class("drawer"); revealer.get_style_context()->add_class("drawer");
@@ -113,8 +118,11 @@ bool Group::handleMouseEnter(GdkEventCrossing* const& e) {
} }
reveal_timeout_ = Glib::signal_timeout().connect( reveal_timeout_ = Glib::signal_timeout().connect(
[this]() { show_group(); return false; }, [this]() {
reveal_delay); show_group();
return false;
},
reveal_delay);
} else { } else {
show_group(); show_group();
} }