Way to collect a set of windows into a group

I want my various chat apps to all load into a tabbed group. But I can’t see how to push them into a given group, all the dispatch options to put into a group rely on them being in a given spatial relationship, which isn’t going to be reliable.

Is there something I’m missing?

Yes, you can define workspace rules. you have to define the windows then create the rules around them for example (small example)

5 – Steam main client/library on workspace 5
6 wr({
7 name = “steam-main-workspace-5”,
8 match = {
9 class = “^([Ss]team)$”,
10 title = “^([Ss]team|Steam)$”,
11 },
12 workspace = “5 silent”,
13 float = true,
14 size = “1280 800”,
15 move = “1264 625”,
16 })
17 – Steam child popups stay floating
18 wr({
19 name = “steam-popups-float”,
20 match = {
21 class = “^([Ss]team)$”,
22 title = “negative:^([Ss]team|Steam)$”,
23 },
24 float = true,
25 center = true,
26 })
28 – Steam games on workspace 4
29 wr({
30 name = “steam-games-workspace-4”,
31 match = {
32 class = “^(steam_app_[0-9]+)$”,
33 },
34 workspace = “4 silent”,
35 no_blur = true,
36 })
37
38 – Game workspace 4
39 wr({
40 name = “gamescope-workspace-4”,
41 match = {
42 class = “^(gamescope)$”,
43 },
44 workspace = “4 silent”,
45 no_blur = true,
46 })

this would designate steam for example in the exact location and size and subsequent rules for games to spawn on a different workspace.. you can do t for groups and im pretty sure special workspaces as well. i jsut dont have an example on hand and the wife is rushing me to bed.

I want my various chat apps to all load into a tabbed group.

You may be interested in the dispatcher requested here:

So the small answer is “no, there is no way to move a window into a specific group” :frowning:

Hopefully that feature request does make some progress.

I’m thinking I might be able to kludge it with moving them all to a special workspace, move all windows in that special workspace into one group, move the group back to the current workspace.

i mean yes and no…like i said you can define workspace rules so you can specifically get the name of whatever windows you want grouped up and create a special rule that puts them in a specific order in a specific place…like i showed with steam above.. i could shrink that down and also make a bind that would open them all in whatever workspace at whatever size i want.. its really just bound by your imagination and how much effort you put into trying to achieve what you want..

I don’t think a rule based method will work, as I want them in a tabbed group, which can only be applied at creation, not later. And firefox windows have an initial title of “Firefox” so I can’t distinguish between different browser windows to pick out the two that I want in the tabs.

But some manipulation later I have:

function gather()
    local workspace_tmp = "special:chat"

    -- Move the chat windows onto the temp workspace
    for _, window in pairs(hl.get_windows()) do
        if (window.title == "Google Messages for web — Mozilla Firefox"
                or window.class == "slack"
                or window.class == "signal"
                or (window.class == "firefox" and string.find(window.title, "^Element.*"))) then
            hl.dsp.window.fullscreen_state({ window = window, internal = 0, client = 2 })
            hl.dispatch(hl.dsp.window.move({ workspace = workspace_tmp, follow = true, window = window }))
            hl.dispatch(hl.dsp.window.move({ into_or_create_group = "l", window = window }))
            hl.dispatch(hl.dsp.window.move({ into_or_create_group = "u", window = window }))
            hl.dispatch(hl.dsp.window.move({ into_or_create_group = "r", window = window }))
            hl.dispatch(hl.dsp.window.move({ into_or_create_group = "d", window = window }))
        end
    end

    -- Move the tabbed group back onto workspace 1
    hl.dispatch(hl.dsp.window.move({
        window = hl.get_windows({ workspace = workspace_tmp }).first,
        follow = true,
        workspace = 1
    }))
end

hl.bind("CTRL + SHIFT + ALT + C", gather,
    { description = "Gather the chat windows and put them in a tabbed group on the first workspace" })

Which works how I want, except that the group coming back to workspace 1 doesn’t honour smart_split :frowning:. But that is very minor, this is a big improvement.

FYI: there might be a better way to do it, but if I only use 1 move into group direction, I sometimes end up with 2 tabbed groups instead of one. The ‘redundant’ lines avoid that.

A move_into_named_group would be so much nicer.