Skip to content

Commit ab7bfdb

Browse files
authored
Merge pull request #4937 from sjudin/group-add-start-expanded
Add start-expanded option to group
2 parents 081fb73 + 6afe108 commit ab7bfdb

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

man/waybar.5.scd.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,11 @@ A group may hide all but one element, showing them only on mouse hover. In order
363363
default: false ++
364364
Whether left click should reveal the content rather than mouse over. Note that grouped modules may still process their own on-click events.
365365

366+
*start-expanded*: ++
367+
typeof: bool ++
368+
default: false ++
369+
Defines whether the drawer should initialize in an expanded state.
370+
366371
*transition-left-to-right*: ++
367372
typeof: bool ++
368373
default: true ++

src/group.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,19 @@ Group::Group(const std::string& name, const std::string& id, const Json::Value&
6464
: true);
6565
click_to_reveal = drawer_config["click-to-reveal"].asBool();
6666

67+
const bool start_expanded =
68+
(drawer_config["start-expanded"].isBool() ? drawer_config["start-expanded"].asBool()
69+
: false);
70+
6771
auto transition_type = getPreferredTransitionType(vertical);
6872

6973
revealer.set_transition_type(transition_type);
7074
revealer.set_transition_duration(transition_duration);
71-
revealer.set_reveal_child(false);
75+
revealer.set_reveal_child(start_expanded);
76+
77+
if (start_expanded) {
78+
box.set_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT);
79+
}
7280

7381
revealer.get_style_context()->add_class("drawer");
7482

0 commit comments

Comments
 (0)