linuxwindow-managersawesome-wm

Open program in focused screen's tag and be persistent on it in Awesomewm


In awesomewm whenever I open a new client it opens in current focused tag, but If I move my focus to another tag it then opens in that tag.

I want it to open in my current tag where I tried to spawn it.

So, If I am on tag "1" and I spawn client X and then I switch focus to tag "2", client X should still open in tag "1" Even if the client X has multiple windows to draw for e.g discord has 2 windows ( loading and actual app).

I couldn't find anything.


Solution

  • The awful.spawn() function takes a second parameter for rules to apply to the opened client.

    See the documentation https://awesomewm.org/doc/api/libraries/awful.spawn.html#spawn for the spawn function and the Spawning applications with specific properties section earlier on this same page.

    You can use these rules to force a specific tag to the client:

    awful.spawn("firefox", { tag = mouse.screen.selected_tag })
    

    (Note that it only works if the client supports the startup notifications protocol.)