How to place an application on the second monitor with awesome-wm?

8,962

Solution 1

There is a really simple way to do this using the awful extension pack. Some distros bundle this automatically, others have it as a sub-package. Once you have it,you can simply use the built in awful.client.movetoscreen. For example I have a binding that looks like this:

awful.key({modkey}, "o", awful.client.movetoscreen)

This means with one keystroke I can send a window to the currently active tag on whatever screen it is NOT currently on. If you only have two screens this will toggle them or if you have more it will cycle through them.

Solution 2

This depends on the version of awesome you're using:

awesome 1.x

Set the screen variable in the rule:

{ rule =
    { class = "URxvt" },
    properties = { tag = tags[1][1] },
    screen = 1
}

awesome 2.x

Set the screen property on the client in the hook_manage function:

if c.class == "URxvt" then
    awful.client.movetotag(tags[1][1], c)
    c.screen = 1
end

It appears from your code sample that you're using awesome 1.x; as a sidenote, 1.x is now really old, so you might want to look into upgrading to 2.x, which uses Lua instead of a custom configuration format

Solution 3

Not exactly an answer, but a follow up.

This must have been a bug in awesome. With awesome-3.4.10 it works how you wanted it. Now, to have an application open on a predefined tag on the current screen, use something like this:

{ rule = { instance = "urxb" },
  callback = function(c)
          c.screen = mouse.screen
          c:tags({tags[c.screen][3]})
  end }
Share:
8,962

Related videos on Youtube

Mnementh
Author by

Mnementh

Updated on September 17, 2022

Comments

  • Mnementh
    Mnementh almost 2 years

    I recently got a second monitor at work and want to configure all with my window-manager: awesome. I run into a problem to put some applications on a tag on a screen. For example, I have a rule for urxvt to put it into tag one on the first screen:

                  { rule = { class = "URxvt" },
                                         properties = { tag = tags[1][1] }
                  }
    

    That works fine as long my mouse-cursor is on the first monitor. If I move my cursor onto the second screen and start an instance of urxvt, it will be placed into the actual tag on the second monitor. Same, if I configure the app for an tag on the second screen, when it doesn't work if my mouse-cursor is on the first screen.

    How can I fix this?

  • Mnementh
    Mnementh over 13 years
    I use awesome 3.4.5, that snippet is from the Lua-configuration-file rc.lua. The configuration-file I made is a copy from the standard-file, that was installed by Ubuntu in /etc/xdg/awesome/rc.lua. The example-rules are defined there in the way given here. But I assume you can define it in really different ways, as Lua is a full fledged programming-language. I will try the option tomorrow back at work.
  • Michael Mrozek
    Michael Mrozek over 13 years
    @Mne Oh, that is from the standard file; it happens to very strongly resemble the old configuration format. When I used awesome I ended up dropping the standard config and just rewriting it. If this doesn't work let me know so I can delete the answer; I'm not sure if it will
  • Mnementh
    Mnementh over 13 years
    Yeah, I will look at it tomorrow. At home I have only one monitor, so I cannot test it yet.
  • Mnementh
    Mnementh over 13 years
    Tried, but it doesn't work. :-(
  • Michael Mrozek
    Michael Mrozek over 13 years
    @mne Lame. Unfortunately I don't have awesome installed anymore, so I can't really mess with it. Good luck though; I'll poke around the documentation later today to see if I can find anything