Question

I've been using Awesome WM with a dual-screen setup for a while now but I cannot figure out how to configure awesome so that when I open a program, it gets opened on the currently active/selected screen. For now, all programs get started on my notebook screen, but when the focus is on the external monitor, I want to have any program that I then start to open up on the external monitor, rather than on the laptop screen.

How to configure this behavior?

Was it helpful?

Solution

What you want to do is modify the manage signal for clients; this signal is emitted whenever a new client is spawned. In the most recent version of awesome, this signal is used in the default rc.lua, and the relevant code begins like this:

client.connect_signal("manage", function (c, startup)

You are going to want to add the following code to the function passed to that signal:

awful.client.movetoscreen(c, mouse.screen)

This tells awesome to move the client to the screen the mouse is on. You could also do it for the screen the active client is on, if you prefer:

awful.client.movetoscreen(c, client.focus.screen)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top