0

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", ...). 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.


Update 2: Thanks to Uli for the hint to use client::transient_for as an easier way to get the transient. 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. Now, only a very few new clients actually have a transient that is not nil. E.g., spawning git gui from a terminal does not have a transient. However, I strongly believe it should (or I misunderstood what a transient is).


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

1 Answers1

0

You are looking for c.transient_for. This contains the client object for the "parent" window or nil.

Uli Schlachter
  • 9,337
  • 1
  • 23
  • 39