Hi. I tried to trace the call to see what it does. I am not 100% that this is what happens but this is what I found in case you find it helpful.
lazy <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/lazy.py#L122> is an InteractiveCommandClient <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/command_client.py#L150> lazy.spawn When lazy.spawn is called the __getattr__ <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/command_client.py#L186> method of the InteractiveCommandClient <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/command_client.py#L150> is called In the case of spawn call_object <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/command_client.py#L213> evaluates to CommandGraphCall <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/command_graph.py#L71>('spawn', parent) Aforementioned __getattr__ <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/command_client.py#L186> returns this <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/command_client.py#L214> which is a new instance of InteractiveCommandClient <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/command_client.py#L150> (basically a new instance of the same class with a different current_node <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/command_client.py#L47> ) lazy.spawn() (calling what lazy.spawn returns) The method __call__ <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/command_client.py#L179> of the InteractiveCommandClient <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/command_client.py#L150> is invoked (that object that was created earlier) This method returns a LazyCall <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/lazy.py#L32> object which is assigned to let's say your Key binding This is is assigned to the Key as self.commands When the key is pressed process_key_event <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/core/manager.py#L364> from Qtile <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/core/manager.py#L82> class is called In the loop <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/core/manager.py#L373> for cmd in key.commands: cmd is basically a LazyCall <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/lazy.py#L32> object self.server.call(cmd.selectors, cmd.name, cmd.args, cmd.kwargs) Server is an IPCCommandServer <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/command_interface.py#L287> and the method call <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/command_interface.py#L298> is evaluated In that method obj = libqtile.core.manager.Qtile cmd = obj.command <https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/command_object.py#L126>(name) -> obj.command('spawn') -> getattr(self, "cmd_" + name, None) -> qtile.cmd_spawn So when the LazyCall is invoked qtile.cmd_spawn is called If you test it and I am wrong please let me know. On Thursday, December 3, 2020 at 7:30:34 AM UTC+2 elParaguayo wrote: > I'm not 100% certain on how the lazy object works but my guess is > lazy.function calls this: > https://github.com/qtile/qtile/blob/1898578681a6ee8262702f353acd13d7fa2f9a8a/libqtile/command_object.py#L200 > > but I can't see *how* it calls it! > > > On Wednesday, 2 December 2020 at 22:04:45 UTC pianocomposer321 wrote: > >> Anyone? >> >> On Saturday, November 28, 2020 at 9:49:54 AM UTC-6 pianocomposer321 wrote: >> >>> Hey qtile community! >>> >>> I recently opened an issue on github pointing out the severe problem >>> when it comes to the documentation in qtile, and also asking about one >>> specific aspect that wasn't in the docs. They closed the issue and told me >>> to ask here. So that's what I'm doing. >>> >>> What in the world does lazy.function() do? I mean, I can tell that it >>> takes a user-defined function and makes it accessible to thinks like Key(), >>> and I know that the function passed as an argument takes one argument, >>> normally named qtile. (I know this from looking at examples, not the docs. >>> There's absolutely nothing about lazy.function() in the docs). So my >>> question is this: what type of object is the qtile argument, and what are >>> its properties? If you can't explain it all in a message, could you at >>> least point me to the source file for that qtile object? >>> >>> Thanks in advance! >>> >> -- You received this message because you are subscribed to the Google Groups "qtile-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/qtile-dev/cead22d1-aa31-412a-8baa-46946c1447f6n%40googlegroups.com.
