0

How can I get all children of the tasklist.
I have a tasklist in a function and a tasklist_buttons:

local tasklist_buttons =
    gears.table.join(
    awful.button(
        {},
        1,
        function(c)
            -- HOW TO GET THIS ↓↓↓
            -- tasklistChildren = TaskList.children
        end
     )
)

local TaskList = function(s)
  return awful.widget.tasklist(
    s,
    awful.widget.tasklist.filter.currenttags,
    tasklist_buttons,
    {},
    list_update,
    wibox.layout.fixed.horizontal()
  )
end

Can't think of a good approach.

FluffyDango
  • 133
  • 9
  • You can get it using the `mouse::press` signal instead of `awful.button`. You can also use the mouse API to get which widget is under the cursor. However, why do you need this? A while ago I needed it for aligning a context menu. There are valid use case, but i suspect there are other ways to do what you need without coupling widgets and buttons. – Emmanuel Lepage Vallee Aug 28 '22 at 23:19
  • It is for click and drag in the tasklist. I want to be able to reorder the tasklist bar with my mouse. I don't know the order of the widgets in the tasklist so I want to get it and use the swap children function. – FluffyDango Aug 30 '22 at 14:10
  • I must admit that the way we handle drag and drop is pretty terrible, but in this case the solution mentioned above will work. You can add a `set_client` method to a `widget_template` and the code will magically call it. This way you can map the clients with the widget. Then with an `awful.mousegrabber`, you can do the drag and drop. Another alternative would just be to create a custom widget to reorder clients and use the tasklist `source` property to change the order. – Emmanuel Lepage Vallee Sep 01 '22 at 07:27

0 Answers0