Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open programs to active/selected screen in Awesome WM

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?

like image 354
Stefan Marbury Avatar asked Sep 28 '12 22:09

Stefan Marbury


1 Answers

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)
like image 71
Quinn Strahl Avatar answered Oct 17 '22 13:10

Quinn Strahl