简体   繁体   English

在Awesome WM中打开活动/选定屏幕的程序

[英]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. 我一直在使用Awesome WM和双屏幕设置一段时间,但我无法弄清楚如何配置真棒,以便当我打开一个程序时,它会在当前活动/选定的屏幕上打开。 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? 如何配置此行为?

What you want to do is modify the manage signal for clients; 你想要做的是修改客户的manage信号; 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: 在最新版本的awesome中,此信号在默认的rc.lua中使用,相关代码如下所示:

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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM