0

How to make the Awesome's window(client) moving behavior the similar like DWM's ViewonTag patch

Follow a window to the tag it is being moved to.

Patch 20210312 prevents the window being followed if it is being moved to the "all" tag.

What code should I write here?

        awful.key({ modkey, "Shift" }, "#" .. i + 9,
                  function ()
                      if client.focus then
                          local tag = client.focus.screen.tags[i]
                          if tag then
                              client.focus:move_to_tag(tag)
                            ---   ???????? ---
                            ---   How to follow the client window? ---
                          end
                     end
                  end,
                  {description = "move focused client to tag #"..i, group = "tag"}),
ouflak
  • 2,458
  • 10
  • 44
  • 49

1 Answers1

0

After many tries I solved this. But I don't know why it needs to declare the variables screen and tag2. Why can't use tag:view_only()

-- Move client to tag.
awful.key({ modkey, "Shift" }, "#" .. i + 9,
    function ()
        if client.focus then
            local tag = client.focus.screen.tags[i]
            if tag then
                client.focus:move_to_tag(tag)
                local screen = awful.screen.focused()
                local tag2 = screen.tags[i]
                tag2:view_only()
            end
        end
    end,
    { description = "move focused client to tag #"..i, group = "tag" }
),
Tyler2P
  • 2,324
  • 26
  • 22
  • 31