Waybar icon indicating copy to clipboard operation
Waybar copied to clipboard

making a drawer open on the right

Open hfytr opened this issue 1 year ago • 2 comments

Hello, I am trying to construct a drawer that shows pulseaudio, and then shows mpris on hover like so:

  "modules-left": ["group/audio"],
   "modules-center": ["hyprland/workspaces"],
   "modules-right": ["network", "battery", "clock", "tray"],
   "group/audio": {
     "orientation": "inherit",
     "drawer": {
         "transition-duration": 500,
         "children-class": "not-power",
         "transition-left-to-right": true,
     },
     "modules": ["pulseaudio", "mpris"]
   },
   //configs for mpris and pulseaudio

I have 1 minor and a major problem.

  1. since the module is on the left, the drawer needs to slide out on the left, but it comes out on the left and I can't find a fix.

  2. my modules are round, so pulseaudio needs to have different css when the drawer is extended vs non-extended.

hfytr avatar Jan 31 '24 22:01 hfytr

accident sry

hfytr avatar Jan 31 '24 22:01 hfytr

I can recreate your problem. transition-left-to-right doesn't seem to change anything.

When looking at the Object Hierarchy with this, Revealer comes before EventBox (the leaderObject): 20240202_16h43m46s_grim

Since changing the transition_type of revealer doesn't change anything, I tried moving Revealer after the leaderObject:

diff --git a/src/group.cpp b/src/group.cpp
index cad36e51..997ab628 100644
--- a/src/group.cpp
+++ b/src/group.cpp
@@ -73,7 +73,7 @@ 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);
+    box.pack_end(revealer);
 
     addHoverHandlerTo(revealer);
   }

It worked: 20240202_17h00m51s_grim Hidden Modules now appear on the right side.

@Alexays did I miss something on how revealer works?

I'll add an If statement to check which function to use based on transition-left-to-right and make a PR.

I might even be able to remove to whole preferedTransitionType thing.

jramrath avatar Feb 02 '24 16:02 jramrath