Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 on 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 don't work if my mouse-cursor is on the first screen.

How can I fix this?

share|improve this question
add comment

3 Answers

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.

share|improve this answer
add comment

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

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

share|improve this answer
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. –  Mnementh Dec 20 '10 at 21:26
@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 –  Michael Mrozek Dec 20 '10 at 21:31
Yeah, I will look at it tomorrow. At home I have only one monitor, so I cannot test it yet. –  Mnementh Dec 20 '10 at 21:34
Tried, but it doesn't work. :-( –  Mnementh Dec 21 '10 at 11:03
@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 –  Michael Mrozek Dec 21 '10 at 11:35
add comment

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
  end }
share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.