Client-Server Scripting Model¶
Qtile has a client-server control model - the main Qtile instance listens on a
named pipe, over which marshalled command calls and response data is passed.
This allows Qtile to be controlled fully from external scripts. Remote
interaction occurs through an instance of the
libqtile.command.interface.IPCCommandInterface class. This class
establishes a connection to the currently running instance of Qtile. A
libqtile.command.client.CommandClient can use this connection to dispatch
commands to the running instance. Commands then appear as methods with the
appropriate signature on the
CommandClient object. The object hierarchy is
described in the Commands API section of this manual. Full
command documentation is available through the Qtile Shell.
Below is a very minimal example script that inspects the current Qtile instance, and returns the integer offset of the current screen.
from libqtile.command.client import CommandClient c = CommandClient() print(c.screen.info()["index"])