From 029b380c15bda9215ea5531b76adebf7e25032ea Mon Sep 17 00:00:00 2001 From: Jannik Date: Fri, 2 Feb 2024 20:54:16 +0100 Subject: [PATCH 1/2] Fix: drawer not appearing on configured side --- src/group.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/group.cpp b/src/group.cpp index cad36e51..f9061043 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -73,7 +73,13 @@ Group::Group(const std::string& name, const std::string& id, const Json::Value& revealer.get_style_context()->add_class("drawer"); revealer.add(revealer_box); - box.pack_start(revealer); + + if (left_to_right) { + box.pack_end(revealer); + } + else { + box.pack_start(revealer); + } addHoverHandlerTo(revealer); } From 08b32cb901cb992e1a79faaa5e8140fc81bfedc6 Mon Sep 17 00:00:00 2001 From: Jannik Date: Sun, 4 Feb 2024 16:17:06 +0100 Subject: [PATCH 2/2] Removing unnecessary parts of transition_type handling --- src/group.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/group.cpp b/src/group.cpp index f9061043..9deb4f3c 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -9,19 +9,18 @@ namespace waybar { -const Gtk::RevealerTransitionType getPreferredTransitionType(bool is_vertical, bool left_to_right) { +const Gtk::RevealerTransitionType getPreferredTransitionType(bool is_vertical) { + /* The transition direction of a drawer is not actually determined by the transition type, + * but rather by the order of 'box' and 'revealer_box': + * 'REVEALER_TRANSITION_TYPE_SLIDE_LEFT' and 'REVEALER_TRANSITION_TYPE_SLIDE_RIGHT' + * will result in the same thing. + * However: we still need to differentiate between vertical and horizontal transition types. + */ + if (is_vertical) { - if (left_to_right) { - return Gtk::RevealerTransitionType::REVEALER_TRANSITION_TYPE_SLIDE_DOWN; - } else { - return Gtk::RevealerTransitionType::REVEALER_TRANSITION_TYPE_SLIDE_UP; - } + return Gtk::RevealerTransitionType::REVEALER_TRANSITION_TYPE_SLIDE_UP; } else { - if (left_to_right) { - return Gtk::RevealerTransitionType::REVEALER_TRANSITION_TYPE_SLIDE_RIGHT; - } else { - return Gtk::RevealerTransitionType::REVEALER_TRANSITION_TYPE_SLIDE_LEFT; - } + return Gtk::RevealerTransitionType::REVEALER_TRANSITION_TYPE_SLIDE_LEFT; } } @@ -64,7 +63,7 @@ Group::Group(const std::string& name, const std::string& id, const Json::Value& ? drawer_config["transition-left-to-right"].asBool() : true); - auto transition_type = getPreferredTransitionType(vertical, left_to_right); + auto transition_type = getPreferredTransitionType(vertical); revealer.set_transition_type(transition_type); revealer.set_transition_duration(transition_duration);