简体   繁体   English

Awesome-WM:在与父级相同的标签上生成客户端

[英]Awesome-WM: Spawn client on same tag as parent

My goal is to let clients that have a parent spawn on the same tag as their parents.我的目标是让拥有父母的客户与他们的父母在同一个标签上产生。 Clients w/o parents should spawn on the active tag (as usual).没有父母的客户应该在活动标签上产生(像往常一样)。

My first approach is to connect a signal using client.connect_signal("manage", ...) .我的第一种方法是使用client.connect_signal("manage", ...)连接信号。 However, I couldn't find a way to get the parent of a client or to check if it has a parent.但是,我找不到获取客户父母或检查其是否有父母的方法。 Thank you for taking a look at my problem!谢谢你看我的问题!


Update 1: I found client:get_transient_for_matching (matcher) , but the documentation is not very helpful.更新 1:我找到了client:get_transient_for_matching (matcher) ,但文档不是很有帮助。


Update 2: Thanks to Uli for the hint to use client::transient_for as an easier way to get the transient.更新 2:感谢Uli提示使用client::transient_for作为获取瞬态的更简单方法。 Using使用

client.connect_signal("manage", function (c)                                                          
    parent = c.transient_for               
    naughty.notify({ preset = naughty.config.presets.critical,               
                     title = "Debug",                   
                     text = tostring(c.window) .. " " .. (parent and tostring(parent.window) or "") })
                                                                                                      
    if parent then                                                                                    
        -- move new client to same tag and screen as parent                                                                          
        tag = parent.first_tag                                                                        
        screen = parent.screen                                                                        
        c:move_to_tag(tag)                                                                            
        c:move_to_screen(screen)                                                                      
    end                                                                                               
end)                                                                                                  

I tried to achieve my goals and added a simple debug output using notifications.我试图实现我的目标,并使用通知添加了一个简单的调试 output。 Now, only a very few new clients actually have a transient that is not nil .现在,只有极少数新客户端实际上有一个不是nil的瞬态。 Eg, spawning git gui from a terminal does not have a transient.例如,从终端git gui没有瞬态。 However, I strongly believe it should (or I misunderstood what a transient is).但是,我坚信它应该(或者我误解了瞬态是什么)。


Ubuntu 20LTS, Awesome WM version 4.3-4, awesome-extra 2019021001 Ubuntu 20LTS,Awesome WM 版本 4.3-4,awesome-extra 2019021001

You are looking for c.transient_for .您正在寻找c.transient_for This contains the client object for the "parent" window or nil .这包含“父” window 或nil的客户端 object 。

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

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