Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/panel/widgets/mixer/mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,33 @@ void WayfireMixer::init(Gtk::Box *container)
WpCommon::get().add_widget(this);
}

void WayfireMixer::show_hide_boxes()
{
std::vector<Gtk::Box*> boxes_order = {&sinks_box, &sources_box, &streams_box, &captures_box};
std::vector<Gtk::Separator*> sep_order = {&out_in_wall, &in_streams_wall, &streams_cap_wall};
for (auto& box : boxes_order)
{
if (box->get_children().size() > 2) // label and separator, not the prettiest tbh
{
box->show();
} else
{
box->hide();
}
}

for (int i = 1; i < boxes_order.size(); i++)
{
if (boxes_order[i]->get_children().size() > 2)
{
sep_order[i - 1]->show();
} else
{
sep_order[i - 1]->hide();
}
}
}

void WayfireMixer::update_icon()
{
// depends on quick_target widget
Expand Down
2 changes: 2 additions & 0 deletions src/panel/widgets/mixer/mixer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class WayfireMixer : public WayfireWidget

Gtk::Box master_box, sinks_box, sources_box, streams_box, captures_box;

void show_hide_boxes();

std::map<WpPipewireObject*, std::unique_ptr<MixerControl>> objects_to_controls;

/** Update the icon based on volume and muted state of the quick_target widget */
Expand Down
2 changes: 2 additions & 0 deletions src/panel/widgets/mixer/wp-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ void WpCommon::add_object_to_widget(WpPipewireObject *object, WayfireMixer *widg
widget->objects_to_controls.insert({object, std::unique_ptr<MixerControl>(control)});
which_box->append((Gtk::Widget&)*control);

widget->show_hide_boxes();

// we added new controls, so maybe one of them is a default
// also initialises the quick_target for when quick_target choice is a device
if (recheck_default)
Expand Down
Loading