mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
group module: configurable orientation
currently, the orientation of group modules is always the opposite of the bar. Change it so that: * the default orientation of the group module is always the opposite of its parent, even for nested groups * the orientation can be overridden in the config * css ID and class are set for the group element
This commit is contained in:
12
src/bar.cpp
12
src/bar.cpp
@ -742,7 +742,13 @@ void waybar::Bar::getModules(const Factory& factory, const std::string& pos,
|
||||
AModule* module;
|
||||
|
||||
if (ref.compare(0, 6, "group/") == 0 && ref.size() > 6) {
|
||||
auto group_module = new waybar::Group(ref, *this, config[ref]);
|
||||
auto hash_pos = ref.find('#');
|
||||
auto id_name = ref.substr(6, hash_pos - 6);
|
||||
auto class_name = hash_pos != std::string::npos ? ref.substr(hash_pos + 1) : "";
|
||||
|
||||
auto parent = group ? group : &this->box_;
|
||||
auto vertical = parent->get_orientation() == Gtk::ORIENTATION_VERTICAL;
|
||||
auto group_module = new waybar::Group(id_name, class_name, config[ref], vertical);
|
||||
getModules(factory, ref, &group_module->box);
|
||||
module = group_module;
|
||||
} else {
|
||||
@ -764,11 +770,11 @@ void waybar::Bar::getModules(const Factory& factory, const std::string& pos,
|
||||
modules_right_.emplace_back(module_sp);
|
||||
}
|
||||
}
|
||||
module->dp.connect([module, name] {
|
||||
module->dp.connect([module, ref] {
|
||||
try {
|
||||
module->update();
|
||||
} catch (const std::exception& e) {
|
||||
spdlog::error("{}: {}", name.asString(), e.what());
|
||||
spdlog::error("{}: {}", ref, e.what());
|
||||
}
|
||||
});
|
||||
} catch (const std::exception& e) {
|
||||
|
Reference in New Issue
Block a user